Fix #8470 ((error) SymbolDatabase bailout; unhandled code) (#1155)

This commit is contained in:
IOBYTE 2018-04-07 10:41:39 -04:00 committed by Daniel Marjamäki
parent e240f8cee8
commit 20f0784c06
2 changed files with 17 additions and 1 deletions

View File

@ -84,7 +84,7 @@ void SymbolDatabase::createSymbolDatabaseFindAllScopes()
tok->progressValue());
// Locate next class
if ((_tokenizer->isCPP() && ((Token::Match(tok, "class|struct|union|namespace ::| %name% {|:|::|<") &&
!Token::Match(tok->previous(), "new|friend|)|(")) ||
!Token::Match(tok->previous(), "new|friend|const|)|(|<")) ||
(Token::Match(tok, "enum class| %name% {") ||
Token::Match(tok, "enum class| %name% : %name% {"))))
|| (_tokenizer->isC() && Token::Match(tok, "struct|union|enum %name% {"))) {

View File

@ -273,6 +273,7 @@ private:
TEST_CASE(symboldatabase59);
TEST_CASE(symboldatabase60);
TEST_CASE(symboldatabase61);
TEST_CASE(symboldatabase62);
TEST_CASE(enum1);
TEST_CASE(enum2);
@ -2912,6 +2913,21 @@ private:
ASSERT(db && db->scopeList.size() == 4);
}
void symboldatabase62() {
GET_SYMBOL_DB("struct A {\n"
"public:\n"
" struct X { int a; };\n"
" void Foo(const std::vector<struct X> &includes);\n"
"};\n"
"void A::Foo(const std::vector<struct A::X> &includes) {\n"
" for (std::vector<struct A::X>::const_iterator it = includes.begin(); it != includes.end(); ++it) {\n"
" const struct A::X currentIncList = *it;\n"
" }\n"
"}");
ASSERT(db != nullptr);
ASSERT(db && db->scopeList.size() == 5);
}
void enum1() {
GET_SYMBOL_DB("enum BOOL { FALSE, TRUE }; enum BOOL b;");