Clang: Fix delayed reparse of dirty and visible but not current documents

1. Open document foo.h
2. Create a split and open foo.cpp (#including "foo.h")
3. Edit foo.h (e.g. by introducing a syntax error, so that foo.cpp will
   indicate header errors in the toolbar or as info bar)
=> Actual: foo.cpp will be reparsed immediately.
 Expected: foo.cpp should be reparsed after a delay.

This saves resources (cpu time) and minimizes poping up of the header
info bar while editing header files in splits.

Regression introduced by

    commit 380d756a03
    Clang: Hook up supportive translation unit on first edit

Change-Id: Ib5fd90e49415dfc3aefacab7cd627b0e1937f5fc
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Nikolai Kosjar
2016-10-14 13:05:44 +02:00
parent d29781fcd8
commit 4fbdbdb1ee
6 changed files with 121 additions and 15 deletions

View File

@@ -32,6 +32,7 @@
#include <QVector>
#include <functional>
#include <vector>
namespace ClangBackEnd {
@@ -57,6 +58,9 @@ public:
bool hasDocumentWithFilePath(const Utf8String &filePath) const;
const std::vector<Document> &documents() const;
using IsMatchingDocument = std::function<bool(const Document &document)>;
const std::vector<Document> filtered(const IsMatchingDocument &isMatchingDocument) const;
std::vector<Document> dirtyAndVisibleButNotCurrentDocuments() const;
UnsavedFiles unsavedFiles() const;