Fixed #10598 (SymbolDatabase: final class is not parsed properly)
This commit is contained in:
parent
4a7bc10f32
commit
e6ccf299b9
|
@ -134,7 +134,7 @@ void SymbolDatabase::createSymbolDatabaseFindAllScopes()
|
|||
tok->progressValue());
|
||||
// Locate next class
|
||||
if ((mTokenizer->isCPP() && tok->isKeyword() &&
|
||||
((Token::Match(tok, "class|struct|union|namespace ::| %name% {|:|::|<") &&
|
||||
((Token::Match(tok, "class|struct|union|namespace ::| %name% final| {|:|::|<") &&
|
||||
!Token::Match(tok->previous(), "new|friend|const|enum|typedef|mutable|volatile|using|)|(|<")) ||
|
||||
(Token::Match(tok, "enum class| %name% {") ||
|
||||
Token::Match(tok, "enum class| %name% : %name% {"))))
|
||||
|
|
|
@ -353,6 +353,7 @@ private:
|
|||
TEST_CASE(symboldatabase94); // structured bindings
|
||||
TEST_CASE(symboldatabase95); // #10295
|
||||
TEST_CASE(symboldatabase96); // #10126
|
||||
TEST_CASE(symboldatabase97); // #10598 - final class
|
||||
|
||||
TEST_CASE(createSymbolDatabaseFindAllScopes1);
|
||||
TEST_CASE(createSymbolDatabaseFindAllScopes2);
|
||||
|
@ -4817,6 +4818,19 @@ private:
|
|||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void symboldatabase97() { // #10598 - final class
|
||||
GET_SYMBOL_DB("template<> struct A<void> final {\n"
|
||||
" A() {}\n"
|
||||
"};\n");
|
||||
ASSERT(db);
|
||||
ASSERT_EQUALS(3, db->scopeList.size());
|
||||
|
||||
const Token *functok = Token::findmatch(tokenizer.tokens(), "%name% (");
|
||||
ASSERT(functok);
|
||||
ASSERT(functok->function());
|
||||
ASSERT_EQUALS(functok->function()->type, Function::Type::eConstructor);
|
||||
}
|
||||
|
||||
void createSymbolDatabaseFindAllScopes1() {
|
||||
GET_SYMBOL_DB("void f() { union {int x; char *p;} a={0}; }");
|
||||
ASSERT(db->scopeList.size() == 3);
|
||||
|
|
Loading…
Reference in New Issue