SymbolDatabase; Refactoring, use Tokenizer::isFunctionHead to skip function attributes
This commit is contained in:
parent
974b6fb8e5
commit
3fe46239cf
|
@ -2637,9 +2637,8 @@ void SymbolDatabase::addClassFunction(Scope **scope, const Token **tok, const To
|
|||
if (!func->hasBody()) {
|
||||
const Token *closeParen = (*tok)->next()->link();
|
||||
if (closeParen) {
|
||||
if (Token::Match(closeParen, ") noexcept| = default ;") ||
|
||||
(Token::simpleMatch(closeParen, ") noexcept (") &&
|
||||
Token::simpleMatch(closeParen->linkAt(2), ") = default ;"))) {
|
||||
const Token *eq = mTokenizer->isFunctionHead(closeParen, ";");
|
||||
if (eq && Token::simpleMatch(eq->tokAt(-2), "= default ;")) {
|
||||
func->isDefault(true);
|
||||
return;
|
||||
}
|
||||
|
@ -2711,10 +2710,8 @@ void SymbolDatabase::addClassFunction(Scope **scope, const Token **tok, const To
|
|||
// normal function?
|
||||
const Token *closeParen = (*tok)->next()->link();
|
||||
if (closeParen) {
|
||||
if (Token::Match(closeParen, ") noexcept| = default ;") ||
|
||||
Token::Match(closeParen, ") . const| %type% &| = default ;") ||
|
||||
(Token::simpleMatch(closeParen, ") noexcept (") &&
|
||||
Token::simpleMatch(closeParen->linkAt(2), ") = default ;"))) {
|
||||
const Token *eq = mTokenizer->isFunctionHead(closeParen, ";");
|
||||
if (eq && Token::simpleMatch(eq->tokAt(-2), "= default ;")) {
|
||||
func->isDefault(true);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -4613,7 +4613,7 @@ private:
|
|||
|
||||
void symboldatabase86() {
|
||||
GET_SYMBOL_DB("class C { auto operator=(const C&) -> C&; };\n"
|
||||
"auto C::operator=(const C&) -> C& = default;");
|
||||
"auto C::operator=(const C&) -> C& = default;");
|
||||
ASSERT(db->scopeList.size() == 2);
|
||||
ASSERT(db->scopeList.back().functionList.size() == 1);
|
||||
ASSERT(db->scopeList.back().functionList.front().isDefault() == true);
|
||||
|
|
Loading…
Reference in New Issue