CppEditor: Consider non-canonical path to clang includes

The include directory is under lib64/ on some systems.

Fixes: QTCREATORBUG-27623
Change-Id: Iba16e8ea451b444ab213fffd16f49dae865cd60e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Thiago Macieira
2022-06-01 14:52:16 -07:00
committed by Christian Kandeler
parent 32216652a8
commit 0978d16093

View File

@@ -303,10 +303,15 @@ FilePath ClangdSettings::clangdIncludePath() const
QTC_ASSERT(!clangdPath.isEmpty() && clangdPath.exists(), return {});
const QVersionNumber version = clangdVersion();
QTC_ASSERT(!version.isNull(), return {});
const FilePath includePath = clangdPath.absolutePath().parentDir().pathAppended("lib/clang")
.pathAppended(version.toString()).pathAppended("include");
QTC_ASSERT(includePath.exists(), return {});
static const QStringList libDirs{"lib", "lib64"};
for (const QString &libDir : libDirs) {
const FilePath includePath = clangdPath.absolutePath().parentDir().pathAppended(libDir)
.pathAppended("clang").pathAppended(version.toString()).pathAppended("include");
if (includePath.exists())
return includePath;
}
QTC_CHECK(false);
return {};
}
FilePath ClangdSettings::clangdUserConfigFilePath()