forked from qt-creator/qt-creator
Clang: Check if the include search path has changed
If the include search paths and the compiler macros have not changed it is save to assume that we don't need to update the symbol database. This saves us from executing a very expensive task. Later we have to test the modification time of the files too. Change-Id: I6b958075024a811c2abd3d7918263fd74bba090b Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
@@ -52,7 +52,7 @@ void SymbolIndexer::updateProjectPart(V2::ProjectPartContainer &&projectPart,
|
||||
{
|
||||
m_symbolsCollector.clear();
|
||||
|
||||
if (compilerMacrosAreDifferent(projectPart)) {
|
||||
if (compilerMacrosOrIncludeSearchPathsAreDifferent(projectPart)) {
|
||||
m_symbolsCollector.addFiles(projectPart.sourcePathIds(), projectPart.arguments());
|
||||
|
||||
m_symbolsCollector.addUnsavedFiles(generatedFiles);
|
||||
@@ -66,7 +66,8 @@ void SymbolIndexer::updateProjectPart(V2::ProjectPartContainer &&projectPart,
|
||||
|
||||
m_symbolStorage.insertOrUpdateProjectPart(projectPart.projectPartId(),
|
||||
projectPart.arguments(),
|
||||
projectPart.compilerMacros());
|
||||
projectPart.compilerMacros(),
|
||||
projectPart.includeSearchPaths());
|
||||
m_symbolStorage.updateProjectPartSources(projectPart.projectPartId(),
|
||||
m_symbolsCollector.sourceFiles());
|
||||
|
||||
@@ -121,13 +122,16 @@ void SymbolIndexer::updateChangedPath(FilePathId filePathId)
|
||||
}
|
||||
}
|
||||
|
||||
bool SymbolIndexer::compilerMacrosAreDifferent(const V2::ProjectPartContainer &projectPart) const
|
||||
bool SymbolIndexer::compilerMacrosOrIncludeSearchPathsAreDifferent(const V2::ProjectPartContainer &projectPart) const
|
||||
{
|
||||
const Utils::optional<ProjectPartArtefact> optionalArtefact = m_symbolStorage.fetchProjectPartArtefact(
|
||||
projectPart.projectPartId());
|
||||
|
||||
if (optionalArtefact)
|
||||
return projectPart.compilerMacros() != optionalArtefact.value().compilerMacros;
|
||||
if (optionalArtefact) {
|
||||
const ProjectPartArtefact &artefact = optionalArtefact.value();
|
||||
return projectPart.compilerMacros() != artefact.compilerMacros
|
||||
|| projectPart.includeSearchPaths() != artefact.includeSearchPaths;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user