Store the Control.

It seems that storing the TranslationUnit together with the Symbol
was a bad idea. Unfortunately, we release TranslationUnit(s) as
soon as we can, but we keep the Control around. So using the Control
is definitely safer.
This commit is contained in:
Roberto Raggi
2010-05-10 10:11:05 +02:00
parent 2e9f94c4b9
commit 702909372d
2 changed files with 8 additions and 12 deletions

View File

@@ -161,7 +161,7 @@ private:
};
Symbol::Symbol(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name)
: _translationUnit(translationUnit),
: _control(translationUnit->control()),
_sourceLocation(sourceLocation),
_sourceOffset(0),
_startOffset(0),
@@ -183,15 +183,10 @@ Symbol::~Symbol()
{ }
Control *Symbol::control() const
{
if (_translationUnit)
return _translationUnit->control();
return 0;
}
{ return _control; }
TranslationUnit *Symbol::translationUnit() const
{ return _translationUnit; }
{ return _control->translationUnit(); }
void Symbol::visitSymbol(SymbolVisitor *visitor)
{