Fix DACA2 SymbolDatabase bailout; unhandled code for final class (#1253)

* Fix DACA2 SymbolDatabase bailout; unhandled code for final class

* Replace Match with simpleMatch
This commit is contained in:
IOBYTE 2018-05-21 15:23:21 -04:00 committed by Daniel Marjamäki
parent f78314b613
commit 5c15cd3981
2 changed files with 12 additions and 0 deletions

View File

@ -123,6 +123,10 @@ void SymbolDatabase::createSymbolDatabaseFindAllScopes()
tok2 = tok2->tokAt(2);
}
// skip over final
if (_tokenizer->isCPP() && Token::simpleMatch(tok2, "final"))
tok2 = tok2->next();
// make sure we have valid code
if (!Token::Match(tok2, "{|:")) {
// check for qualified variable

View File

@ -288,6 +288,7 @@ private:
TEST_CASE(symboldatabase68); // #8560
TEST_CASE(symboldatabase69);
TEST_CASE(symboldatabase70);
TEST_CASE(symboldatabase71);
TEST_CASE(enum1);
TEST_CASE(enum2);
@ -3917,6 +3918,13 @@ private:
}
}
void symboldatabase71() {
GET_SYMBOL_DB("class A { };\n"
"class B final : public A { };");
ASSERT(db && db->scopeList.size() == 3);
ASSERT(db && db->typeList.size() == 2);
}
void enum1() {
GET_SYMBOL_DB("enum BOOL { FALSE, TRUE }; enum BOOL b;");