* #11233 FP: knownConditionTrueFalse (wrong message text) * Format * Update testcondition.cpp * Trigger CI
This commit is contained in:
parent
b13e42978c
commit
92d569afb6
|
@ -945,7 +945,7 @@ bool exprDependsOnThis(const Token* expr, bool onVar, nonneg int depth)
|
||||||
return false;
|
return false;
|
||||||
} else if (onVar && expr->variable()) {
|
} else if (onVar && expr->variable()) {
|
||||||
const Variable* var = expr->variable();
|
const Variable* var = expr->variable();
|
||||||
return (var->isPrivate() || var->isPublic() || var->isProtected());
|
return ((var->isPrivate() || var->isPublic() || var->isProtected()) && !var->isStatic());
|
||||||
}
|
}
|
||||||
if (Token::simpleMatch(expr, "."))
|
if (Token::simpleMatch(expr, "."))
|
||||||
return exprDependsOnThis(expr->astOperand1(), onVar, depth);
|
return exprDependsOnThis(expr->astOperand1(), onVar, depth);
|
||||||
|
@ -2578,7 +2578,7 @@ bool isThisChanged(const Token* tok, int indirect, const Settings* settings, boo
|
||||||
if ((Token::Match(tok->previous(), "%name% (") && !Token::simpleMatch(tok->astOperand1(), ".")) ||
|
if ((Token::Match(tok->previous(), "%name% (") && !Token::simpleMatch(tok->astOperand1(), ".")) ||
|
||||||
Token::Match(tok->tokAt(-3), "this . %name% (")) {
|
Token::Match(tok->tokAt(-3), "this . %name% (")) {
|
||||||
if (tok->previous()->function()) {
|
if (tok->previous()->function()) {
|
||||||
return (!tok->previous()->function()->isConst());
|
return (!tok->previous()->function()->isConst() && !tok->previous()->function()->isStatic());
|
||||||
} else if (!tok->previous()->isKeyword()) {
|
} else if (!tok->previous()->isKeyword()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4249,6 +4249,17 @@ private:
|
||||||
" return col;\n"
|
" return col;\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
|
check("struct S {\n" // #11233
|
||||||
|
" static std::string m;\n"
|
||||||
|
" static void f() { m = \"abc\"; }\n"
|
||||||
|
" static void g() {\n"
|
||||||
|
" m.clear();\n"
|
||||||
|
" f();\n"
|
||||||
|
" if (m.empty()) {}\n"
|
||||||
|
" }\n"
|
||||||
|
"};\n");
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void alwaysTrueSymbolic()
|
void alwaysTrueSymbolic()
|
||||||
|
|
Loading…
Reference in New Issue