ValueFlow: isVariableChanged() should return true when variable is changed by passing its address to subfunction
This commit is contained in:
parent
5aa0b284dc
commit
ce7e879460
|
@ -276,6 +276,9 @@ static bool isVariableChanged(const Token *start, const Token *end, const unsign
|
|||
if (Token::Match(tok, "%name% ="))
|
||||
return true;
|
||||
|
||||
if (Token::Match(tok->tokAt(-2), "[(,] & %var% [,)]"))
|
||||
return true; // TODO: check if function parameter is const
|
||||
|
||||
const Token *parent = tok->astParent();
|
||||
while (Token::Match(parent, ".|::"))
|
||||
parent = parent->astParent();
|
||||
|
|
|
@ -1572,7 +1572,7 @@ private:
|
|||
code = "void f() {\n"
|
||||
" int x = 0;\n"
|
||||
" while (!x) {\n" // <- possible value
|
||||
" x = dostuff();\n"
|
||||
" scanf(\"%d\", &x);\n"
|
||||
" }\n"
|
||||
"}";
|
||||
value = valueOfTok(code, "!");
|
||||
|
|
Loading…
Reference in New Issue