diff options
Diffstat (limited to 'src/libs/cplusplus/CppDocument.cpp')
-rw-r--r-- | src/libs/cplusplus/CppDocument.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/libs/cplusplus/CppDocument.cpp b/src/libs/cplusplus/CppDocument.cpp index 389a030b55..a107749883 100644 --- a/src/libs/cplusplus/CppDocument.cpp +++ b/src/libs/cplusplus/CppDocument.cpp @@ -713,6 +713,7 @@ bool Document::DiagnosticMessage::operator!=(const Document::DiagnosticMessage & } Snapshot::Snapshot() + : m_deps(new DependencyTable) { } @@ -747,8 +748,10 @@ bool Snapshot::contains(const QString &fileName) const void Snapshot::insert(Document::Ptr doc) { - if (doc) + if (doc) { _documents.insert(doc->fileName(), doc); + m_deps->files.clear(); // Will trigger re-build when accessed. + } } Document::Ptr Snapshot::preprocessedDocument(const QByteArray &source, @@ -795,6 +798,18 @@ QSet<QString> Snapshot::allIncludesForDocument(const QString &fileName) const return result; } +QStringList Snapshot::filesDependingOn(const QString &fileName) const +{ + updateDependencyTable(); + return m_deps->filesDependingOn(fileName); +} + +void Snapshot::updateDependencyTable() const +{ + if (m_deps->files.isEmpty()) + m_deps->build(*this); +} + void Snapshot::allIncludesForDocument_helper(const QString &fileName, QSet<QString> &result) const { if (Document::Ptr doc = document(fileName)) { |