Skip to content
Snippets Groups Projects
Commit c2f23175 authored by Roberto Raggi's avatar Roberto Raggi
Browse files

Check for valid translation units.

parent 9190fce7
No related branches found
No related tags found
No related merge requests found
......@@ -209,18 +209,17 @@ void Symbol::setDeprecated(bool isDeprecated)
void Symbol::setSourceLocation(unsigned sourceLocation, TranslationUnit *translationUnit)
{
_sourceLocation = sourceLocation;
unsigned offset = 0;
if (! _sourceLocation) {
_isGenerated = false;
} else {
if (translationUnit) {
const Token &tk = translationUnit->tokenAt(sourceLocation);
_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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment