summaryrefslogtreecommitdiff
path: root/src/shared/cplusplus
diff options
context:
space:
mode:
authorRoberto Raggi <roberto.raggi@nokia.com>2010-05-10 10:11:05 +0200
committerRoberto Raggi <roberto.raggi@nokia.com>2010-05-10 10:11:05 +0200
commit702909372d33ca269422d011e9156982d0e6f0e5 (patch)
treeba8dddd9cf8a8f26f6c10dacfa27a193845a532e /src/shared/cplusplus
parent2e9f94c4b98af75b27652c5c1b16cc49f2227681 (diff)
downloadqt-creator-702909372d33ca269422d011e9156982d0e6f0e5.tar.gz
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.
Diffstat (limited to 'src/shared/cplusplus')
-rw-r--r--src/shared/cplusplus/Symbol.cpp11
-rw-r--r--src/shared/cplusplus/Symbol.h9
2 files changed, 8 insertions, 12 deletions
diff --git a/src/shared/cplusplus/Symbol.cpp b/src/shared/cplusplus/Symbol.cpp
index 6c506c1700..93725ee224 100644
--- a/src/shared/cplusplus/Symbol.cpp
+++ b/src/shared/cplusplus/Symbol.cpp
@@ -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)
{
diff --git a/src/shared/cplusplus/Symbol.h b/src/shared/cplusplus/Symbol.h
index f45ce88c0c..628261b4b9 100644
--- a/src/shared/cplusplus/Symbol.h
+++ b/src/shared/cplusplus/Symbol.h
@@ -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;