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

Check for valid translation units.

parent 9190fce7
...@@ -209,18 +209,17 @@ void Symbol::setDeprecated(bool isDeprecated) ...@@ -209,18 +209,17 @@ void Symbol::setDeprecated(bool isDeprecated)
void Symbol::setSourceLocation(unsigned sourceLocation, TranslationUnit *translationUnit) void Symbol::setSourceLocation(unsigned sourceLocation, TranslationUnit *translationUnit)
{ {
_sourceLocation = sourceLocation; _sourceLocation = sourceLocation;
unsigned offset = 0;
if (! _sourceLocation) { if (translationUnit) {
_isGenerated = false;
} else {
const Token &tk = translationUnit->tokenAt(sourceLocation); const Token &tk = translationUnit->tokenAt(sourceLocation);
_isGenerated = tk.f.generated; _isGenerated = tk.f.generated;
offset = tk.offset; translationUnit->getPosition(tk.offset, &_line, &_column, &_fileId);
} else {
_isGenerated = false;
_line = 0;
_column = 0;
_fileId = 0;
} }
translationUnit->getPosition(offset, &_line, &_column, &_fileId);
} }
unsigned Symbol::line() const unsigned Symbol::line() const
......
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