Fixed #8798 (SymbolDatabase: Inner unnamed union)
This commit is contained in:
parent
e2ea8bc2b0
commit
d265a0d6ab
|
@ -345,7 +345,7 @@ void SymbolDatabase::createSymbolDatabaseFindAllScopes()
|
|||
|
||||
// unnamed struct and union
|
||||
else if (Token::Match(tok, "struct|union {") &&
|
||||
Token::Match(tok->next()->link(), "} *|&| %name% ;|[")) {
|
||||
Token::Match(tok->next()->link(), "} *|&| %name% ;|[|=")) {
|
||||
scopeList.emplace_back(this, tok, scope);
|
||||
|
||||
Scope *new_scope = &scopeList.back();
|
||||
|
|
|
@ -295,6 +295,8 @@ private:
|
|||
TEST_CASE(symboldatabase72); // #8600
|
||||
TEST_CASE(symboldatabase73); // #8603
|
||||
|
||||
TEST_CASE(createSymbolDatabaseFindAllScopes1);
|
||||
|
||||
TEST_CASE(enum1);
|
||||
TEST_CASE(enum2);
|
||||
TEST_CASE(enum3);
|
||||
|
@ -4045,6 +4047,12 @@ private:
|
|||
ASSERT_EQUALS(3, f2->function->token->linenr());
|
||||
}
|
||||
|
||||
void createSymbolDatabaseFindAllScopes1() {
|
||||
GET_SYMBOL_DB("void f() { union {int x; char *p;} a={0}; }");
|
||||
ASSERT(db->scopeList.size() == 3);
|
||||
ASSERT_EQUALS(Scope::eUnion, db->scopeList.back().type);
|
||||
}
|
||||
|
||||
void enum1() {
|
||||
GET_SYMBOL_DB("enum BOOL { FALSE, TRUE }; enum BOOL b;");
|
||||
|
||||
|
|
Loading…
Reference in New Issue