Invented a fix that compiles on GCC and doesn't crash.
This commit is contained in:
parent
794a491515
commit
7bd732efe4
|
@ -704,13 +704,20 @@ void CheckOther::checkRedundantAssignment()
|
||||||
if (!_tokenizer->IsScopeNoReturn(funcEnd, &noreturn) && !noreturn) {
|
if (!_tokenizer->IsScopeNoReturn(funcEnd, &noreturn) && !noreturn) {
|
||||||
for (std::map<unsigned int, const Token*>::iterator i = varAssignments.begin(); i != varAssignments.end(); ++i) {
|
for (std::map<unsigned int, const Token*>::iterator i = varAssignments.begin(); i != varAssignments.end(); ++i) {
|
||||||
const Variable* var = symbolDatabase->getVariableFromVarId(i->first);
|
const Variable* var = symbolDatabase->getVariableFromVarId(i->first);
|
||||||
if (!var || (!var->isLocal() && !var->isArgument()))
|
if (!var || (!var->isLocal() && !var->isArgument())) {
|
||||||
varAssignments.erase(i++);
|
varAssignments.erase(i++);
|
||||||
|
if (i == varAssignments.end())
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for (std::map<unsigned int, const Token*>::iterator i = memAssignments.begin(); i != memAssignments.end(); ++i) {
|
for (std::map<unsigned int, const Token*>::iterator i = memAssignments.begin(); i != memAssignments.end(); ++i) {
|
||||||
const Variable* var = symbolDatabase->getVariableFromVarId(i->first);
|
const Variable* var = symbolDatabase->getVariableFromVarId(i->first);
|
||||||
if (!var || (!var->isLocal() && !var->isArgument()))
|
if (!var || (!var->isLocal() && !var->isArgument())) {
|
||||||
memAssignments.erase(i++);
|
memAssignments.erase(i++);
|
||||||
|
if (i == memAssignments.end())
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
varAssignments.clear();
|
varAssignments.clear();
|
||||||
|
|
Loading…
Reference in New Issue