diff options
author | Roberto Raggi <roberto.raggi@nokia.com> | 2010-08-10 14:40:27 +0200 |
---|---|---|
committer | Roberto Raggi <roberto.raggi@nokia.com> | 2010-08-10 15:19:32 +0200 |
commit | 0f301f8679f0e76a4c2b5fb8935abf0c9a9e287c (patch) | |
tree | 75fc4bbd67102b9e5c98881f65c2c20b56ab9298 /src/plugins/cpptools/cppfindreferences.cpp | |
parent | f72a080da44a6ef142c82c9e14b4012876d82312 (diff) | |
download | qt-creator-0f301f8679f0e76a4c2b5fb8935abf0c9a9e287c.tar.gz |
New implementation of CPlusPlus::FindUsages
Diffstat (limited to 'src/plugins/cpptools/cppfindreferences.cpp')
-rw-r--r-- | src/plugins/cpptools/cppfindreferences.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/plugins/cpptools/cppfindreferences.cpp b/src/plugins/cpptools/cppfindreferences.cpp index aabe12ca5e..87254f0304 100644 --- a/src/plugins/cpptools/cppfindreferences.cpp +++ b/src/plugins/cpptools/cppfindreferences.cpp @@ -52,6 +52,7 @@ #include <cplusplus/CppDocument.h> #include <cplusplus/Overview.h> +#include <cplusplus/FindUsages.h> #include <QtCore/QTime> #include <QtCore/QTimer> @@ -108,18 +109,25 @@ public: return usages; // skip this document, it's not using symbolId. } - QByteArray source = snapshot.preprocessedCode( - getSource(fileName, workingCopy), fileName); + Document::Ptr doc; + QByteArray source; - Document::Ptr doc = snapshot.documentFromSource(source, fileName); - doc->tokenize(); + if (symbolDocument && fileName == symbolDocument->fileName()) + doc = symbolDocument; + else { + source = snapshot.preprocessedCode(getSource(fileName, workingCopy), fileName); + doc = snapshot.documentFromSource(source, fileName); + doc->tokenize(); + } Control *control = doc->control(); if (control->findIdentifier(symbolId->chars(), symbolId->size()) != 0) { - doc->check(); + if (doc != symbolDocument) + doc->check(); FindUsages process(doc, snapshot); process(symbol); + usages = process.usages(); } |