diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index 54cb477ab..2ed7af2c4 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -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; diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 4b95cc11a..c34f040de 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -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; }