Commit 0c107b33 authored by Nikolai Kosjar's avatar Nikolai Kosjar

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's avatarOrgad Shaneh <orgads@gmail.com>
Reviewed-by: default avatarFawzi Mohamed <fawzi.mohamed@digia.com>
parent 756fba0d
......@@ -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<QString> &result) const
{
if (Document::Ptr doc = document(fileName)) {
......
......@@ -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<QString> &result) const;
......
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment