forked from qt-creator/qt-creator
Adapt to removal of ToolChain::type()
QtC change: e6d1141e1e
Change-Id: I50c0861dc6a864e54170b21de94a4106921e5a71
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
@@ -143,14 +143,15 @@ public:
|
||||
// Therefore, prevent the inclusion of the header that references them. Of course, this
|
||||
// will break if code actually requires stuff from there, but that should be the less common
|
||||
// case.
|
||||
const QString type = projectPart->toolchainType;
|
||||
if (type == QLatin1String("mingw") || type == QLatin1String("gcc"))
|
||||
const Core::Id type = projectPart->toolchainType;
|
||||
if (type == ProjectExplorer::Constants::MINGW_TOOLCHAIN_ID
|
||||
|| type == ProjectExplorer::Constants::GCC_TOOLCHAIN_ID)
|
||||
optionsBuilder.addDefine("#define _X86INTRIN_H_INCLUDED\n");
|
||||
|
||||
optionsBuilder.addToolchainAndProjectDefines();
|
||||
optionsBuilder.addHeaderPathOptions();
|
||||
|
||||
if (projectPart->toolchainType == QLatin1String("msvc"))
|
||||
if (type == ProjectExplorer::Constants::MSVC_TOOLCHAIN_ID)
|
||||
optionsBuilder.add(QLatin1String("/EHsc")); // clang-cl does not understand exceptions
|
||||
else
|
||||
optionsBuilder.add(QLatin1String("-fPIC")); // TODO: Remove?
|
||||
@@ -163,7 +164,7 @@ public:
|
||||
private:
|
||||
ClangStaticAnalyzerOptionsBuilder(const CppTools::ProjectPart::Ptr &projectPart)
|
||||
: CompilerOptionsBuilder(projectPart)
|
||||
, m_isMsvcToolchain(m_projectPart->toolchainType == QLatin1String("msvc"))
|
||||
, m_isMsvcToolchain(m_projectPart->toolchainType == ProjectExplorer::Constants::MSVC_TOOLCHAIN_ID)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -281,10 +282,10 @@ static QDebug operator<<(QDebug debug, const AnalyzeUnits &analyzeUnits)
|
||||
return debug;
|
||||
}
|
||||
|
||||
static QString toolchainType(ProjectExplorer::RunConfiguration *runConfiguration)
|
||||
static Core::Id toolchainType(ProjectExplorer::RunConfiguration *runConfiguration)
|
||||
{
|
||||
QTC_ASSERT(runConfiguration, return QString());
|
||||
return ToolChainKitInformation::toolChain(runConfiguration->target()->kit())->type();
|
||||
QTC_ASSERT(runConfiguration, return Core::Id());
|
||||
return ToolChainKitInformation::toolChain(runConfiguration->target()->kit())->typeId();
|
||||
}
|
||||
|
||||
bool ClangStaticAnalyzerRunControl::startEngine()
|
||||
|
@@ -63,10 +63,10 @@ bool ClangStaticAnalyzerRunControlFactory::canRun(RunConfiguration *runConfigura
|
||||
Kit *kit = target->kit();
|
||||
QTC_ASSERT(kit, return false);
|
||||
ToolChain *toolChain = ToolChainKitInformation::toolChain(kit);
|
||||
return toolChain && (toolChain->type() == QLatin1String("clang")
|
||||
|| toolChain->type() == QLatin1String("gcc")
|
||||
|| toolChain->type() == QLatin1String("mingw")
|
||||
|| toolChain->type() == QLatin1String("msvc"));
|
||||
return toolChain && (toolChain->typeId() == ProjectExplorer::Constants::CLANG_TOOLCHAIN_ID
|
||||
|| toolChain->typeId() == ProjectExplorer::Constants::GCC_TOOLCHAIN_ID
|
||||
|| toolChain->typeId() == ProjectExplorer::Constants::MINGW_TOOLCHAIN_ID
|
||||
|| toolChain->typeId() == ProjectExplorer::Constants::MSVC_TOOLCHAIN_ID);
|
||||
}
|
||||
|
||||
RunControl *ClangStaticAnalyzerRunControlFactory::create(RunConfiguration *runConfiguration,
|
||||
|
@@ -61,7 +61,7 @@ void ClangStaticAnalyzerUnitTests::initTestCase()
|
||||
if (!toolchain)
|
||||
QSKIP("This test requires that there is a kit with a toolchain.");
|
||||
bool hasClangExecutable;
|
||||
clangExecutableFromSettings(toolchain->type(), &hasClangExecutable);
|
||||
clangExecutableFromSettings(toolchain->typeId(), &hasClangExecutable);
|
||||
if (!hasClangExecutable)
|
||||
QSKIP("No clang suitable for analyzing found");
|
||||
|
||||
|
@@ -21,6 +21,8 @@
|
||||
#include "clangstaticanalyzerdiagnostic.h"
|
||||
#include "clangstaticanalyzersettings.h"
|
||||
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
|
||||
#include <utils/environment.h>
|
||||
|
||||
#include <QCoreApplication>
|
||||
@@ -38,10 +40,10 @@ static bool isFileExecutable(const QString &executablePath)
|
||||
namespace ClangStaticAnalyzer {
|
||||
namespace Internal {
|
||||
|
||||
QString clangExecutableFromSettings(const QString &toolchainType, bool *isValid)
|
||||
QString clangExecutableFromSettings(Core::Id toolchainType, bool *isValid)
|
||||
{
|
||||
QString exeFromSettings = ClangStaticAnalyzerSettings::instance()->clangExecutable();
|
||||
if (toolchainType == QLatin1String("msvc"))
|
||||
if (toolchainType == ProjectExplorer::Constants::MSVC_TOOLCHAIN_ID)
|
||||
exeFromSettings.replace(QLatin1String("clang.exe"), QLatin1String("clang-cl.exe"));
|
||||
return clangExecutable(exeFromSettings, isValid);
|
||||
}
|
||||
|
@@ -19,6 +19,8 @@
|
||||
#ifndef CLANGSTATICANALYZERUTILS_H
|
||||
#define CLANGSTATICANALYZERUTILS_H
|
||||
|
||||
#include <coreplugin/id.h>
|
||||
|
||||
#include <QtGlobal>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
@@ -33,7 +35,7 @@ class Location;
|
||||
bool isClangExecutableUsable(const QString &filePath, QString *errorMessage = 0);
|
||||
|
||||
QString clangExecutable(const QString &fileNameOrPath, bool *isValid);
|
||||
QString clangExecutableFromSettings(const QString &toolchainType, bool *isValid);
|
||||
QString clangExecutableFromSettings(Core::Id toolchainType, bool *isValid);
|
||||
|
||||
QString createFullLocationString(const ClangStaticAnalyzer::Internal::Location &location);
|
||||
|
||||
|
Reference in New Issue
Block a user