diff --git a/gui/test/cppchecklibrarydata/testcppchecklibrarydata.cpp b/gui/test/cppchecklibrarydata/testcppchecklibrarydata.cpp index 2a52cf803..f6bf32fb2 100644 --- a/gui/test/cppchecklibrarydata/testcppchecklibrarydata.cpp +++ b/gui/test/cppchecklibrarydata/testcppchecklibrarydata.cpp @@ -65,8 +65,8 @@ void TestCppcheckLibraryData::podtypeValid() QCOMPARE(libraryData.podtypes[0].sign.isEmpty(), true); QCOMPARE(libraryData.podtypes[0].size.isEmpty(), true); - QCOMPARE(libraryData.podtypes[1].name, "ulong"); - QCOMPARE(libraryData.podtypes[1].stdtype, "uint32_t"); + QCOMPARE(libraryData.podtypes[1].name, "ulong"); + QCOMPARE(libraryData.podtypes[1].stdtype, "uint32_t"); QCOMPARE(libraryData.podtypes[1].sign, "u"); QCOMPARE(libraryData.podtypes[1].size, "4"); diff --git a/lib/checkstl.cpp b/lib/checkstl.cpp index 69b94e815..ff4a934ec 100644 --- a/lib/checkstl.cpp +++ b/lib/checkstl.cpp @@ -1741,7 +1741,7 @@ void CheckStl::missingComparison() if (!tok3) break; } else if (Token::simpleMatch(tok3->astParent(), "++")) - incrementToken = tok3; + incrementToken = tok3; else if (Token::simpleMatch(tok3->astParent(), "+")) { if (Token::Match(tok3->astSibling(), "%num%")) { const Token* tokenGrandParent = tok3->astParent()->astParent(); diff --git a/lib/forwardanalyzer.cpp b/lib/forwardanalyzer.cpp index 507c3a9f7..1a8794a93 100644 --- a/lib/forwardanalyzer.cpp +++ b/lib/forwardanalyzer.cpp @@ -21,8 +21,7 @@ struct ForwardTraversal { bool analyzeOnly; Terminate terminate = Terminate::None; - Progress Break(Terminate t = Terminate::None) - { + Progress Break(Terminate t = Terminate::None) { if (!analyzeOnly && t != Terminate::None) terminate = t; return Progress::Break; @@ -225,15 +224,14 @@ struct ForwardTraversal { ft.updateRange(start, end); } - std::vector forkScope(Token* endBlock, bool isModified = false) - { + std::vector forkScope(Token* endBlock, bool isModified = false) { if (analyzer->updateScope(endBlock, isModified)) { ForwardTraversal ft = *this; ft.analyzer->forkScope(endBlock); ft.updateRange(endBlock->link(), endBlock); return {ft}; } - return std::vector{}; + return std::vector {}; } static bool hasGoto(const Token* endBlock) { @@ -270,8 +268,7 @@ struct ForwardTraversal { return a; } - void continueUpdateRangeAfterLoop(std::vector& ftv, Token* start, const Token* endToken) - { + void continueUpdateRangeAfterLoop(std::vector& ftv, Token* start, const Token* endToken) { for (ForwardTraversal& ft : ftv) { // If analysis has terminated normally, then continue analysis if (ft.terminate == Terminate::None) @@ -283,8 +280,7 @@ struct ForwardTraversal { Token* endBlock, Token* condTok, Token* initTok = nullptr, - Token* stepTok = nullptr) - { + Token* stepTok = nullptr) { const bool isDoWhile = precedes(endBlock, condTok); Analyzer::Action bodyAnalysis = analyzeScope(endBlock); Analyzer::Action allAnalysis = bodyAnalysis; diff --git a/lib/programmemory.cpp b/lib/programmemory.cpp index 7cb974aa6..e675e05f1 100644 --- a/lib/programmemory.cpp +++ b/lib/programmemory.cpp @@ -10,7 +10,10 @@ #include #include -void ProgramMemory::setValue(MathLib::bigint exprid, const ValueFlow::Value& value) { values[exprid] = value; } +void ProgramMemory::setValue(MathLib::bigint exprid, const ValueFlow::Value& value) +{ + values[exprid] = value; +} const ValueFlow::Value* ProgramMemory::getValue(MathLib::bigint exprid) const { const ProgramMemory::Map::const_iterator it = values.find(exprid); @@ -61,7 +64,10 @@ void ProgramMemory::setUnknown(MathLib::bigint exprid) values[exprid].valueType = ValueFlow::Value::ValueType::UNINIT; } -bool ProgramMemory::hasValue(MathLib::bigint exprid) { return values.find(exprid) != values.end(); } +bool ProgramMemory::hasValue(MathLib::bigint exprid) +{ + return values.find(exprid) != values.end(); +} void ProgramMemory::swap(ProgramMemory &pm) { diff --git a/lib/symboldatabase.h b/lib/symboldatabase.h index b2563b296..b69011b60 100644 --- a/lib/symboldatabase.h +++ b/lib/symboldatabase.h @@ -1310,7 +1310,9 @@ public: return const_cast(this->findScope(tok, const_cast(startScope))); } - bool isVarId(nonneg int varid) const { return varid < mVariableList.size(); } + bool isVarId(nonneg int varid) const { + return varid < mVariableList.size(); + } const Variable *getVariableFromVarId(nonneg int varId) const { return mVariableList.at(varId); diff --git a/lib/token.cpp b/lib/token.cpp index bc85d3c71..cb06b8368 100644 --- a/lib/token.cpp +++ b/lib/token.cpp @@ -128,17 +128,17 @@ void Token::update_property_info() } static const std::unordered_set stdTypes = { "bool" - , "_Bool" - , "char" - , "double" - , "float" - , "int" - , "long" - , "short" - , "size_t" - , "void" - , "wchar_t" - }; + , "_Bool" + , "char" + , "double" + , "float" + , "int" + , "long" + , "short" + , "size_t" + , "void" + , "wchar_t" + }; void Token::update_property_isStandardType() { diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 2f50794e9..ddae0d07b 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -563,7 +563,7 @@ void Tokenizer::simplifyUsingToTypedef() // using a::b; => typedef a::b b; if ((Token::Match(tok, "[;{}] using %name% :: %name% ::|;") && !tok->tokAt(2)->isKeyword()) || (Token::Match(tok, "[;{}] using :: %name% :: %name% ::|;") && !tok->tokAt(3)->isKeyword())) { - Token *endtok = tok->tokAt(5); + Token *endtok = tok->tokAt(5); if (Token::Match(endtok, "%name%")) endtok = endtok->next(); while (Token::Match(endtok, ":: %name%")) @@ -3437,8 +3437,8 @@ void Tokenizer::setVarId() #define NOTSTART_C "NOT", "case", "default", "goto", "not", "return", "sizeof", "typedef" static const std::unordered_set notstart_c = { NOTSTART_C }; static const std::unordered_set notstart_cpp = { NOTSTART_C, - "delete", "friend", "new", "throw", "using", "virtual", "explicit", "const_cast", "dynamic_cast", "reinterpret_cast", "static_cast", "template" - }; + "delete", "friend", "new", "throw", "using", "virtual", "explicit", "const_cast", "dynamic_cast", "reinterpret_cast", "static_cast", "template" + }; void Tokenizer::setVarIdPass1() { @@ -9824,15 +9824,15 @@ void Tokenizer::findGarbageCode() const // Keywords in global scope static const std::unordered_set nonGlobalKeywords{"break", - "continue", - "for", - "goto", - "if", - "return", - "switch", - "while", - "try", - "catch"}; + "continue", + "for", + "goto", + "if", + "return", + "switch", + "while", + "try", + "catch"}; for (const Token *tok = tokens(); tok; tok = tok->next()) { if (tok->str() == "{") tok = tok->link(); diff --git a/lib/valueflow.cpp b/lib/valueflow.cpp index 14e515168..b7617d6be 100644 --- a/lib/valueflow.cpp +++ b/lib/valueflow.cpp @@ -1742,7 +1742,7 @@ static bool bifurcateVariableChanged(const Variable* var, bool result = false; const Token* tok = start; while ((tok = findVariableChanged( - tok->next(), end, var->isPointer(), var->declarationId(), var->isGlobal(), settings, true))) { + tok->next(), end, var->isPointer(), var->declarationId(), var->isGlobal(), settings, true))) { if (Token::Match(tok->astParent(), "%assign%")) { if (!bifurcate(tok->astParent()->astOperand2(), varids, settings, depth - 1)) return true; @@ -2312,8 +2312,7 @@ struct ExpressionAnalyzer : SingleValueFlowAnalyzer { return unknown; } - virtual ProgramState getProgramState() const OVERRIDE - { + virtual ProgramState getProgramState() const OVERRIDE { ProgramState ps; ps[expr->exprId()] = value; return ps;