Fixed #6910 (ValueFlow: variable incremented as macro argument is not known)
This commit is contained in:
parent
a51acc8abd
commit
07a064aab0
|
@ -273,7 +273,10 @@ static bool isVariableChanged(const Token *start, const Token *end, const unsign
|
|||
{
|
||||
for (const Token *tok = start; tok != end; tok = tok->next()) {
|
||||
if (tok->varId() == varid) {
|
||||
if (Token::Match(tok, "%name% ="))
|
||||
if (Token::Match(tok, "%name% =|++|--"))
|
||||
return true;
|
||||
|
||||
if (Token::Match(tok->previous(), "++|-- %name%"))
|
||||
return true;
|
||||
|
||||
if (Token::Match(tok->tokAt(-2), "[(,] & %var% [,)]"))
|
||||
|
|
|
@ -1672,6 +1672,13 @@ private:
|
|||
"}\n";
|
||||
ASSERT(isNotKnownValues(code, "!"));
|
||||
|
||||
code = "void f() {\n"
|
||||
" int x = 0;\n"
|
||||
" MACRO( v, { if (y) { x++; } } );\n"
|
||||
" if (!x) {}\n"
|
||||
"}\n";
|
||||
ASSERT(isNotKnownValues(code, "!"));
|
||||
|
||||
code = "void f() {\n"
|
||||
" int x = 0;\n"
|
||||
" for (int i = 0; i < 10; i++) {\n"
|
||||
|
|
Loading…
Reference in New Issue