diff options
author | Roberto Raggi <[email protected]> | 2009-03-04 15:45:38 +0100 |
---|---|---|
committer | Roberto Raggi <[email protected]> | 2009-03-04 15:45:38 +0100 |
commit | 942f5a708adae178d445c68cf63956ef12f3df56 (patch) | |
tree | d6286edab2120b18189e25af1f77fc1efa352143 /src/shared | |
parent | 4613da1c8bb58fe7aea71590b2e1ddb88fdb6f2b (diff) |
Ignore the symbol's column for generated symbols (at least for now).
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/cplusplus/Symbol.cpp | 19 | ||||
-rw-r--r-- | src/shared/cplusplus/Symbol.h | 4 |
2 files changed, 19 insertions, 4 deletions
diff --git a/src/shared/cplusplus/Symbol.cpp b/src/shared/cplusplus/Symbol.cpp index da677aa3b21..8f5dc3b4921 100644 --- a/src/shared/cplusplus/Symbol.cpp +++ b/src/shared/cplusplus/Symbol.cpp @@ -164,7 +164,8 @@ Symbol::Symbol(TranslationUnit *translationUnit, unsigned sourceLocation, Name * _visibility(Symbol::Public), _scope(0), _index(0), - _next(0) + _next(0), + _isGenerated(false) { setSourceLocation(sourceLocation); setName(name); @@ -200,14 +201,24 @@ unsigned Symbol::sourceLocation() const unsigned Symbol::sourceOffset() const { return _sourceOffset; } +bool Symbol::isGenerated() const +{ return _isGenerated; } + void Symbol::setSourceLocation(unsigned sourceLocation) { _sourceLocation = sourceLocation; - if (_sourceLocation) - _sourceOffset = translationUnit()->tokenAt(sourceLocation).offset; - else + if (! _sourceLocation) { + _isGenerated = false; _sourceOffset = 0; + } else { + TranslationUnit *unit = translationUnit(); + + const Token &tk = unit->tokenAt(sourceLocation); + + _isGenerated = tk.generated; + _sourceOffset = tk.offset; + } } unsigned Symbol::line() const diff --git a/src/shared/cplusplus/Symbol.h b/src/shared/cplusplus/Symbol.h index ea49529e74d..d7c70c38ae7 100644 --- a/src/shared/cplusplus/Symbol.h +++ b/src/shared/cplusplus/Symbol.h @@ -233,6 +233,8 @@ public: Name *identity() const; + bool isGenerated() const; + void setScope(Scope *scope); // ### make me private void setSourceLocation(unsigned sourceLocation); // ### make me private @@ -256,6 +258,8 @@ private: unsigned _index; Symbol *_next; + bool _isGenerated: 1; + class IdentityForName; class HashCode; |