Clang: Reparse only if files are changed

Includes are now watched by a file watcher. Unsaved file changes are
watched too. If they are changed the translation units which depend on
them are set to a state which require a reparse. Later the diagnostics
of this units are collected and send back to creator.

Change-Id: I2fb5c7dd6644687f22399edd8d18edd6215c9505
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
This commit is contained in:
Marco Bubke
2015-08-31 12:40:14 +02:00
parent aa6aaee510
commit f2b7371af1
39 changed files with 800 additions and 242 deletions

View File

@@ -225,14 +225,20 @@ void ClangEditorDocumentProcessor::updateTranslationUnitForCompletion(CppTools::
if (m_projectPart) {
if (projectPart.id() != m_projectPart->id()) {
auto container1 = ClangBackEnd::FileContainer(filePath(), m_projectPart->id());
auto container1 = ClangBackEnd::FileContainer(filePath(),
m_projectPart->id(),
revision());
ipcCommunicator.unregisterFilesForCodeCompletion({container1});
auto container2 = ClangBackEnd::FileContainer(filePath(), projectPart.id());
auto container2 = ClangBackEnd::FileContainer(filePath(),
projectPart.id(),
revision());
ipcCommunicator.registerFilesForCodeCompletion({container2});
}
} else {
auto container = ClangBackEnd::FileContainer(filePath(), projectPart.id());
auto container = ClangBackEnd::FileContainer(filePath(),
projectPart.id(),
revision());
ipcCommunicator.registerFilesForCodeCompletion({container});
}
}
@@ -458,8 +464,11 @@ void ClangEditorDocumentProcessor::requestDiagnostics(CppTools::ProjectPart &pro
if (!m_projectPart || projectPart.id() != m_projectPart->id()) {
IpcCommunicator &ipcCommunicator = m_modelManagerSupport->ipcCommunicator();
ipcCommunicator.requestDiagnostics({filePath(), projectPart.id()},
revision());
ipcCommunicator.requestDiagnostics({filePath(),
projectPart.id(),
Utf8String(),
false,
revision()});
}
}
@@ -469,10 +478,10 @@ void ClangEditorDocumentProcessor::requestDiagnostics()
if (m_projectPart) {
auto &ipcCommunicator = m_modelManagerSupport->ipcCommunicator();
ipcCommunicator.requestDiagnostics({filePath(),
m_projectPart->id(),
baseTextDocument()->plainText(),
true},
revision());
m_projectPart->id(),
baseTextDocument()->plainText(),
true,
revision()});
}
}