Commit 70290937 authored by Roberto Raggi's avatar Roberto Raggi
Browse files

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.
parent 2e9f94c4
......@@ -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)
{
......
......@@ -87,9 +87,6 @@ public:
/// Destroy this Symbol.
virtual ~Symbol();
/// Returns this Symbol's Control object.
Control *control() const;
/// Returns this Symbol's source location.
unsigned sourceLocation() const;
......@@ -323,10 +320,14 @@ public:
protected:
virtual void visitSymbol0(SymbolVisitor *visitor) = 0;
/// Returns this Symbol's Control object.
Control *control() const;
/// Returns this Symbol's TranslationUnit.
TranslationUnit *translationUnit() const;
private:
TranslationUnit *_translationUnit;
Control *_control;
unsigned _sourceLocation;
unsigned _sourceOffset;
unsigned _startOffset;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment