SymbolDatabase: Better handling of default and delete when reusing Tokenizer::isFunctionHead()
This commit is contained in:
parent
b22071cb54
commit
be8fc0f89f
|
@ -466,26 +466,16 @@ SymbolDatabase::SymbolDatabase(const Tokenizer *tokenizer, const Settings *setti
|
|||
tok = tok->linkAt(1)->next();
|
||||
}
|
||||
|
||||
if (Token::Match(tok, "= 0|default ;")) {
|
||||
if (Token::Match(tok, "= %any% ;")) {
|
||||
function.isPure(tok->strAt(1) == "0");
|
||||
function.isDefault(tok->strAt(1) == "default");
|
||||
function.isDelete(tok->strAt(1) == "delete");
|
||||
tok = tok->tokAt(2);
|
||||
}
|
||||
|
||||
scope->addFunction(function);
|
||||
}
|
||||
|
||||
// default or delete
|
||||
else if (Token::Match(end, ") = default|delete ;")) {
|
||||
if (end->strAt(2) == "default")
|
||||
function.isDefault(true);
|
||||
else
|
||||
function.isDelete(true);
|
||||
|
||||
tok = end->tokAt(3);
|
||||
|
||||
scope->addFunction(function);
|
||||
}
|
||||
|
||||
// noexcept;
|
||||
// noexcept = 0;
|
||||
// const noexcept;
|
||||
|
|
|
@ -64,7 +64,7 @@ const Token * Tokenizer::isFunctionHead(const Token *tok, const std::string &end
|
|||
tok = tok->next();
|
||||
if (Token::Match(tok, "&|&&"))
|
||||
tok = tok->next();
|
||||
if (Token::Match(tok, "= 0|default ;"))
|
||||
if (Token::Match(tok, "= 0|default|delete ;"))
|
||||
tok = tok->tokAt(2);
|
||||
return (endsWith.find(tok->str()) != std::string::npos) ? tok : nullptr;
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ const Token * Tokenizer::isFunctionHead(const Token *tok, const std::string &end
|
|||
tok = tok->link()->next();
|
||||
while (tok && tok->isName())
|
||||
tok = tok->next();
|
||||
if (Token::Match(tok, "= 0|default ;"))
|
||||
if (Token::Match(tok, "= 0|default|delete ;"))
|
||||
tok = tok->tokAt(2);
|
||||
return (tok && endsWith.find(tok->str()) != std::string::npos) ? tok : nullptr;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue