Fixed #7057 (valueFlowAfterAssign doesn't terminate)

This commit is contained in:
Daniel Marjamäki 2015-10-19 19:36:46 +02:00
parent c74529ae08
commit 6b9088de3f
1 changed files with 5 additions and 0 deletions

View File

@ -363,6 +363,11 @@ static bool addValue(Token *tok, const ValueFlow::Value &value)
tok->values.clear(); tok->values.clear();
} }
// Don't handle more than 10 values for performance reasons
// TODO: add setting?
if (tok->values.size() >= 10U)
return false;
// if value already exists, don't add it again // if value already exists, don't add it again
std::list<ValueFlow::Value>::iterator it; std::list<ValueFlow::Value>::iterator it;
for (it = tok->values.begin(); it != tok->values.end(); ++it) { for (it = tok->values.begin(); it != tok->values.end(); ++it) {