Avoid duplicates in the error path (#1346)

This commit is contained in:
Paul Fultz II 2018-08-18 00:32:30 -05:00 committed by Daniel Marjamäki
parent 43233e72b2
commit fd49112196
1 changed files with 4 additions and 1 deletions

View File

@ -218,7 +218,10 @@ static void followVariableExpressionError(const Token *tok1, const Token *tok2,
return;
if (!tok2)
return;
errors->push_back(std::make_pair(tok2, "'" + tok1->str() + "' is assigned value '" + tok2->expressionString() + "' here."));
ErrorPathItem item = std::make_pair(tok2, "'" + tok1->str() + "' is assigned value '" + tok2->expressionString() + "' here.");
if(std::find(errors->begin(), errors->end(), item) != errors->end())
return;
errors->push_back(item);
}
bool isSameExpression(bool cpp, bool macro, const Token *tok1, const Token *tok2, const Library& library, bool pure, ErrorPath* errors)