Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions lib/checkclass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1872,24 +1872,24 @@ CheckClass::Bool CheckClass::isInverted(const Token *tok, const Token *rhs)
|| (Token::simpleMatch(itr->astOperand2(), "this") && Token::simpleMatch(itr->astOperand1(), "&") && Token::simpleMatch(itr->astOperand1()->next(), rhs->str().c_str(), rhs->str().size())))) {
//Do nothing
} else {
return Bool::BAILOUT;
return Bool::Bailout;
}
}
if (res)
return Bool::TRUE;
return Bool::FALSE;
return Bool::True;
return Bool::False;
}

const Token * CheckClass::getIfStmtBodyStart(const Token *tok, const Token *rhs)
{
const Token *top = tok->astTop();
if (Token::simpleMatch(top->link(), ") {")) {
switch (isInverted(tok->astParent(), rhs)) {
case Bool::BAILOUT:
case Bool::Bailout:
return nullptr;
case Bool::TRUE:
case Bool::True:
return top->link()->next();
case Bool::FALSE:
case Bool::False:
return top->link()->linkAt(1);
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/checkclass.h
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ class CPPCHECKLIB CheckClass : public Check {
bool hasAllocation(const Function *func, const Scope* scope, const Token *start, const Token *end) const;
bool hasAllocationInIfScope(const Function *func, const Scope* scope, const Token *ifStatementScopeStart) const;
static bool hasAssignSelf(const Function *func, const Token *rhs, const Token *&out_ifStatementScopeStart);
enum class Bool : std::uint8_t { TRUE, FALSE, BAILOUT };
enum class Bool : std::uint8_t { True, False, Bailout };
static Bool isInverted(const Token *tok, const Token *rhs);
static const Token * getIfStmtBodyStart(const Token *tok, const Token *rhs);

Expand Down
Loading