forked from qt-creator/qt-creator
CppTools: Do not re-use semantic document if dependencies changed
Changes from the current editor snapshot to the previous one represent dependency changes (include paths, defines, ...) for the document. Use this to stop the semantic info updater from re-using the previous document for highlighthing. Task-number: QTCREATORBUG-12267 Change-Id: I91308700122ded7c458c267b685c00b966874a64 Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com>
This commit is contained in:
@@ -825,6 +825,11 @@ void Snapshot::updateDependencyTable() const
|
|||||||
m_deps.build(*this);
|
m_deps.build(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Snapshot::operator==(const Snapshot &other) const
|
||||||
|
{
|
||||||
|
return _documents == other._documents;
|
||||||
|
}
|
||||||
|
|
||||||
void Snapshot::allIncludesForDocument_helper(const QString &fileName, QSet<QString> &result) const
|
void Snapshot::allIncludesForDocument_helper(const QString &fileName, QSet<QString> &result) const
|
||||||
{
|
{
|
||||||
if (Document::Ptr doc = document(fileName)) {
|
if (Document::Ptr doc = document(fileName)) {
|
||||||
|
|||||||
@@ -431,6 +431,8 @@ public:
|
|||||||
QStringList filesDependingOn(const QString &fileName) const;
|
QStringList filesDependingOn(const QString &fileName) const;
|
||||||
void updateDependencyTable() const;
|
void updateDependencyTable() const;
|
||||||
|
|
||||||
|
bool operator==(const Snapshot &other) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void allIncludesForDocument_helper(const QString &fileName, QSet<QString> &result) const;
|
void allIncludesForDocument_helper(const QString &fileName, QSet<QString> &result) const;
|
||||||
|
|
||||||
|
|||||||
@@ -148,7 +148,8 @@ bool SemanticInfoUpdaterPrivate::reuseCurrentSemanticInfo(const SemanticInfo::So
|
|||||||
&& currentSemanticInfo.doc
|
&& currentSemanticInfo.doc
|
||||||
&& currentSemanticInfo.doc->translationUnit()->ast()
|
&& currentSemanticInfo.doc->translationUnit()->ast()
|
||||||
&& currentSemanticInfo.doc->fileName() == source.fileName
|
&& currentSemanticInfo.doc->fileName() == source.fileName
|
||||||
&& !currentSemanticInfo.snapshot.isEmpty()) {
|
&& !currentSemanticInfo.snapshot.isEmpty()
|
||||||
|
&& currentSemanticInfo.snapshot == source.snapshot) {
|
||||||
SemanticInfo newSemanticInfo;
|
SemanticInfo newSemanticInfo;
|
||||||
newSemanticInfo.revision = source.revision;
|
newSemanticInfo.revision = source.revision;
|
||||||
newSemanticInfo.snapshot = source.snapshot;
|
newSemanticInfo.snapshot = source.snapshot;
|
||||||
|
|||||||
Reference in New Issue
Block a user