CppEditor: Adapt to new LLVM directory layout

Since https://reviews.llvm.org/D125860, the path contains only the major
version. We try both variants anyway, as we cannot be sure all Linux
distributions will adopt this scheme.

Change-Id: I0bc7b0cf38d7cb4af61342477a6a1f0679095d30
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Christian Kandeler
2023-02-28 14:04:54 +01:00
parent 1424111734
commit 628babb5cb

View File

@@ -363,12 +363,16 @@ static FilePath getClangHeadersPath(const FilePath &clangdFilePath)
const QVersionNumber version = Utils::clangdVersion(clangdFilePath);
QTC_ASSERT(!version.isNull(), return {});
static const QStringList libDirs{"lib", "lib64"};
const QStringList versionStrings{QString::number(version.majorVersion()), version.toString()};
for (const QString &libDir : libDirs) {
const FilePath includePath = clangdFilePath.absolutePath().parentDir().pathAppended(libDir)
.pathAppended("clang").pathAppended(version.toString()).pathAppended("include");
for (const QString &versionString : versionStrings) {
const FilePath includePath = clangdFilePath.absolutePath().parentDir()
.pathAppended(libDir).pathAppended("clang")
.pathAppended(versionString).pathAppended("include");
if (includePath.exists())
return includePath;
}
}
QTC_CHECK(false);
return {};
}