diff --git a/lib/checkstl.cpp b/lib/checkstl.cpp index d66e38679..97b1789f2 100644 --- a/lib/checkstl.cpp +++ b/lib/checkstl.cpp @@ -857,7 +857,7 @@ void CheckStl::invalidContainer() if (skipVarIds.count(info.tok->varId()) > 0) return false; // if (Token::simpleMatch(info.tok->next(), ".")) - // return false; + // return false; if (Token::Match(info.tok->astParent(), "%assign%") && astIsLHS(info.tok)) skipVarIds.insert(info.tok->varId()); if (info.tok->variable()->isReference() && @@ -2024,7 +2024,7 @@ void CheckStl::checkDereferenceInvalidIterator2() } // Can iterator point to END or before START? - for(const ValueFlow::Value& value:tok->values()) { + for (const ValueFlow::Value& value:tok->values()) { if (!printInconclusive && value.isInconclusive()) continue; if (!value.isIteratorValue()) @@ -2488,7 +2488,7 @@ void CheckStl::knownEmptyContainerLoop() const Token* contTok = splitTok->astOperand2(); if (!contTok) continue; - for(const ValueFlow::Value& v:contTok->values()) { + for (const ValueFlow::Value& v:contTok->values()) { if (!v.isKnown()) continue; if (!v.isContainerSizeValue()) diff --git a/lib/checkstl.h b/lib/checkstl.h index ffa98cf88..6b9e5606c 100644 --- a/lib/checkstl.h +++ b/lib/checkstl.h @@ -189,7 +189,7 @@ public: /** @brief Look for loops that can replaced with std algorithms */ void useStlAlgorithm(); - + void knownEmptyContainerLoop(); void checkMutexes(); diff --git a/lib/programmemory.cpp b/lib/programmemory.cpp index bb722d41d..4676b0af3 100644 --- a/lib/programmemory.cpp +++ b/lib/programmemory.cpp @@ -542,8 +542,7 @@ void execute(const Token *expr, *result = 0; else *error = true; - } - else if (Token::Match(expr->tokAt(-3), "%var% . %name% (")) { + } else if (Token::Match(expr->tokAt(-3), "%var% . %name% (")) { const Token* containerTok = expr->tokAt(-3); if (astIsContainer(containerTok)) { Library::Container::Yield yield = containerTok->valueType()->container->getYield(expr->strAt(-1)); diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index a5a8776f5..1637e6656 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -1452,10 +1452,10 @@ void SymbolDatabase::createSymbolDatabaseExprIds() } // Apply CSE - for(const auto& p:exprs) { + for (const auto& p:exprs) { const std::vector& tokens = p.second; - for(Token* tok1:tokens) { - for(Token* tok2:tokens) { + for (Token* tok1:tokens) { + for (Token* tok2:tokens) { if (tok1 == tok2) continue; if (tok1->exprId() == tok2->exprId()) diff --git a/lib/tokenlist.cpp b/lib/tokenlist.cpp index 521e32de1..abe898bd4 100644 --- a/lib/tokenlist.cpp +++ b/lib/tokenlist.cpp @@ -484,8 +484,7 @@ static Token * skipDecl(Token *tok) return tok; } else if (Token::Match(vartok, "%var% [:=(]")) { return vartok; - } - else if (Token::simpleMatch(vartok, "decltype (")) { + } else if (Token::simpleMatch(vartok, "decltype (")) { return vartok->linkAt(1)->next(); } vartok = vartok->next(); diff --git a/lib/valueflow.cpp b/lib/valueflow.cpp index b96d7b842..46eeaea0a 100644 --- a/lib/valueflow.cpp +++ b/lib/valueflow.cpp @@ -5649,8 +5649,10 @@ struct ContainerVariableForwardAnalyzer : VariableForwardAnalyzer { if (rhs->tokType() == Token::eString) return Action::Read | Action::Write; if (rhs->valueType() && rhs->valueType()->container && rhs->valueType()->container->stdStringLike) { - if (std::any_of(rhs->values().begin(), rhs->values().end(), [&](const ValueFlow::Value &rhsval) { return rhsval.isKnown() && rhsval.isContainerSizeValue(); })) - return Action::Read | Action::Write; + if (std::any_of(rhs->values().begin(), rhs->values().end(), [&](const ValueFlow::Value &rhsval) { + return rhsval.isKnown() && rhsval.isContainerSizeValue(); + })) + return Action::Read | Action::Write; } } else if (Token::Match(tok, "%name% . %name% (")) { Library::Container::Action action = tok->valueType()->container->getAction(tok->strAt(2)); diff --git a/test/testvalueflow.cpp b/test/testvalueflow.cpp index ffae23ab3..f6f6c59d3 100644 --- a/test/testvalueflow.cpp +++ b/test/testvalueflow.cpp @@ -326,7 +326,9 @@ private: std::list tokenValues(const char code[], const char tokstr[], ValueFlow::Value::ValueType vt, const Settings *s = nullptr) { std::list values = tokenValues(code, tokstr, s); - values.remove_if([&](const ValueFlow::Value& v) { return v.valueType != vt; }); + values.remove_if([&](const ValueFlow::Value& v) { + return v.valueType != vt; + }); return values; } diff --git a/test/testvarid.cpp b/test/testvarid.cpp index 9ae12b5a3..23e48a3e4 100644 --- a/test/testvarid.cpp +++ b/test/testvarid.cpp @@ -202,7 +202,7 @@ private: TEST_CASE(setVarIdStructMembers1); TEST_CASE(decltype1); - + TEST_CASE(exprid1); }