Use Token::link() instead of Token::findClosingBracket() whereever possible
This commit is contained in:
parent
fdac502c39
commit
cf5d8fa3df
|
@ -998,8 +998,8 @@ void Variable::evaluate()
|
|||
setFlag(fIsReference, true); // Set also fIsReference
|
||||
}
|
||||
|
||||
if (tok->str() == "<")
|
||||
tok->findClosingBracket(tok);
|
||||
if (tok->str() == "<" && tok->link())
|
||||
tok = tok->link();
|
||||
else
|
||||
tok = tok->next();
|
||||
}
|
||||
|
@ -1373,7 +1373,7 @@ const Token *Type::initBaseInfo(const Token *tok, const Token *tok1)
|
|||
while (tok2 && tok2->str() != "{") {
|
||||
// skip unsupported templates
|
||||
if (tok2->str() == "<")
|
||||
tok2->findClosingBracket(tok2);
|
||||
tok2 = tok2->link();
|
||||
|
||||
// check for base classes
|
||||
else if (Token::Match(tok2, ":|,")) {
|
||||
|
@ -1828,8 +1828,8 @@ void Function::addArguments(const SymbolDatabase *symbolDatabase, const Scope *s
|
|||
while (tok->next()->str() == "[")
|
||||
tok = tok->next()->link();
|
||||
} else if (tok->str() == "<") {
|
||||
bool success = tok->findClosingBracket(tok);
|
||||
if (!tok || !success) // something is wrong so just bail out
|
||||
tok = tok->link();
|
||||
if (!tok) // something is wrong so just bail out
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2297,9 +2297,8 @@ bool Scope::isVariableDeclaration(const Token* tok, const Token*& vartok, const
|
|||
const Token* localVarTok = NULL;
|
||||
|
||||
if (Token::Match(localTypeTok, "%type% <")) {
|
||||
const Token* closeTok = NULL;
|
||||
bool found = localTypeTok->next()->findClosingBracket(closeTok);
|
||||
if (found) {
|
||||
const Token* closeTok = localTypeTok->next()->link();
|
||||
if (closeTok) {
|
||||
localVarTok = skipPointers(closeTok->next());
|
||||
|
||||
if (Token::Match(localVarTok, ":: %type% %var% ;|=|(")) {
|
||||
|
|
|
@ -4637,8 +4637,7 @@ void Tokenizer::simplifyCasts()
|
|||
}
|
||||
|
||||
while (Token::Match(tok->next(), "dynamic_cast|reinterpret_cast|const_cast|static_cast <")) {
|
||||
Token *tok2 = tok->next();
|
||||
tok2->next()->findClosingBracket(tok2);
|
||||
Token *tok2 = tok->linkAt(2);
|
||||
|
||||
if (Token::simpleMatch(tok2, "> (")) {
|
||||
Token *closeBracket = tok2->next()->link();
|
||||
|
@ -7930,8 +7929,7 @@ void Tokenizer::simplifyComma()
|
|||
|
||||
// Skip unhandled template specifiers..
|
||||
if (Token::Match(tok, "%var% <")) {
|
||||
Token* tok2;
|
||||
tok->next()->findClosingBracket(tok2);
|
||||
Token* tok2 = tok->next()->link();
|
||||
if (tok2)
|
||||
tok = tok2;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue