add support for array of unnamed struct and union to symbol database

This commit is contained in:
Robert Reif 2011-03-29 19:48:12 -04:00
parent 38f5267ba8
commit 9612573d8e
1 changed files with 6 additions and 6 deletions

View File

@ -110,15 +110,15 @@ SymbolDatabase::SymbolDatabase(const Tokenizer *tokenizer, const Settings *setti
tok = tok->tokAt(3);
}
// anonymous struct and union
// unnamed struct and union
else if (Token::Match(tok, "struct|union {") &&
Token::Match(tok->next()->link(), "} %var% ;"))
Token::Match(tok->next()->link(), "} %var% ;|["))
{
scopeList.push_back(Scope(this, tok, scope));
Scope *new_scope = &scopeList.back();
scope->addVariable(tok->next()->link()->next(), tok, tok, scope->access, false, false, false, true, new_scope, scope, false);
scope->addVariable(tok->next()->link()->next(), tok, tok, scope->access, false, false, false, true, new_scope, scope, tok->next()->link()->strAt(2) == "[");
const Token *tok2 = tok->next();
@ -1338,7 +1338,7 @@ Scope::Scope(SymbolDatabase *check_, const Token *classDef_, Scope *nestedIn_) :
else if (classDef->str() == "struct")
{
type = Scope::eStruct;
// anonymous structs don't have a name
// unnamed structs don't have a name
if (classDef->next()->str() != "{")
className = classDef->next()->str();
access = Public;
@ -1346,7 +1346,7 @@ Scope::Scope(SymbolDatabase *check_, const Token *classDef_, Scope *nestedIn_) :
else if (classDef->str() == "union")
{
type = Scope::eUnion;
// anonymous unions don't have a name
// unnamed unions don't have a name
if (classDef->next()->str() != "{")
className = classDef->next()->str();
access = Public;
@ -1449,7 +1449,7 @@ void Scope::getVariableList()
else
break;
}
else if (Token::Match(tok, "struct|union {") && Token::Match(tok->next()->link(), "} %var% ;"))
else if (Token::Match(tok, "struct|union {") && Token::Match(tok->next()->link(), "} %var% ;|["))
{
tok = tok->next()->link()->next()->next();
continue;