ClangCodeModel: Use clangd's include path

... rather than the one from the LLVM that Qt Creator was compiled
against.

Task-number: QTCREATORBUG-27120
Change-Id: I4f211345ed547cd13f0b0774b99bc0f199a9cd44
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Kandeler
2022-05-09 16:16:51 +02:00
parent 56576ad319
commit b5b9b7e32c
5 changed files with 23 additions and 14 deletions

View File

@@ -310,7 +310,8 @@ void ClangModelManagerSupport::connectToWidgetsMarkContextMenuRequested(QWidget
void ClangModelManagerSupport::updateLanguageClient(
ProjectExplorer::Project *project, const CppEditor::ProjectInfo::ConstPtr &projectInfo)
{
if (!CppEditor::ClangdProjectSettings(project).settings().useClangd)
const ClangdSettings::Data clangdSettingsData = ClangdProjectSettings(project).settings();
if (!clangdSettingsData.useClangd)
return;
const auto getJsonDbDir = [project] {
if (const ProjectExplorer::Target * const target = project->activeTarget()) {
@@ -419,10 +420,12 @@ void ClangModelManagerSupport::updateLanguageClient(
});
});
const Utils::FilePath includeDir = ClangdSettings(clangdSettingsData).clangdIncludePath();
const ClangDiagnosticConfig warningsConfig = warningsConfigForProject(project);
auto future = Utils::runAsync(&Internal::generateCompilationDB, projectInfo, jsonDbDir,
CompilationDbPurpose::CodeModel,
warningsConfig, optionsForProject(project, warningsConfig));
warningsConfig, optionsForProject(project, warningsConfig),
includeDir);
generatorWatcher->setFuture(future);
m_generatorSynchronizer.addFuture(future);
}