Fixed #7007 (ValueFlow: value is not known, modified by subfunction)
This commit is contained in:
parent
cf9f12130a
commit
4ec333dbb6
|
@ -288,11 +288,9 @@ bool isVariableChanged(const Token *start, const Token *end, const unsigned int
|
||||||
const Token *parent = tok->astParent();
|
const Token *parent = tok->astParent();
|
||||||
while (parent && parent->str() == ",")
|
while (parent && parent->str() == ",")
|
||||||
parent = parent->astParent();
|
parent = parent->astParent();
|
||||||
if (parent && parent->str() == "(") {
|
if (parent && Token::Match(parent->previous(), "%name% (") && !parent->previous()->function())
|
||||||
if (parent->astOperand1() && parent->astOperand1()->isName() && !parent->astOperand1()->function())
|
return true;
|
||||||
return true;
|
// TODO: check if function parameter is non-const reference etc..
|
||||||
// TODO: check if function parameter is non-const reference etc..
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const Token *parent = tok->astParent();
|
const Token *parent = tok->astParent();
|
||||||
|
|
|
@ -1692,6 +1692,15 @@ private:
|
||||||
"}\n";
|
"}\n";
|
||||||
ASSERT(isNotKnownValues(code, "<"));
|
ASSERT(isNotKnownValues(code, "<"));
|
||||||
|
|
||||||
|
code = "void f() {\n"
|
||||||
|
" int x = 0;\n"
|
||||||
|
" do {\n"
|
||||||
|
" if (x < 0) {}\n"
|
||||||
|
" fred.dostuff(x);\n"
|
||||||
|
" } while (abc);\n"
|
||||||
|
"}\n";
|
||||||
|
ASSERT(isNotKnownValues(code, "<"));
|
||||||
|
|
||||||
code = "void f() {\n"
|
code = "void f() {\n"
|
||||||
" int x = 0;\n"
|
" int x = 0;\n"
|
||||||
" if (y) { dostuff(x); }\n"
|
" if (y) { dostuff(x); }\n"
|
||||||
|
|
Loading…
Reference in New Issue