forked from qt-creator/qt-creator
Ignore the symbol's column for generated symbols (at least for now).
This commit is contained in:
@@ -137,7 +137,7 @@ protected:
|
|||||||
|
|
||||||
} // end of anonymous namespace
|
} // end of anonymous namespace
|
||||||
|
|
||||||
QualifiedNameId *qualifiedNameIdForSymbol(Symbol *s, const LookupContext &context)
|
static QualifiedNameId *qualifiedNameIdForSymbol(Symbol *s, const LookupContext &context)
|
||||||
{
|
{
|
||||||
Name *symbolName = s->name();
|
Name *symbolName = s->name();
|
||||||
if (! symbolName)
|
if (! symbolName)
|
||||||
@@ -433,12 +433,18 @@ void CPPEditor::updateMethodBoxIndex()
|
|||||||
if (file()->fileName() != symbol->fileName())
|
if (file()->fileName() != symbol->fileName())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
else if (symbol->isGenerated())
|
||||||
|
continue;
|
||||||
|
|
||||||
if (symbol) {
|
if (symbol) {
|
||||||
int column = symbol->column();
|
int column = symbol->column();
|
||||||
|
|
||||||
if (column != 0)
|
if (column != 0)
|
||||||
--column;
|
--column;
|
||||||
|
|
||||||
|
if (symbol->isGenerated())
|
||||||
|
column = 0;
|
||||||
|
|
||||||
QTextCursor c(document()->findBlockByNumber(symbol->line() - 1));
|
QTextCursor c(document()->findBlockByNumber(symbol->line() - 1));
|
||||||
c.setPosition(c.position() + column);
|
c.setPosition(c.position() + column);
|
||||||
|
|
||||||
@@ -969,6 +975,7 @@ bool CPPEditor::openEditorAt(Symbol *s)
|
|||||||
if (column)
|
if (column)
|
||||||
--column;
|
--column;
|
||||||
#else
|
#else
|
||||||
|
if (s->isGenerated())
|
||||||
unsigned column = 0;
|
unsigned column = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -164,7 +164,8 @@ Symbol::Symbol(TranslationUnit *translationUnit, unsigned sourceLocation, Name *
|
|||||||
_visibility(Symbol::Public),
|
_visibility(Symbol::Public),
|
||||||
_scope(0),
|
_scope(0),
|
||||||
_index(0),
|
_index(0),
|
||||||
_next(0)
|
_next(0),
|
||||||
|
_isGenerated(false)
|
||||||
{
|
{
|
||||||
setSourceLocation(sourceLocation);
|
setSourceLocation(sourceLocation);
|
||||||
setName(name);
|
setName(name);
|
||||||
@@ -200,14 +201,24 @@ unsigned Symbol::sourceLocation() const
|
|||||||
unsigned Symbol::sourceOffset() const
|
unsigned Symbol::sourceOffset() const
|
||||||
{ return _sourceOffset; }
|
{ return _sourceOffset; }
|
||||||
|
|
||||||
|
bool Symbol::isGenerated() const
|
||||||
|
{ return _isGenerated; }
|
||||||
|
|
||||||
void Symbol::setSourceLocation(unsigned sourceLocation)
|
void Symbol::setSourceLocation(unsigned sourceLocation)
|
||||||
{
|
{
|
||||||
_sourceLocation = sourceLocation;
|
_sourceLocation = sourceLocation;
|
||||||
|
|
||||||
if (_sourceLocation)
|
if (! _sourceLocation) {
|
||||||
_sourceOffset = translationUnit()->tokenAt(sourceLocation).offset;
|
_isGenerated = false;
|
||||||
else
|
|
||||||
_sourceOffset = 0;
|
_sourceOffset = 0;
|
||||||
|
} else {
|
||||||
|
TranslationUnit *unit = translationUnit();
|
||||||
|
|
||||||
|
const Token &tk = unit->tokenAt(sourceLocation);
|
||||||
|
|
||||||
|
_isGenerated = tk.generated;
|
||||||
|
_sourceOffset = tk.offset;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned Symbol::line() const
|
unsigned Symbol::line() const
|
||||||
|
|||||||
@@ -233,6 +233,8 @@ public:
|
|||||||
|
|
||||||
Name *identity() const;
|
Name *identity() const;
|
||||||
|
|
||||||
|
bool isGenerated() const;
|
||||||
|
|
||||||
void setScope(Scope *scope); // ### make me private
|
void setScope(Scope *scope); // ### make me private
|
||||||
void setSourceLocation(unsigned sourceLocation); // ### make me private
|
void setSourceLocation(unsigned sourceLocation); // ### make me private
|
||||||
|
|
||||||
@@ -256,6 +258,8 @@ private:
|
|||||||
unsigned _index;
|
unsigned _index;
|
||||||
Symbol *_next;
|
Symbol *_next;
|
||||||
|
|
||||||
|
bool _isGenerated: 1;
|
||||||
|
|
||||||
class IdentityForName;
|
class IdentityForName;
|
||||||
class HashCode;
|
class HashCode;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user