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