ValueFlow: fixed one more hang in valueFlowForward
This commit is contained in:
parent
1060b30e52
commit
789b01aad2
|
@ -830,13 +830,9 @@ static bool valueFlowForward(Token * const startToken,
|
|||
errorLogger,
|
||||
tok2,
|
||||
"no simplification of " + tok2->str() + " within " + (Token::Match(parent,"[?:]") ? "?:" : parent->str()) + " expression");
|
||||
while (parent && parent->str() != "(")
|
||||
parent = parent->astParent();
|
||||
if (parent) {
|
||||
tok2 = const_cast<Token*>(parent->link());
|
||||
if (Token::simpleMatch(tok2, ") ("))
|
||||
tok2 = tok2->linkAt(1);
|
||||
}
|
||||
const Token *astTop = parent->astTop();
|
||||
if (Token::simpleMatch(astTop->astOperand1(), "for ("))
|
||||
tok2 = const_cast<Token*>(astTop->link());
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -1002,6 +1002,12 @@ private:
|
|||
"}";
|
||||
testValueOfX(code, 0U, 0);
|
||||
|
||||
code = "void f() {\n" // don't hang in valueFlowForward analysis
|
||||
" int x = 0;\n"
|
||||
" f2((char*)a[b?c[x]:x]);\n"
|
||||
"}";
|
||||
testValueOfX(code, 0U, 0);
|
||||
|
||||
// TODO: float
|
||||
code = "void f(float x) {\n"
|
||||
" if (x == 0.5) {}\n"
|
||||
|
|
Loading…
Reference in New Issue