Fix some bugs in new Scope Calculation code (#2060)
* Fix for too much information in scope name When the scope calculation encounters code such as "friend class X::Y;" or "template<> class X<void> {" it will now reset the additional name component of the scope that is about to be opened. * Made sure new scope name is reset after being used
This commit is contained in:
parent
e66e6549ee
commit
d2b9c1f15a
|
@ -1059,6 +1059,7 @@ void Token::insertToken(const std::string &tokenStr, const std::string &original
|
|||
|
||||
if (!newScopeInfo->name.empty() && !nextScopeNameAddition.empty()) newScopeInfo->name.append(" :: ");
|
||||
newScopeInfo->name.append(nextScopeNameAddition);
|
||||
nextScopeNameAddition = "";
|
||||
|
||||
newToken->scopeInfo(newScopeInfo);
|
||||
} else if (tokenStr == "}") {
|
||||
|
|
|
@ -2873,7 +2873,11 @@ void Tokenizer::calculateScopes()
|
|||
if (usingNamespaceName.length() > 0) usingNamespaceName = usingNamespaceName.substr(0, usingNamespaceName.length() - 1);
|
||||
tok->scopeInfo()->usingNamespaces.insert(usingNamespaceName);
|
||||
} else if (Token::Match(tok, "namespace|class|struct|union %name% {|::|:|<")) {
|
||||
for (Token* nameTok = tok->next(); nameTok && !Token::Match(nameTok, "{|:|<"); nameTok = nameTok->next()) {
|
||||
for (Token* nameTok = tok->next(); nameTok && !Token::Match(nameTok, "{|:"); nameTok = nameTok->next()) {
|
||||
if (Token::Match(nameTok, ";|<")) {
|
||||
nextScopeNameAddition = "";
|
||||
break;
|
||||
}
|
||||
nextScopeNameAddition.append(nameTok->str());
|
||||
nextScopeNameAddition.append(" ");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue