Commit 351919a1 authored by Nikolai Kosjar's avatar Nikolai Kosjar

ClangStaticAnalyzer: Do not try to determine version of clang-cl.exe

It does not understand "--version". Use clang.exe for the version check.

Change-Id: I64a46e8e2e5be47ad6f13c9c5497264e1128a22a
Reviewed-by: Christian Kandeler's avatarChristian Kandeler <christian.kandeler@qt.io>
parent 66c589f9
......@@ -446,6 +446,21 @@ static Core::Id toolchainType(ProjectExplorer::RunConfiguration *runConfiguratio
return ToolChainKitInformation::toolChain(runConfiguration->target()->kit())->typeId();
}
static QString executableForVersionCheck(Core::Id toolchainType, const QString &executable)
{
if (toolchainType == ProjectExplorer::Constants::MSVC_TOOLCHAIN_TYPEID) {
const QString suffix = QLatin1String("-cl.exe");
if (executable.endsWith(suffix, Utils::HostOsInfo::fileNameCaseSensitivity())) {
QString modified = executable;
modified.chop(suffix.length());
modified.append(QLatin1String(".exe"));
return modified;
}
}
return executable;
}
void ClangStaticAnalyzerRunControl::start()
{
m_success = false;
......@@ -458,7 +473,8 @@ void ClangStaticAnalyzerRunControl::start()
// Check clang executable
bool isValidClangExecutable;
const QString executable = clangExecutableFromSettings(toolchainType(runConfiguration()),
const Core::Id theToolchainType = toolchainType(runConfiguration());
const QString executable = clangExecutableFromSettings(theToolchainType,
&isValidClangExecutable);
if (!isValidClangExecutable) {
const QString errorMessage = tr("Clang Static Analyzer: Invalid executable \"%1\", stop.")
......@@ -471,12 +487,13 @@ void ClangStaticAnalyzerRunControl::start()
}
// Check clang version
const ClangExecutableVersion version = clangExecutableVersion(executable);
const QString versionCheckExecutable = executableForVersionCheck(theToolchainType, executable);
const ClangExecutableVersion version = clangExecutableVersion(versionCheckExecutable);
if (!version.isValid()) {
const QString warningMessage
= tr("Clang Static Analyzer: Running with possibly unsupported version, "
"could not determine version from executable \"%1\".")
.arg(executable);
.arg(versionCheckExecutable);
appendMessage(warningMessage + QLatin1Char('\n'), Utils::StdErrFormat);
TaskHub::addTask(Task::Warning, warningMessage, Debugger::Constants::ANALYZERTASK_ID);
TaskHub::requestPopup();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment