Formatted the code, there are no functional changes [ci skip].
This commit is contained in:
parent
35e0dd9372
commit
f05e21efa8
|
@ -138,7 +138,10 @@ bool astIsPointer(const Token *tok)
|
|||
return tok && tok->valueType() && tok->valueType()->pointer;
|
||||
}
|
||||
|
||||
bool astIsSmartPointer(const Token* tok) { return tok && tok->valueType() && tok->valueType()->smartPointerTypeToken; }
|
||||
bool astIsSmartPointer(const Token* tok)
|
||||
{
|
||||
return tok && tok->valueType() && tok->valueType()->smartPointerTypeToken;
|
||||
}
|
||||
|
||||
bool astIsIterator(const Token *tok)
|
||||
{
|
||||
|
|
|
@ -4409,19 +4409,21 @@ struct ValueFlowConditionHandler {
|
|||
if (exprDependsOnThis(cond.vartok))
|
||||
continue;
|
||||
std::vector<const Variable*> vars = getExprVariables(cond.vartok, tokenlist, symboldatabase, settings);
|
||||
if (std::any_of(vars.begin(), vars.end(), [](const Variable* var) { return !var; }))
|
||||
continue;
|
||||
if (std::any_of(vars.begin(), vars.end(), [](const Variable* var) {
|
||||
return !var;
|
||||
}))
|
||||
continue;
|
||||
if (!vars.empty() && (vars.front()))
|
||||
if (std::any_of(vars.begin(), vars.end(), [&](const Variable* var) {
|
||||
return var && aliased.find(var->declarationId()) != aliased.end();
|
||||
})) {
|
||||
if (settings->debugwarnings)
|
||||
bailout(tokenlist,
|
||||
errorLogger,
|
||||
cond.vartok,
|
||||
"variable is aliased so we just skip all valueflow after condition");
|
||||
continue;
|
||||
}
|
||||
return var && aliased.find(var->declarationId()) != aliased.end();
|
||||
})) {
|
||||
if (settings->debugwarnings)
|
||||
bailout(tokenlist,
|
||||
errorLogger,
|
||||
cond.vartok,
|
||||
"variable is aliased so we just skip all valueflow after condition");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Token::Match(tok->astParent(), "%oror%|&&")) {
|
||||
Token *parent = tok->astParent();
|
||||
|
|
|
@ -1478,8 +1478,7 @@ private:
|
|||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void nullpointer39()
|
||||
{
|
||||
void nullpointer39() {
|
||||
check("struct A { int * x; };\n"
|
||||
"void f(struct A *a) {\n"
|
||||
" if (a->x == NULL) {}\n"
|
||||
|
@ -1490,8 +1489,7 @@ private:
|
|||
errout.str());
|
||||
}
|
||||
|
||||
void nullpointer40()
|
||||
{
|
||||
void nullpointer40() {
|
||||
check("struct A { std::unique_ptr<int> x; };\n"
|
||||
"void f(struct A *a) {\n"
|
||||
" if (a->x == nullptr) {}\n"
|
||||
|
@ -1502,8 +1500,7 @@ private:
|
|||
errout.str());
|
||||
}
|
||||
|
||||
void nullpointer41()
|
||||
{
|
||||
void nullpointer41() {
|
||||
check("struct A { int * g() const; };\n"
|
||||
"void f(struct A *a) {\n"
|
||||
" if (a->g() == nullptr) {}\n"
|
||||
|
@ -1521,8 +1518,7 @@ private:
|
|||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void nullpointer42()
|
||||
{
|
||||
void nullpointer42() {
|
||||
check("struct A { std::unique_ptr<int> g() const; };\n"
|
||||
"void f(struct A *a) {\n"
|
||||
" if (a->g() == nullptr) {}\n"
|
||||
|
|
Loading…
Reference in New Issue