diff --git a/src/libs/cplusplus/CppDocument.cpp b/src/libs/cplusplus/CppDocument.cpp index 58301011b95..034e2f55854 100644 --- a/src/libs/cplusplus/CppDocument.cpp +++ b/src/libs/cplusplus/CppDocument.cpp @@ -825,6 +825,11 @@ void Snapshot::updateDependencyTable() const m_deps.build(*this); } +bool Snapshot::operator==(const Snapshot &other) const +{ + return _documents == other._documents; +} + void Snapshot::allIncludesForDocument_helper(const QString &fileName, QSet &result) const { if (Document::Ptr doc = document(fileName)) { diff --git a/src/libs/cplusplus/CppDocument.h b/src/libs/cplusplus/CppDocument.h index dba6291351e..f9d4dba3c4a 100644 --- a/src/libs/cplusplus/CppDocument.h +++ b/src/libs/cplusplus/CppDocument.h @@ -431,6 +431,8 @@ public: QStringList filesDependingOn(const QString &fileName) const; void updateDependencyTable() const; + bool operator==(const Snapshot &other) const; + private: void allIncludesForDocument_helper(const QString &fileName, QSet &result) const; diff --git a/src/plugins/cpptools/cppsemanticinfoupdater.cpp b/src/plugins/cpptools/cppsemanticinfoupdater.cpp index 6c1cda731ed..f05f0d5d828 100644 --- a/src/plugins/cpptools/cppsemanticinfoupdater.cpp +++ b/src/plugins/cpptools/cppsemanticinfoupdater.cpp @@ -148,7 +148,8 @@ bool SemanticInfoUpdaterPrivate::reuseCurrentSemanticInfo(const SemanticInfo::So && currentSemanticInfo.doc && currentSemanticInfo.doc->translationUnit()->ast() && currentSemanticInfo.doc->fileName() == source.fileName - && !currentSemanticInfo.snapshot.isEmpty()) { + && !currentSemanticInfo.snapshot.isEmpty() + && currentSemanticInfo.snapshot == source.snapshot) { SemanticInfo newSemanticInfo; newSemanticInfo.revision = source.revision; newSemanticInfo.snapshot = source.snapshot;