save pointer to Function info in function scope in symboldatabase

This commit is contained in:
Robert Reif 2011-03-13 21:18:49 -04:00
parent 836fadcb6a
commit 47a90851f1
2 changed files with 10 additions and 2 deletions

View File

@ -284,7 +284,10 @@ SymbolDatabase::SymbolDatabase(const Tokenizer *tokenizer, const Settings *setti
addNewFunction(&scope, &tok2); addNewFunction(&scope, &tok2);
if (scope) if (scope)
{
scope->functionOf = functionOf; scope->functionOf = functionOf;
scope->function = &functionOf->functionList.back();
}
tok = tok2; tok = tok2;
} }
@ -968,6 +971,8 @@ void SymbolDatabase::addFunction(Scope **scope, const Token **tok, const Token *
if (*scope) if (*scope)
{ {
(*scope)->functionOf = scope1; (*scope)->functionOf = scope1;
(*scope)->function = &scope1->functionList.back();
added = true; added = true;
} }
break; break;
@ -1247,7 +1252,8 @@ Scope::Scope(SymbolDatabase *check_, const Token *classDef_, Scope *nestedIn_, S
access(Public), access(Public),
numConstructors(0), numConstructors(0),
needInitialization(Scope::Unknown), needInitialization(Scope::Unknown),
functionOf(NULL) functionOf(NULL),
function(NULL)
{ {
} }
@ -1259,7 +1265,8 @@ Scope::Scope(SymbolDatabase *check_, const Token *classDef_, Scope *nestedIn_) :
nestedIn(nestedIn_), nestedIn(nestedIn_),
numConstructors(0), numConstructors(0),
needInitialization(Scope::Unknown), needInitialization(Scope::Unknown),
functionOf(NULL) functionOf(NULL),
function(NULL)
{ {
if (!classDef) if (!classDef)
{ {

View File

@ -404,6 +404,7 @@ public:
// function specific fields // function specific fields
Scope *functionOf; // scope this function belongs to Scope *functionOf; // scope this function belongs to
Function *function; // function info for this function
bool isClassOrStruct() const bool isClassOrStruct() const
{ {