Code formatting [ci skip]

This commit is contained in:
orbitcowboy 2021-01-04 13:09:05 +01:00
parent c546b244a9
commit 02b714f6dc
1 changed files with 8 additions and 18 deletions

View File

@ -1640,37 +1640,27 @@ void CheckStl::missingComparison()
bool bComparedInAdvance = false; bool bComparedInAdvance = false;
// Parse loop.. // Parse loop..
for (const Token *tok3 = scope.bodyStart; tok3 != scope.bodyEnd; tok3 = tok3->next()) for (const Token *tok3 = scope.bodyStart; tok3 != scope.bodyEnd; tok3 = tok3->next()) {
{ if (tok3->varId() == iteratorId) {
if (tok3->varId() == iteratorId) if (Token::Match(tok3, "%varid% = %name% . insert ( ++| %varid% ++| ,", iteratorId)) {
{
if (Token::Match(tok3, "%varid% = %name% . insert ( ++| %varid% ++| ,", iteratorId))
{
// skip insertion.. // skip insertion..
tok3 = tok3->linkAt(6); tok3 = tok3->linkAt(6);
if (!tok3) if (!tok3)
break; break;
} } else if (Token::simpleMatch(tok3->astParent(), "++")) {
else if (Token::simpleMatch(tok3->astParent(), "++"))
{
if (!bComparedInAdvance) if (!bComparedInAdvance)
incrementToken = tok3; incrementToken = tok3;
else else
bComparedInAdvance = false; bComparedInAdvance = false;
} } else if (Token::simpleMatch(tok3->astParent(), "+")) {
else if (Token::simpleMatch(tok3->astParent(), "+")) if (Token::simpleMatch(tok3->astSibling(), "1")) {
{
if (Token::simpleMatch(tok3->astSibling(), "1"))
{
const Token* tokenGrandParent = tok3->astParent()->astParent(); const Token* tokenGrandParent = tok3->astParent()->astParent();
if (Token::Match(tokenGrandParent, "==|!=")) if (Token::Match(tokenGrandParent, "==|!="))
bComparedInAdvance = true; bComparedInAdvance = true;
} }
} } else if (Token::Match(tok3->astParent(), "==|!="))
else if (Token::Match(tok3->astParent(), "==|!="))
incrementToken = nullptr; incrementToken = nullptr;
} } else if (tok3->str() == "break" || tok3->str() == "return")
else if (tok3->str() == "break" || tok3->str() == "return")
incrementToken = nullptr; incrementToken = nullptr;
} }
if (incrementToken) if (incrementToken)