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