forked from qt-creator/qt-creator
CppEditor: Allow to retrieve clangd's internal include path
The code model will need to use this one instead of the one hardcoded at build time. Change-Id: Ibd89d32f99b9250c909473f9a4a66f9a8a5f4f07 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -405,6 +405,19 @@ QVersionNumber ClangdSettings::clangdVersion(const FilePath &clangdFilePath)
|
||||
return it->second;
|
||||
}
|
||||
|
||||
FilePath ClangdSettings::clangdIncludePath() const
|
||||
{
|
||||
QTC_ASSERT(useClangd(), return {});
|
||||
FilePath clangdPath = clangdFilePath();
|
||||
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;
|
||||
}
|
||||
|
||||
void ClangdSettings::loadSettings()
|
||||
{
|
||||
Utils::fromSettings(clangdSettingsKey(), {}, Core::ICore::settings(), &m_data);
|
||||
|
||||
Reference in New Issue
Block a user