forked from qt-creator/qt-creator
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: Christian Kandeler <christian.kandeler@theqtcompany.com> Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
committed by
Nikolai Kosjar
parent
d303222c8a
commit
506fc40a31
@@ -30,6 +30,7 @@
|
||||
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
|
||||
#include <utils/hostosinfo.h>
|
||||
#include <utils/environment.h>
|
||||
|
||||
#include <QCoreApplication>
|
||||
@@ -50,8 +51,12 @@ namespace Internal {
|
||||
QString clangExecutableFromSettings(Core::Id toolchainType, bool *isValid)
|
||||
{
|
||||
QString exeFromSettings = ClangStaticAnalyzerSettings::instance()->clangExecutable();
|
||||
if (toolchainType == ProjectExplorer::Constants::MSVC_TOOLCHAIN_TYPEID)
|
||||
exeFromSettings.replace(QLatin1String("clang.exe"), QLatin1String("clang-cl.exe"));
|
||||
if (toolchainType == ProjectExplorer::Constants::MSVC_TOOLCHAIN_TYPEID) {
|
||||
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);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user