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()) {
|
if (!func->hasBody()) {
|
||||||
const Token *closeParen = (*tok)->next()->link();
|
const Token *closeParen = (*tok)->next()->link();
|
||||||
if (closeParen) {
|
if (closeParen) {
|
||||||
if (Token::Match(closeParen, ") noexcept| = default ;") ||
|
const Token *eq = mTokenizer->isFunctionHead(closeParen, ";");
|
||||||
(Token::simpleMatch(closeParen, ") noexcept (") &&
|
if (eq && Token::simpleMatch(eq->tokAt(-2), "= default ;")) {
|
||||||
Token::simpleMatch(closeParen->linkAt(2), ") = default ;"))) {
|
|
||||||
func->isDefault(true);
|
func->isDefault(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -2711,10 +2710,8 @@ void SymbolDatabase::addClassFunction(Scope **scope, const Token **tok, const To
|
||||||
// normal function?
|
// normal function?
|
||||||
const Token *closeParen = (*tok)->next()->link();
|
const Token *closeParen = (*tok)->next()->link();
|
||||||
if (closeParen) {
|
if (closeParen) {
|
||||||
if (Token::Match(closeParen, ") noexcept| = default ;") ||
|
const Token *eq = mTokenizer->isFunctionHead(closeParen, ";");
|
||||||
Token::Match(closeParen, ") . const| %type% &| = default ;") ||
|
if (eq && Token::simpleMatch(eq->tokAt(-2), "= default ;")) {
|
||||||
(Token::simpleMatch(closeParen, ") noexcept (") &&
|
|
||||||
Token::simpleMatch(closeParen->linkAt(2), ") = default ;"))) {
|
|
||||||
func->isDefault(true);
|
func->isDefault(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4613,7 +4613,7 @@ private:
|
||||||
|
|
||||||
void symboldatabase86() {
|
void symboldatabase86() {
|
||||||
GET_SYMBOL_DB("class C { auto operator=(const C&) -> C&; };\n"
|
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.size() == 2);
|
||||||
ASSERT(db->scopeList.back().functionList.size() == 1);
|
ASSERT(db->scopeList.back().functionList.size() == 1);
|
||||||
ASSERT(db->scopeList.back().functionList.front().isDefault() == true);
|
ASSERT(db->scopeList.back().functionList.front().isDefault() == true);
|
||||||
|
|
Loading…
Reference in New Issue