Fixed the line retreival for find-usages.

Instead of using the pre-processed source, the original one is used.
This makes a difference when a macro is used in the line, where the pre-
processed source would have a "#gen true" token.

Task-number: QTCREATORBUG-3345
This commit is contained in:
Erik Verbruggen
2011-01-17 14:41:19 +01:00
parent 673f9871ba
commit dea74862d3
3 changed files with 9 additions and 29 deletions

View File

@@ -62,7 +62,7 @@ public:
class CPLUSPLUS_EXPORT FindUsages: protected ASTVisitor
{
public:
FindUsages(Document::Ptr doc, const Snapshot &snapshot);
FindUsages(const QByteArray &originalSource, Document::Ptr doc, const Snapshot &snapshot);
FindUsages(const LookupContext &context);
void operator()(Symbol *symbol);
@@ -75,8 +75,6 @@ protected:
Scope *switchScope(Scope *scope);
QString matchingLine(const Token &tk) const;
void reportResult(unsigned tokenIndex, const Name *name, Scope *scope = 0);
void reportResult(unsigned tokenIndex, const Identifier *id, Scope *scope = 0);
void reportResult(unsigned tokenIndex, const QList<LookupItem> &candidates);
@@ -295,6 +293,7 @@ private:
Document::Ptr _doc;
Snapshot _snapshot;
LookupContext _context;
QByteArray _originalSource;
QByteArray _source;
QList<int> _references;
QList<Usage> _usages;