astyle formatting

[ci skip]
This commit is contained in:
Daniel Marjamäki 2021-02-02 15:01:28 +01:00
parent a22e476162
commit c0731703af
2 changed files with 59 additions and 64 deletions

View File

@ -1522,8 +1522,7 @@ void CheckClass::operatorEqToSelf()
if (!hasAssignSelf(&func, rhs, &out_ifStatementScopeStart)) {
if (hasAllocation(&func, scope))
operatorEqToSelfError(func.token);
}
else if (out_ifStatementScopeStart != nullptr) {
} else if (out_ifStatementScopeStart != nullptr) {
if (hasAllocationInIfScope(&func, scope, out_ifStatementScopeStart))
operatorEqToSelfError(func.token);
}
@ -1598,28 +1597,21 @@ CheckClass::Bool CheckClass::isInverted(const Token *tok, const Token *rhs)
for (const Token *itr = tok; itr && itr->str()!="("; itr=itr->astParent()) {
if (Token::simpleMatch(itr, "!=") && (isTrueKeyword(itr->astOperand1()) || isTrueKeyword(itr->astOperand2()))) {
res = !res;
}
else if (Token::simpleMatch(itr, "!=") && ( (Token::simpleMatch(itr->astOperand1(), "this") && Token::simpleMatch(itr->astOperand2(), "&") && Token::simpleMatch(itr->astOperand2()->next(), rhs->str().c_str(), rhs->str().size()))
} else if (Token::simpleMatch(itr, "!=") && ((Token::simpleMatch(itr->astOperand1(), "this") && Token::simpleMatch(itr->astOperand2(), "&") && Token::simpleMatch(itr->astOperand2()->next(), rhs->str().c_str(), rhs->str().size()))
|| (Token::simpleMatch(itr->astOperand2(), "this") && Token::simpleMatch(itr->astOperand1(), "&") && Token::simpleMatch(itr->astOperand1()->next(), rhs->str().c_str(), rhs->str().size())))) {
res = !res;
}
else if (Token::simpleMatch(itr, "!=") && (isFalseKeyword(itr->astOperand1()) || isFalseKeyword(itr->astOperand2()))) {
} else if (Token::simpleMatch(itr, "!=") && (isFalseKeyword(itr->astOperand1()) || isFalseKeyword(itr->astOperand2()))) {
//Do nothing
}
else if (Token::simpleMatch(itr, "!")) {
} else if (Token::simpleMatch(itr, "!")) {
res = !res;
}
else if (Token::simpleMatch(itr, "==") && (isFalseKeyword(itr->astOperand1()) || isFalseKeyword(itr->astOperand2()))) {
} else if (Token::simpleMatch(itr, "==") && (isFalseKeyword(itr->astOperand1()) || isFalseKeyword(itr->astOperand2()))) {
res = !res;
}
else if (Token::simpleMatch(itr, "==") && (isTrueKeyword(itr->astOperand1()) || isTrueKeyword(itr->astOperand2()))) {
} else if (Token::simpleMatch(itr, "==") && (isTrueKeyword(itr->astOperand1()) || isTrueKeyword(itr->astOperand2()))) {
//Do nothing
}
else if (Token::simpleMatch(itr, "==") && ( (Token::simpleMatch(itr->astOperand1(), "this") && Token::simpleMatch(itr->astOperand2(), "&") && Token::simpleMatch(itr->astOperand2()->next(), rhs->str().c_str(), rhs->str().size()))
} else if (Token::simpleMatch(itr, "==") && ((Token::simpleMatch(itr->astOperand1(), "this") && Token::simpleMatch(itr->astOperand2(), "&") && Token::simpleMatch(itr->astOperand2()->next(), rhs->str().c_str(), rhs->str().size()))
|| (Token::simpleMatch(itr->astOperand2(), "this") && Token::simpleMatch(itr->astOperand1(), "&") && Token::simpleMatch(itr->astOperand1()->next(), rhs->str().c_str(), rhs->str().size())))) {
//Do nothing
}
else {
} else {
return Bool::BAILOUT;
}
}
@ -1633,9 +1625,12 @@ 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: return nullptr;
case Bool::TRUE: return top->link()->next();
case Bool::FALSE: return top->link()->next()->link();
case Bool::BAILOUT:
return nullptr;
case Bool::TRUE:
return top->link()->next();
case Bool::FALSE:
return top->link()->next()->link();
}
}
return nullptr;