Fix 11100: FP knownConditionTrueFalse with getter/setter member functions (#4198)
* Fix 11100: FP knownConditionTrueFalse with getter/setter member functions * Format
This commit is contained in:
parent
82af702c6f
commit
653a1ea83e
|
@ -2926,8 +2926,10 @@ struct ExpressionAnalyzer : SingleValueFlowAnalyzer {
|
|||
assert(e && e->exprId() != 0 && "Not a valid expression");
|
||||
dependOnThis = exprDependsOnThis(expr);
|
||||
setupExprVarIds(expr);
|
||||
if (val.isSymbolicValue())
|
||||
if (val.isSymbolicValue()) {
|
||||
dependOnThis |= exprDependsOnThis(val.tokvalue);
|
||||
setupExprVarIds(val.tokvalue);
|
||||
}
|
||||
}
|
||||
|
||||
static bool nonLocal(const Variable* var, bool deref) {
|
||||
|
|
|
@ -4483,6 +4483,20 @@ private:
|
|||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
// #11100
|
||||
check("struct T {\n"
|
||||
" bool m{};\n"
|
||||
" void f(bool b);\n"
|
||||
" bool get() const { return m; }\n"
|
||||
" void set(bool v) { m = v; }\n"
|
||||
"};\n"
|
||||
"void T::f(bool b) {\n"
|
||||
" bool tmp = get();\n"
|
||||
" set(b);\n"
|
||||
" if (tmp != get()) {}\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
// #9541
|
||||
check("int f(int pos, int a) {\n"
|
||||
" if (pos <= 0)\n"
|
||||
|
|
Loading…
Reference in New Issue