Skip to content
Snippets Groups Projects
Commit 506fc40a authored by Nikolai Kosjar's avatar Nikolai Kosjar Committed by Nikolai Kosjar
Browse files

ClangStaticAnalyzer: Fix accepting "clang" executable


The user can set "clang.exe" in the options, which is fine. However, "clang"
was problematic on Windows since we failed to replace it with "clang-cl" for
the actual run for MSVC toolchains.

Change-Id: I2f96428d15c7406e90a38c797817aef34e7a9541
Reviewed-by: default avatarChristian Kandeler <christian.kandeler@theqtcompany.com>
Reviewed-by: default avatarEike Ziller <eike.ziller@qt.io>
parent d303222c
No related branches found
No related tags found
No related merge requests found
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/projectexplorerconstants.h>
#include <utils/hostosinfo.h>
#include <utils/environment.h> #include <utils/environment.h>
#include <QCoreApplication> #include <QCoreApplication>
...@@ -50,8 +51,12 @@ namespace Internal { ...@@ -50,8 +51,12 @@ namespace Internal {
QString clangExecutableFromSettings(Core::Id toolchainType, bool *isValid) QString clangExecutableFromSettings(Core::Id toolchainType, bool *isValid)
{ {
QString exeFromSettings = ClangStaticAnalyzerSettings::instance()->clangExecutable(); QString exeFromSettings = ClangStaticAnalyzerSettings::instance()->clangExecutable();
if (toolchainType == ProjectExplorer::Constants::MSVC_TOOLCHAIN_TYPEID) if (toolchainType == ProjectExplorer::Constants::MSVC_TOOLCHAIN_TYPEID) {
exeFromSettings.replace(QLatin1String("clang.exe"), QLatin1String("clang-cl.exe")); if (exeFromSettings.endsWith(QLatin1String(QTC_HOST_EXE_SUFFIX)))
exeFromSettings.chop(int(qstrlen(QTC_HOST_EXE_SUFFIX)));
if (exeFromSettings.endsWith(QLatin1String("clang")))
exeFromSettings.append(QLatin1String("-cl"));
}
return clangExecutable(exeFromSettings, isValid); return clangExecutable(exeFromSettings, isValid);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment