diff --git a/cfg/std.cfg b/cfg/std.cfg index 2cef0dc97..ffebb09c4 100644 --- a/cfg/std.cfg +++ b/cfg/std.cfg @@ -36,6 +36,19 @@ + + + + + + + + + + + + + diff --git a/lib/templatesimplifier.cpp b/lib/templatesimplifier.cpp index 48beb5384..524e60b89 100644 --- a/lib/templatesimplifier.cpp +++ b/lib/templatesimplifier.cpp @@ -3381,9 +3381,9 @@ void TemplateSimplifier::simplifyTemplates( unsigned int passCount = 0; const unsigned int passCountMax = 10; for (; passCount < passCountMax; ++passCount) { - for (auto tok = mTokenizer->list.front(); tok; tok = tok->next()) tok->scopeInfo(nullptr); - mTokenizer->calculateScopes(); - + for (auto tok = mTokenizer->list.front(); tok; tok = tok->next()) tok->scopeInfo(nullptr); + mTokenizer->calculateScopes(); + if (passCount) { // it may take more than one pass to simplify type aliases bool usingChanged = false; diff --git a/lib/token.cpp b/lib/token.cpp index 9d48a7345..50fd91473 100644 --- a/lib/token.cpp +++ b/lib/token.cpp @@ -1075,8 +1075,7 @@ void Token::insertToken(const std::string &tokenStr, const std::string &original } else { if (prepend && newToken->previous()) { newToken->mImpl->mScopeInfo = newToken->previous()->scopeInfo(); - } - else { + } else { newToken->mImpl->mScopeInfo = mImpl->mScopeInfo; } if (tokenStr == ";") { @@ -1975,10 +1974,12 @@ std::string Token::typeStr(const Token* tok) return r.first->stringifyList(r.second, false); } -void Token::scopeInfo(std::shared_ptr newScopeInfo) { +void Token::scopeInfo(std::shared_ptr newScopeInfo) +{ mImpl->mScopeInfo = newScopeInfo; } -std::shared_ptr Token::scopeInfo() const { +std::shared_ptr Token::scopeInfo() const +{ return mImpl->mScopeInfo; } diff --git a/lib/token.h b/lib/token.h index 466a7854d..9005b1dba 100644 --- a/lib/token.h +++ b/lib/token.h @@ -108,7 +108,7 @@ struct TokenImpl { // Pointer to the object representing this token's scope std::shared_ptr mScopeInfo; - + // __cppcheck_in_range__ struct CppcheckAttributes { enum Type {LOW,HIGH} type; @@ -1200,7 +1200,7 @@ public: void printAst(bool verbose, bool xml, std::ostream &out) const; void printValueFlow(bool xml, std::ostream &out) const; - + void scopeInfo(std::shared_ptr newScopeInfo); std::shared_ptr scopeInfo() const; }; diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 775e1be17..ef3f542c3 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -2880,8 +2880,7 @@ void Tokenizer::calculateScopes() if (nextScopeNameAddition.length() > 0) nextScopeNameAddition = nextScopeNameAddition.substr(0, nextScopeNameAddition.length() - 1); } - if (Token::simpleMatch(tok, "{")) - { + if (Token::simpleMatch(tok, "{")) { // This might be the opening of a member function Token *tok1 = tok; while (Token::Match(tok1->previous(), "const|volatile|final|override|&|&&|noexcept"))