diff options
author | Nikolai Kosjar <nikolai.kosjar@theqtcompany.com> | 2015-01-19 13:14:45 +0100 |
---|---|---|
committer | Nikolai Kosjar <nikolai.kosjar@theqtcompany.com> | 2015-04-24 08:35:13 +0000 |
commit | d4bb5033b251e8afb612158011ebd89082664345 (patch) | |
tree | 0a160dfaab09fa13bea98e84e021747f96c3ec1f /src/plugins/cpptools/builtinindexingsupport.cpp | |
parent | f878da0ea8be0563abb49af9cd7ea58c0063d830 (diff) | |
download | qt-creator-d4bb5033b251e8afb612158011ebd89082664345.tar.gz |
CppTools: Remove separate indexing revision
For indexing we used a custom revision that was updated on each
modelManager BuiltinIndexingSupport::refreshSourceFiles() call. This
could lead to rejection of updated documents triggered by refactoring
actions, like for the following case:
1. Open a project containing a.h and a.cpp
2. Open a.cpp, insert some new lines, save and close the document
3. Open a.h and rename a function that is defined in a.cpp
--> The refactoring action modifies a.h and a.cpp, so re-indexing
of those is triggered. Since a.cpp has already a higher revision
(step 2) than the updated document, the updated document is
discarded. As a consequence find usages and follow symbol fails
for the renamed function.
Now the document call back provided to CppSourceProcessor is responsible
for updating the document revision based on the latest revision in the
global snapshot.
Change-Id: I4dfa0a4d34991655acfa749109f00c47b0fbfdbe
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
Diffstat (limited to 'src/plugins/cpptools/builtinindexingsupport.cpp')
-rw-r--r-- | src/plugins/cpptools/builtinindexingsupport.cpp | 6 |
1 files changed, 0 insertions, 6 deletions
diff --git a/src/plugins/cpptools/builtinindexingsupport.cpp b/src/plugins/cpptools/builtinindexingsupport.cpp index b9cc315b16..fc06b95024 100644 --- a/src/plugins/cpptools/builtinindexingsupport.cpp +++ b/src/plugins/cpptools/builtinindexingsupport.cpp @@ -61,9 +61,6 @@ namespace { class ParseParams { public: - ParseParams() : revision(0) {} - - int revision; ProjectPart::HeaderPaths headerPaths; WorkingCopy workingCopy; QSet<QString> sourceFiles; @@ -189,7 +186,6 @@ void indexFindErrors(QFutureInterface<void> &future, const ParseParams params) void index(QFutureInterface<void> &future, const ParseParams params) { QScopedPointer<CppSourceProcessor> sourceProcessor(CppModelManager::createSourceProcessor()); - sourceProcessor->setRevision(params.revision); sourceProcessor->setHeaderPaths(params.headerPaths); sourceProcessor->setWorkingCopy(params.workingCopy); @@ -347,7 +343,6 @@ private: } // anonymous namespace BuiltinIndexingSupport::BuiltinIndexingSupport() - : m_revision(0) { m_synchronizer.setCancelOnWait(true); } @@ -361,7 +356,6 @@ QFuture<void> BuiltinIndexingSupport::refreshSourceFiles(const QSet<QString> &so CppModelManager *mgr = CppModelManager::instance(); ParseParams params; - params.revision = ++m_revision; params.headerPaths = mgr->headerPaths(); params.workingCopy = mgr->workingCopy(); params.sourceFiles = sourceFiles; |