add virtual base class support to symbol database

This commit is contained in:
Robert Reif 2011-03-21 20:03:41 -04:00
parent 3c5134bb21
commit 15fc071514
2 changed files with 15 additions and 0 deletions

View File

@ -1052,12 +1052,20 @@ const Token *SymbolDatabase::initBaseInfo(Scope *scope, const Token *tok)
{ {
Scope::BaseInfo base; Scope::BaseInfo base;
base.isVirtual = false;
tok2 = tok2->next(); tok2 = tok2->next();
// check for invalid code // check for invalid code
if (!tok2 || !tok2->next()) if (!tok2 || !tok2->next())
return NULL; return NULL;
if (tok2->str() == "virtual")
{
base.isVirtual = true;
tok2 = tok2->next();
}
if (tok2->str() == "public") if (tok2->str() == "public")
{ {
base.access = Public; base.access = Public;
@ -1081,6 +1089,12 @@ const Token *SymbolDatabase::initBaseInfo(Scope *scope, const Token *tok)
base.access = Public; base.access = Public;
} }
if (tok2->str() == "virtual")
{
base.isVirtual = true;
tok2 = tok2->next();
}
// handle derived base classes // handle derived base classes
while (Token::Match(tok2, "%var% ::")) while (Token::Match(tok2, "%var% ::"))
{ {

View File

@ -369,6 +369,7 @@ public:
struct BaseInfo struct BaseInfo
{ {
AccessControl access; // public/protected/private AccessControl access; // public/protected/private
bool isVirtual;
std::string name; std::string name;
Scope *scope; Scope *scope;
}; };