summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNikolai Kosjar <nikolai.kosjar@qt.io>2016-11-22 16:41:01 +0100
committerNikolai Kosjar <nikolai.kosjar@qt.io>2016-11-23 11:50:44 +0000
commitc4d9f6ac3f23041be594c2693baa17281e77fb87 (patch)
tree71b43e289ecd2e27038c00710c0b75dae87ff3ca /src
parent6cf1f7968f8dac84825f96515ea3adbeeb6b2734 (diff)
downloadqt-creator-c4d9f6ac3f23041be594c2693baa17281e77fb87.tar.gz
Clang: Fix updating dependencies
...if the registered document comes with unsaved content. This can easily happen if the document is opened and modified by a refactoring action. Task-number: QTCREATORBUG-17295 Change-Id: I3a95fb495b6122248ceaa80985e838851ba2c0e5 Reviewed-by: David Schulz <david.schulz@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/tools/clangbackend/ipcsource/clangdocument.cpp5
-rw-r--r--src/tools/clangbackend/ipcsource/clangdocument.h1
-rw-r--r--src/tools/clangbackend/ipcsource/clangdocuments.cpp6
3 files changed, 11 insertions, 1 deletions
diff --git a/src/tools/clangbackend/ipcsource/clangdocument.cpp b/src/tools/clangbackend/ipcsource/clangdocument.cpp
index 49c1a3cef0..344787bbac 100644
--- a/src/tools/clangbackend/ipcsource/clangdocument.cpp
+++ b/src/tools/clangbackend/ipcsource/clangdocument.cpp
@@ -364,6 +364,11 @@ const QSet<Utf8String> Document::dependedFilePaths() const
return d->dependedFilePaths;
}
+void Document::setDependedFilePaths(const QSet<Utf8String> &filePaths)
+{
+ d->dependedFilePaths = filePaths;
+}
+
void Document::setDirty()
{
d->needsToBeReparsedChangeTimePoint = Clock::now();
diff --git a/src/tools/clangbackend/ipcsource/clangdocument.h b/src/tools/clangbackend/ipcsource/clangdocument.h
index 91112e9cdd..ab6322eff1 100644
--- a/src/tools/clangbackend/ipcsource/clangdocument.h
+++ b/src/tools/clangbackend/ipcsource/clangdocument.h
@@ -111,6 +111,7 @@ public: // for tests
void parse() const;
void reparse() const;
const QSet<Utf8String> dependedFilePaths() const;
+ void setDependedFilePaths(const QSet<Utf8String> &filePaths);
TranslationUnitUpdater createUpdater() const;
void setHasParseOrReparseFailed(bool hasFailed);
TimePoint isNeededReparseChangeTimePoint() const;
diff --git a/src/tools/clangbackend/ipcsource/clangdocuments.cpp b/src/tools/clangbackend/ipcsource/clangdocuments.cpp
index 3c77089447..6888597a82 100644
--- a/src/tools/clangbackend/ipcsource/clangdocuments.cpp
+++ b/src/tools/clangbackend/ipcsource/clangdocuments.cpp
@@ -64,8 +64,12 @@ std::vector<Document> Documents::create(const QVector<FileContainer> &fileContai
std::vector<Document> createdDocuments;
- for (const FileContainer &fileContainer : fileContainers)
+ for (const FileContainer &fileContainer : fileContainers) {
+ if (fileContainer.hasUnsavedFileContent())
+ updateDocumentsWithChangedDependency(fileContainer.filePath());
+
createdDocuments.push_back(createDocument(fileContainer));
+ }
return createdDocuments;
}