Fix 10286: false positive: uninitvar (#3271)
* Fix 10286: false positive: uninitvar * Remove header
This commit is contained in:
parent
8541e0503e
commit
e2d9aaf23b
|
@ -1844,7 +1844,7 @@ bool isVariableChanged(const Token *tok, int indirect, const Settings *settings,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cpp && Token::simpleMatch(tok2->astParent(), ">>") && tok2->astParent()->astOperand2() == tok2 && isLikelyStreamRead(cpp, tok2->astParent()))
|
if (cpp && Token::Match(tok2->astParent(), ">>|&") && astIsRHS(tok2) && isLikelyStreamRead(cpp, tok2->astParent()))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (isLikelyStream(cpp, tok2))
|
if (isLikelyStream(cpp, tok2))
|
||||||
|
|
|
@ -4731,6 +4731,17 @@ private:
|
||||||
" return (res);\n"
|
" return (res);\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
|
valueFlowUninit("struct Archive {\n"
|
||||||
|
" bool isNull;\n"
|
||||||
|
" friend void operator&(const Archive &, bool &isNull);\n"
|
||||||
|
"};\n"
|
||||||
|
"void load(Archive& ar) {\n"
|
||||||
|
" bool isNull;\n"
|
||||||
|
" ar & isNull;\n"
|
||||||
|
" if (!isNull) {}\n"
|
||||||
|
"}\n");
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void uninitvar_ipa() {
|
void uninitvar_ipa() {
|
||||||
|
|
Loading…
Reference in New Issue