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;
|
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()
|
void ClangdSettings::loadSettings()
|
||||||
{
|
{
|
||||||
Utils::fromSettings(clangdSettingsKey(), {}, Core::ICore::settings(), &m_data);
|
Utils::fromSettings(clangdSettingsKey(), {}, Core::ICore::settings(), &m_data);
|
||||||
|
|||||||
@@ -155,6 +155,7 @@ public:
|
|||||||
|
|
||||||
static QVersionNumber clangdVersion(const Utils::FilePath &clangdFilePath);
|
static QVersionNumber clangdVersion(const Utils::FilePath &clangdFilePath);
|
||||||
QVersionNumber clangdVersion() const { return clangdVersion(clangdFilePath()); }
|
QVersionNumber clangdVersion() const { return clangdVersion(clangdFilePath()); }
|
||||||
|
Utils::FilePath clangdIncludePath() const;
|
||||||
|
|
||||||
#ifdef WITH_TESTS
|
#ifdef WITH_TESTS
|
||||||
static void setUseClangd(bool use);
|
static void setUseClangd(bool use);
|
||||||
|
|||||||
Reference in New Issue
Block a user