From 0978d16093ebd420c0bfee2160d8ec378ba296c8 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 1 Jun 2022 14:52:16 -0700 Subject: [PATCH] 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 Reviewed-by: Eike Ziller --- src/plugins/cppeditor/cppcodemodelsettings.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/plugins/cppeditor/cppcodemodelsettings.cpp b/src/plugins/cppeditor/cppcodemodelsettings.cpp index f33cc7bbd52..aacf8ff5625 100644 --- a/src/plugins/cppeditor/cppcodemodelsettings.cpp +++ b/src/plugins/cppeditor/cppcodemodelsettings.cpp @@ -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 {}); - return includePath; + 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()