From 344cbb3a1b0fe5dd04dca8181d51148c0e9f3d75 Mon Sep 17 00:00:00 2001 From: Ivan Donchevskii Date: Mon, 6 Aug 2018 11:32:32 +0200 Subject: Clang: Move clang paths helper functions to Core plugin These functions require core plugin so they can't go to utils library. At the same time to use them in ProjectExplorer plugin there are not too many choices where to put them without introducing new dependencies. Change-Id: I3cccccffaae8ac4bbce924fd809b5423da5dc503 Reviewed-by: Marco Bubke --- src/plugins/cpptools/compileroptionsbuilder.cpp | 36 +++++++------------------ 1 file changed, 10 insertions(+), 26 deletions(-) (limited to 'src/plugins/cpptools/compileroptionsbuilder.cpp') diff --git a/src/plugins/cpptools/compileroptionsbuilder.cpp b/src/plugins/cpptools/compileroptionsbuilder.cpp index 3c2dba239e..0eb940dcca 100644 --- a/src/plugins/cpptools/compileroptionsbuilder.cpp +++ b/src/plugins/cpptools/compileroptionsbuilder.cpp @@ -510,6 +510,16 @@ void CompilerOptionsBuilder::addPredefinedHeaderPathsOptions() addClangIncludeFolder(); } +static QString clangIncludeDirectory(const QString &clangVersion, + const QString &clangResourceDirectory) +{ +#ifndef UNIT_TESTS + return Core::ICore::clangIncludeDirectory(clangVersion, clangResourceDirectory); +#else + return QString(); +#endif +} + void CompilerOptionsBuilder::addClangIncludeFolder() { QTC_CHECK(!m_clangVersion.isEmpty()); @@ -525,32 +535,6 @@ void CompilerOptionsBuilder::addProjectConfigFileInclude() } } -static QString creatorLibexecPath() -{ -#ifndef UNIT_TESTS - return Core::ICore::instance()->libexecPath(); -#else - return QString(); -#endif -} - -QString clangIncludeDirectory(const QString &clangVersion, const QString &clangResourceDirectory) -{ - QDir dir(creatorLibexecPath() + "/clang" + clangIncludePath(clangVersion)); - if (!dir.exists() || !QFileInfo(dir, "stdint.h").exists()) - dir = QDir(clangResourceDirectory); - return QDir::toNativeSeparators(dir.canonicalPath()); -} - -QString clangExecutable(const QString &clangBinDirectory) -{ - const QString hostExeSuffix(QTC_HOST_EXE_SUFFIX); - QFileInfo executable(creatorLibexecPath() + "/clang/bin/clang" + hostExeSuffix); - if (!executable.exists()) - executable = QFileInfo(clangBinDirectory + "/clang" + hostExeSuffix); - return QDir::toNativeSeparators(executable.canonicalFilePath()); -} - void CompilerOptionsBuilder::undefineClangVersionMacrosForMsvc() { if (m_projectPart.toolchainType == ProjectExplorer::Constants::MSVC_TOOLCHAIN_TYPEID) { -- cgit v1.2.1