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();
|
tok = tok->linkAt(1)->next();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Token::Match(tok, "= 0|default ;")) {
|
if (Token::Match(tok, "= %any% ;")) {
|
||||||
function.isPure(tok->strAt(1) == "0");
|
function.isPure(tok->strAt(1) == "0");
|
||||||
|
function.isDefault(tok->strAt(1) == "default");
|
||||||
|
function.isDelete(tok->strAt(1) == "delete");
|
||||||
tok = tok->tokAt(2);
|
tok = tok->tokAt(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
scope->addFunction(function);
|
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;
|
||||||
// noexcept = 0;
|
// noexcept = 0;
|
||||||
// const noexcept;
|
// const noexcept;
|
||||||
|
|
|
@ -64,7 +64,7 @@ const Token * Tokenizer::isFunctionHead(const Token *tok, const std::string &end
|
||||||
tok = tok->next();
|
tok = tok->next();
|
||||||
if (Token::Match(tok, "&|&&"))
|
if (Token::Match(tok, "&|&&"))
|
||||||
tok = tok->next();
|
tok = tok->next();
|
||||||
if (Token::Match(tok, "= 0|default ;"))
|
if (Token::Match(tok, "= 0|default|delete ;"))
|
||||||
tok = tok->tokAt(2);
|
tok = tok->tokAt(2);
|
||||||
return (endsWith.find(tok->str()) != std::string::npos) ? tok : nullptr;
|
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();
|
tok = tok->link()->next();
|
||||||
while (tok && tok->isName())
|
while (tok && tok->isName())
|
||||||
tok = tok->next();
|
tok = tok->next();
|
||||||
if (Token::Match(tok, "= 0|default ;"))
|
if (Token::Match(tok, "= 0|default|delete ;"))
|
||||||
tok = tok->tokAt(2);
|
tok = tok->tokAt(2);
|
||||||
return (tok && endsWith.find(tok->str()) != std::string::npos) ? tok : nullptr;
|
return (tok && endsWith.find(tok->str()) != std::string::npos) ? tok : nullptr;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue