Merge remote-tracking branch 'origin/3.5'

Change-Id: I7decbbee280174ad58491aa494eaf6adb7b0258a
This commit is contained in:
Eike Ziller
2015-07-01 14:14:54 +02:00
39 changed files with 166 additions and 94 deletions

View File

@@ -50,5 +50,7 @@ equals(TEST, 1) {
RESOURCES += clangstaticanalyzerunittests.qrc RESOURCES += clangstaticanalyzerunittests.qrc
} }
CONFIG(licensechecker): DEFINES += LICENSECHECKER
DISTFILES += \ DISTFILES += \
tests/tests.pri tests/tests.pri

View File

@@ -1,13 +1,12 @@
import qbs import qbs
QtcPlugin { QtcCommercialPlugin {
name: "ClangStaticAnalyzer" name: "ClangStaticAnalyzer"
Depends { name: "AnalyzerBase" } Depends { name: "AnalyzerBase" }
Depends { name: "Core" } Depends { name: "Core" }
Depends { name: "CppTools" } Depends { name: "CppTools" }
Depends { name: "ExtensionSystem" } Depends { name: "ExtensionSystem" }
Depends { name: "LicenseChecker" }
Depends { name: "ProjectExplorer" } Depends { name: "ProjectExplorer" }
Depends { name: "QtcSsh" } // TODO: export + recursive dependencies broken in qbs Depends { name: "QtcSsh" } // TODO: export + recursive dependencies broken in qbs
Depends { name: "Utils" } Depends { name: "Utils" }

View File

@@ -4,8 +4,9 @@ QTC_LIB_DEPENDS += \
utils utils
QTC_PLUGIN_DEPENDS += \ QTC_PLUGIN_DEPENDS += \
analyzerbase \ analyzerbase \
cpptools \ cpptools
licensechecker
QTC_TEST_DEPENDS += \ QTC_TEST_DEPENDS += \
qbsprojectmanager \ qbsprojectmanager \
qmakeprojectmanager qmakeprojectmanager
CONFIG(licensechecker): QTC_PLUGIN_DEPENDS += licensechecker

View File

@@ -4,7 +4,7 @@
** All rights reserved. ** All rights reserved.
** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us ** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us
** **
** This file is part of the Qt Enterprise Qt Quick Profiler Add-on. ** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on.
** **
** Licensees holding valid Qt Enterprise licenses may use this file in ** Licensees holding valid Qt Enterprise licenses may use this file in
** accordance with the Qt Enterprise License Agreement provided with the ** accordance with the Qt Enterprise License Agreement provided with the

View File

@@ -4,7 +4,7 @@
** All rights reserved. ** All rights reserved.
** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us ** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us
** **
** This file is part of the Qt Enterprise LicenseChecker Add-on. ** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on.
** **
** Licensees holding valid Qt Enterprise licenses may use this file in ** Licensees holding valid Qt Enterprise licenses may use this file in
** accordance with the Qt Enterprise License Agreement provided with the ** accordance with the Qt Enterprise License Agreement provided with the
@@ -39,12 +39,12 @@ ClangStaticAnalyzerConfigWidget::ClangStaticAnalyzerConfigWidget(
chooser->setExpectedKind(Utils::PathChooser::ExistingCommand); chooser->setExpectedKind(Utils::PathChooser::ExistingCommand);
chooser->setHistoryCompleter(QLatin1String("ClangStaticAnalyzer.ClangCommand.History")); chooser->setHistoryCompleter(QLatin1String("ClangStaticAnalyzer.ClangCommand.History"));
chooser->setPromptDialogTitle(tr("Clang Command")); chooser->setPromptDialogTitle(tr("Clang Command"));
chooser->setPath(settings->clangExecutable());
const auto validator = [chooser](Utils::FancyLineEdit *edit, QString *errorMessage) { const auto validator = [chooser](Utils::FancyLineEdit *edit, QString *errorMessage) {
return chooser->defaultValidationFunction()(edit, errorMessage) return chooser->defaultValidationFunction()(edit, errorMessage)
&& isClangExecutableUsable(chooser->fileName().toString(), errorMessage); && isClangExecutableUsable(chooser->fileName().toString(), errorMessage);
}; };
chooser->setValidationFunction(validator); chooser->setValidationFunction(validator);
chooser->setPath(settings->clangExecutable());
connect(m_ui->clangExecutableChooser, &Utils::PathChooser::changed, connect(m_ui->clangExecutableChooser, &Utils::PathChooser::changed,
[settings](const QString &path) { settings->setClangExecutable(path); }); [settings](const QString &path) { settings->setClangExecutable(path); });

View File

@@ -4,7 +4,7 @@
** All rights reserved. ** All rights reserved.
** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us ** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us
** **
** This file is part of the Qt Enterprise LicenseChecker Add-on. ** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on.
** **
** Licensees holding valid Qt Enterprise licenses may use this file in ** Licensees holding valid Qt Enterprise licenses may use this file in
** accordance with the Qt Enterprise License Agreement provided with the ** accordance with the Qt Enterprise License Agreement provided with the

View File

@@ -4,7 +4,7 @@
** All rights reserved. ** All rights reserved.
** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us ** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us
** **
** This file is part of the Qt Enterprise Qt LicenseChecker Add-on. ** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on.
** **
** Licensees holding valid Qt Enterprise licenses may use this file in ** Licensees holding valid Qt Enterprise licenses may use this file in
** accordance with the Qt Enterprise License Agreement provided with the ** accordance with the Qt Enterprise License Agreement provided with the
@@ -24,6 +24,7 @@ namespace Constants {
const char CLANG_EXECUTABLE_BASE_NAME[] = "clang"; const char CLANG_EXECUTABLE_BASE_NAME[] = "clang";
const char SETTINGS_ID[] = "ClangStaticAnalyzer"; const char SETTINGS_ID[] = "ClangStaticAnalyzer";
const char CLANGSTATICANALYZER_RUN_MODE[] = "ClangStaticAnalyzer.RunMode";
} // Constants } // Constants
} // ClangStaticAnalyzer } // ClangStaticAnalyzer

View File

@@ -4,7 +4,7 @@
** All rights reserved. ** All rights reserved.
** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us ** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us
** **
** This file is part of the Qt Enterprise LicenseChecker Add-on. ** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on.
** **
** Licensees holding valid Qt Enterprise licenses may use this file in ** Licensees holding valid Qt Enterprise licenses may use this file in
** accordance with the Qt Enterprise License Agreement provided with the ** accordance with the Qt Enterprise License Agreement provided with the

View File

@@ -4,7 +4,7 @@
** All rights reserved. ** All rights reserved.
** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us ** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us
** **
** This file is part of the Qt Enterprise LicenseChecker Add-on. ** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on.
** **
** Licensees holding valid Qt Enterprise licenses may use this file in ** Licensees holding valid Qt Enterprise licenses may use this file in
** accordance with the Qt Enterprise License Agreement provided with the ** accordance with the Qt Enterprise License Agreement provided with the

View File

@@ -4,7 +4,7 @@
** All rights reserved. ** All rights reserved.
** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us ** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us
** **
** This file is part of the Qt Enterprise LicenseChecker Add-on. ** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on.
** **
** Licensees holding valid Qt Enterprise licenses may use this file in ** Licensees holding valid Qt Enterprise licenses may use this file in
** accordance with the Qt Enterprise License Agreement provided with the ** accordance with the Qt Enterprise License Agreement provided with the

View File

@@ -4,7 +4,7 @@
** All rights reserved. ** All rights reserved.
** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us ** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us
** **
** This file is part of the Qt Enterprise LicenseChecker Add-on. ** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on.
** **
** Licensees holding valid Qt Enterprise licenses may use this file in ** Licensees holding valid Qt Enterprise licenses may use this file in
** accordance with the Qt Enterprise License Agreement provided with the ** accordance with the Qt Enterprise License Agreement provided with the

View File

@@ -4,7 +4,7 @@
** All rights reserved. ** All rights reserved.
** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us ** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us
** **
** This file is part of the Qt Enterprise LicenseChecker Add-on. ** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on.
** **
** Licensees holding valid Qt Enterprise licenses may use this file in ** Licensees holding valid Qt Enterprise licenses may use this file in
** accordance with the Qt Enterprise License Agreement provided with the ** accordance with the Qt Enterprise License Agreement provided with the

View File

@@ -4,7 +4,7 @@
** All rights reserved. ** All rights reserved.
** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us ** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us
** **
** This file is part of the Qt Enterprise LicenseChecker Add-on. ** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on.
** **
** Licensees holding valid Qt Enterprise licenses may use this file in ** Licensees holding valid Qt Enterprise licenses may use this file in
** accordance with the Qt Enterprise License Agreement provided with the ** accordance with the Qt Enterprise License Agreement provided with the

View File

@@ -4,7 +4,7 @@
** All rights reserved. ** All rights reserved.
** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us ** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us
** **
** This file is part of the Qt Enterprise LicenseChecker Add-on. ** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on.
** **
** Licensees holding valid Qt Enterprise licenses may use this file in ** Licensees holding valid Qt Enterprise licenses may use this file in
** accordance with the Qt Enterprise License Agreement provided with the ** accordance with the Qt Enterprise License Agreement provided with the

View File

@@ -4,7 +4,7 @@
** All rights reserved. ** All rights reserved.
** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us ** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us
** **
** This file is part of the Qt Enterprise LicenseChecker Add-on. ** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on.
** **
** Licensees holding valid Qt Enterprise licenses may use this file in ** Licensees holding valid Qt Enterprise licenses may use this file in
** accordance with the Qt Enterprise License Agreement provided with the ** accordance with the Qt Enterprise License Agreement provided with the

View File

@@ -4,7 +4,7 @@
** All rights reserved. ** All rights reserved.
** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us ** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us
** **
** This file is part of the Qt Enterprise Qt Quick Profiler Add-on. ** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on.
** **
** Licensees holding valid Qt Enterprise licenses may use this file in ** Licensees holding valid Qt Enterprise licenses may use this file in
** accordance with the Qt Enterprise License Agreement provided with the ** accordance with the Qt Enterprise License Agreement provided with the
@@ -19,6 +19,7 @@
#include "clangstaticanalyzerplugin.h" #include "clangstaticanalyzerplugin.h"
#include "clangstaticanalyzerconfigwidget.h" #include "clangstaticanalyzerconfigwidget.h"
#include "clangstaticanalyzerconstants.h"
#include "clangstaticanalyzerprojectsettingswidget.h" #include "clangstaticanalyzerprojectsettingswidget.h"
#include "clangstaticanalyzerruncontrolfactory.h" #include "clangstaticanalyzerruncontrolfactory.h"
#include "clangstaticanalyzertool.h" #include "clangstaticanalyzertool.h"
@@ -35,9 +36,12 @@
#include <coreplugin/actionmanager/actioncontainer.h> #include <coreplugin/actionmanager/actioncontainer.h>
#include <coreplugin/coreconstants.h> #include <coreplugin/coreconstants.h>
#include <coreplugin/dialogs/ioptionspage.h> #include <coreplugin/dialogs/ioptionspage.h>
#include <licensechecker/licensecheckerplugin.h>
#include <projectexplorer/projectpanelfactory.h> #include <projectexplorer/projectpanelfactory.h>
#ifdef LICENSECHECKER
#include <licensechecker/licensecheckerplugin.h>
#endif
#include <extensionsystem/pluginmanager.h> #include <extensionsystem/pluginmanager.h>
#include <QAction> #include <QAction>
@@ -114,6 +118,7 @@ bool ClangStaticAnalyzerPlugin::initialize(const QStringList &arguments, QString
panelFactory->setSimpleCreateWidgetFunction<ProjectSettingsWidget>(QIcon()); panelFactory->setSimpleCreateWidgetFunction<ProjectSettingsWidget>(QIcon());
ProjectExplorer::ProjectPanelFactory::registerFactory(panelFactory); ProjectExplorer::ProjectPanelFactory::registerFactory(panelFactory);
#ifdef LICENSECHECKER
LicenseChecker::LicenseCheckerPlugin *licenseChecker LicenseChecker::LicenseCheckerPlugin *licenseChecker
= ExtensionSystem::PluginManager::getObject<LicenseChecker::LicenseCheckerPlugin>(); = ExtensionSystem::PluginManager::getObject<LicenseChecker::LicenseCheckerPlugin>();
@@ -123,8 +128,10 @@ bool ClangStaticAnalyzerPlugin::initialize(const QStringList &arguments, QString
} else { } else {
qWarning() << "Invalid license, disabling Clang Static Analyzer"; qWarning() << "Invalid license, disabling Clang Static Analyzer";
} }
return true; return true;
#else // LICENSECHECKER
return initializeEnterpriseFeatures(arguments, errorString);
#endif
} }
bool ClangStaticAnalyzerPlugin::initializeEnterpriseFeatures(const QStringList &arguments, bool ClangStaticAnalyzerPlugin::initializeEnterpriseFeatures(const QStringList &arguments,
@@ -147,7 +154,7 @@ bool ClangStaticAnalyzerPlugin::initializeEnterpriseFeatures(const QStringList &
"to find bugs."); "to find bugs.");
AnalyzerAction *action = new AnalyzerAction(this); AnalyzerAction *action = new AnalyzerAction(this);
action->setRunMode(ProjectExplorer::ClangStaticAnalyzerMode); action->setRunMode(Constants::CLANGSTATICANALYZER_RUN_MODE);
action->setToolId(ClangStaticAnalyzerToolId); action->setToolId(ClangStaticAnalyzerToolId);
action->setActionId("ClangStaticAnalyzer"); action->setActionId("ClangStaticAnalyzer");
action->setWidgetCreator(widgetCreator); action->setWidgetCreator(widgetCreator);
@@ -155,7 +162,7 @@ bool ClangStaticAnalyzerPlugin::initializeEnterpriseFeatures(const QStringList &
action->setCustomToolStarter([tool] { tool->startTool(); }); action->setCustomToolStarter([tool] { tool->startTool(); });
action->setText(tr("Clang Static Analyzer")); action->setText(tr("Clang Static Analyzer"));
action->setToolTip(toolTip); action->setToolTip(toolTip);
action->setMenuGroup(Constants::G_ANALYZER_TOOLS); action->setMenuGroup(Analyzer::Constants::G_ANALYZER_TOOLS);
action->setEnabled(false); action->setEnabled(false);
AnalyzerManager::addAction(action); AnalyzerManager::addAction(action);

View File

@@ -4,7 +4,7 @@
** All rights reserved. ** All rights reserved.
** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us ** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us
** **
** This file is part of the Qt Enterprise Qt Quick Profiler Add-on. ** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on.
** **
** Licensees holding valid Qt Enterprise licenses may use this file in ** Licensees holding valid Qt Enterprise licenses may use this file in
** accordance with the Qt Enterprise License Agreement provided with the ** accordance with the Qt Enterprise License Agreement provided with the

View File

@@ -4,7 +4,7 @@
** All rights reserved. ** All rights reserved.
** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us ** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us
** **
** This file is part of the Qt Enterprise Qt Quick Profiler Add-on. ** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on.
** **
** Licensees holding valid Qt Enterprise licenses may use this file in ** Licensees holding valid Qt Enterprise licenses may use this file in
** accordance with the Qt Enterprise License Agreement provided with the ** accordance with the Qt Enterprise License Agreement provided with the
@@ -15,6 +15,7 @@
** contact form at http://www.qt.io/contact-us ** contact form at http://www.qt.io/contact-us
** **
****************************************************************************/ ****************************************************************************/
#include "clangstaticanalyzerprojectsettings.h" #include "clangstaticanalyzerprojectsettings.h"
#include "clangstaticanalyzerdiagnostic.h" #include "clangstaticanalyzerdiagnostic.h"

View File

@@ -4,7 +4,7 @@
** All rights reserved. ** All rights reserved.
** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us ** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us
** **
** This file is part of the Qt Enterprise Qt Quick Profiler Add-on. ** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on.
** **
** Licensees holding valid Qt Enterprise licenses may use this file in ** Licensees holding valid Qt Enterprise licenses may use this file in
** accordance with the Qt Enterprise License Agreement provided with the ** accordance with the Qt Enterprise License Agreement provided with the

View File

@@ -4,7 +4,7 @@
** All rights reserved. ** All rights reserved.
** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us ** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us
** **
** This file is part of the Qt Enterprise Qt Quick Profiler Add-on. ** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on.
** **
** Licensees holding valid Qt Enterprise licenses may use this file in ** Licensees holding valid Qt Enterprise licenses may use this file in
** accordance with the Qt Enterprise License Agreement provided with the ** accordance with the Qt Enterprise License Agreement provided with the
@@ -15,6 +15,7 @@
** contact form at http://www.qt.io/contact-us ** contact form at http://www.qt.io/contact-us
** **
****************************************************************************/ ****************************************************************************/
#include "clangstaticanalyzerprojectsettingsmanager.h" #include "clangstaticanalyzerprojectsettingsmanager.h"
#include "clangstaticanalyzerprojectsettings.h" #include "clangstaticanalyzerprojectsettings.h"

View File

@@ -4,7 +4,7 @@
** All rights reserved. ** All rights reserved.
** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us ** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us
** **
** This file is part of the Qt Enterprise Qt Quick Profiler Add-on. ** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on.
** **
** Licensees holding valid Qt Enterprise licenses may use this file in ** Licensees holding valid Qt Enterprise licenses may use this file in
** accordance with the Qt Enterprise License Agreement provided with the ** accordance with the Qt Enterprise License Agreement provided with the
@@ -15,6 +15,7 @@
** contact form at http://www.qt.io/contact-us ** contact form at http://www.qt.io/contact-us
** **
****************************************************************************/ ****************************************************************************/
#ifndef CLANGSTATICANALYZERPROJECTSETTINGSMANAGER_H #ifndef CLANGSTATICANALYZERPROJECTSETTINGSMANAGER_H
#define CLANGSTATICANALYZERPROJECTSETTINGSMANAGER_H #define CLANGSTATICANALYZERPROJECTSETTINGSMANAGER_H

View File

@@ -4,7 +4,7 @@
** All rights reserved. ** All rights reserved.
** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us ** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us
** **
** This file is part of the Qt Enterprise Qt Quick Profiler Add-on. ** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on.
** **
** Licensees holding valid Qt Enterprise licenses may use this file in ** Licensees holding valid Qt Enterprise licenses may use this file in
** accordance with the Qt Enterprise License Agreement provided with the ** accordance with the Qt Enterprise License Agreement provided with the
@@ -15,6 +15,7 @@
** contact form at http://www.qt.io/contact-us ** contact form at http://www.qt.io/contact-us
** **
****************************************************************************/ ****************************************************************************/
#include "clangstaticanalyzerprojectsettingswidget.h" #include "clangstaticanalyzerprojectsettingswidget.h"
#include "ui_clangstaticanalyzerprojectsettingswidget.h" #include "ui_clangstaticanalyzerprojectsettingswidget.h"

View File

@@ -4,7 +4,7 @@
** All rights reserved. ** All rights reserved.
** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us ** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us
** **
** This file is part of the Qt Enterprise Qt Quick Profiler Add-on. ** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on.
** **
** Licensees holding valid Qt Enterprise licenses may use this file in ** Licensees holding valid Qt Enterprise licenses may use this file in
** accordance with the Qt Enterprise License Agreement provided with the ** accordance with the Qt Enterprise License Agreement provided with the
@@ -15,6 +15,7 @@
** contact form at http://www.qt.io/contact-us ** contact form at http://www.qt.io/contact-us
** **
****************************************************************************/ ****************************************************************************/
#ifndef CLANGSTATICANALYZERPROJECTSETTINGSWIDGET_H #ifndef CLANGSTATICANALYZERPROJECTSETTINGSWIDGET_H
#define CLANGSTATICANALYZERPROJECTSETTINGSWIDGET_H #define CLANGSTATICANALYZERPROJECTSETTINGSWIDGET_H

View File

@@ -4,7 +4,7 @@
** All rights reserved. ** All rights reserved.
** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us ** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us
** **
** This file is part of the Qt Enterprise LicenseChecker Add-on. ** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on.
** **
** Licensees holding valid Qt Enterprise licenses may use this file in ** Licensees holding valid Qt Enterprise licenses may use this file in
** accordance with the Qt Enterprise License Agreement provided with the ** accordance with the Qt Enterprise License Agreement provided with the
@@ -61,8 +61,6 @@ ClangStaticAnalyzerRunControl::ClangStaticAnalyzerRunControl(
const ProjectInfo &projectInfo) const ProjectInfo &projectInfo)
: AnalyzerRunControl(startParams, runConfiguration) : AnalyzerRunControl(startParams, runConfiguration)
, m_projectInfo(projectInfo) , m_projectInfo(projectInfo)
, m_toolchainType(ProjectExplorer::ToolChainKitInformation
::toolChain(runConfiguration->target()->kit())->type())
, m_wordWidth(runConfiguration->abi().wordWidth()) , m_wordWidth(runConfiguration->abi().wordWidth())
, m_initialFilesToProcessSize(0) , m_initialFilesToProcessSize(0)
, m_filesAnalyzed(0) , m_filesAnalyzed(0)
@@ -113,39 +111,95 @@ static QStringList tweakedArguments(const QString &filePath,
return newArguments; return newArguments;
} }
static QStringList argumentsFromProjectPart(const CppTools::ProjectPart::Ptr &projectPart, static QString createLanguageOptionMsvc(ProjectFile::Kind fileKind)
CppTools::ProjectFile::Kind fileKind,
const QString &toolchainType,
unsigned char wordWidth)
{ {
QStringList result; switch (fileKind) {
case ProjectFile::CHeader:
const bool objcExt = projectPart->languageExtensions & ProjectPart::ObjectiveCExtensions; case ProjectFile::CSource:
result += CppTools::CompilerOptionsBuilder::createLanguageOption(fileKind, objcExt, return QLatin1String("/TC");
toolchainType); break;
result += CppTools::CompilerOptionsBuilder::createOptionsForLanguage( case ProjectFile::CXXHeader:
projectPart->languageVersion, case ProjectFile::CXXSource:
projectPart->languageExtensions, false, return QLatin1String("/TP");
toolchainType); break;
result += CppTools::CompilerOptionsBuilder::createDefineOptions(projectPart->toolchainDefines, default:
false, toolchainType); break;
result += CppTools::CompilerOptionsBuilder::createDefineOptions(projectPart->projectDefines, }
false, toolchainType); return QString();
result += CppTools::CompilerOptionsBuilder::createHeaderPathOptions(
projectPart->headerPaths,
CompilerOptionsBuilder::IsBlackListed(),
toolchainType);
if (toolchainType == QLatin1String("msvc"))
result += QLatin1String("/EHsc"); // clang-cl does not understand exceptions
else
result += QLatin1String("-fPIC"); // TODO: Remove?
prependWordWidthArgumentIfNotIncluded(&result, wordWidth);
return result;
} }
class ClangStaticAnalyzerOptionsBuilder : public CompilerOptionsBuilder
{
public:
static QStringList build(const CppTools::ProjectPart::Ptr &projectPart,
CppTools::ProjectFile::Kind fileKind,
unsigned char wordWidth)
{
ClangStaticAnalyzerOptionsBuilder optionsBuilder(projectPart);
optionsBuilder.addLanguageOption(fileKind);
optionsBuilder.addOptionsForLanguage(false);
// In gcc headers, lots of built-ins are referenced that clang does not understand.
// 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"))
optionsBuilder.addDefine("#define _X86INTRIN_H_INCLUDED\n");
optionsBuilder.addToolchainAndProjectDefines();
optionsBuilder.addHeaderPathOptions();
if (projectPart->toolchainType == QLatin1String("msvc"))
optionsBuilder.add(QLatin1String("/EHsc")); // clang-cl does not understand exceptions
else
optionsBuilder.add(QLatin1String("-fPIC")); // TODO: Remove?
QStringList options = optionsBuilder.options();
prependWordWidthArgumentIfNotIncluded(&options, wordWidth);
return options;
}
private:
ClangStaticAnalyzerOptionsBuilder(const CppTools::ProjectPart::Ptr &projectPart)
: CompilerOptionsBuilder(projectPart)
, m_isMsvcToolchain(m_projectPart->toolchainType == QLatin1String("msvc"))
{
}
void addLanguageOption(ProjectFile::Kind fileKind) override
{
if (m_isMsvcToolchain)
add(createLanguageOptionMsvc(fileKind));
else
CompilerOptionsBuilder::addLanguageOption(fileKind);
}
void addOptionsForLanguage(bool checkForBorlandExtensions) override
{
if (m_isMsvcToolchain)
return;
CompilerOptionsBuilder::addOptionsForLanguage(checkForBorlandExtensions);
}
QString includeOption() const override
{
if (m_isMsvcToolchain)
return QLatin1String("/I");
return CompilerOptionsBuilder::includeOption();
}
QString defineOption() const override
{
if (m_isMsvcToolchain)
return QLatin1String("/D");
return CompilerOptionsBuilder::defineOption();
}
private:
bool m_isMsvcToolchain;
};
static AnalyzeUnits unitsToAnalyzeFromCompilerCallData( static AnalyzeUnits unitsToAnalyzeFromCompilerCallData(
const ProjectInfo::CompilerCallData &compilerCallData, const ProjectInfo::CompilerCallData &compilerCallData,
unsigned char wordWidth) unsigned char wordWidth)
@@ -169,7 +223,6 @@ static AnalyzeUnits unitsToAnalyzeFromCompilerCallData(
} }
static AnalyzeUnits unitsToAnalyzeFromProjectParts(const QList<ProjectPart::Ptr> projectParts, static AnalyzeUnits unitsToAnalyzeFromProjectParts(const QList<ProjectPart::Ptr> projectParts,
const QString &toolchainType,
unsigned char wordWidth) unsigned char wordWidth)
{ {
qCDebug(LOG) << "Taking arguments for analyzing from ProjectParts."; qCDebug(LOG) << "Taking arguments for analyzing from ProjectParts.";
@@ -185,10 +238,8 @@ static AnalyzeUnits unitsToAnalyzeFromProjectParts(const QList<ProjectPart::Ptr>
continue; continue;
QTC_CHECK(file.kind != ProjectFile::Unclassified); QTC_CHECK(file.kind != ProjectFile::Unclassified);
if (ProjectFile::isSource(file.kind)) { if (ProjectFile::isSource(file.kind)) {
const QStringList arguments = argumentsFromProjectPart(projectPart, const QStringList arguments
file.kind, = ClangStaticAnalyzerOptionsBuilder::build(projectPart, file.kind, wordWidth);
toolchainType,
wordWidth);
unitsToAnalyze << AnalyzeUnit(file.path, arguments); unitsToAnalyze << AnalyzeUnit(file.path, arguments);
} }
} }
@@ -205,7 +256,6 @@ AnalyzeUnits ClangStaticAnalyzerRunControl::sortedUnitsToAnalyze()
const ProjectInfo::CompilerCallData compilerCallData = m_projectInfo.compilerCallData(); const ProjectInfo::CompilerCallData compilerCallData = m_projectInfo.compilerCallData();
if (compilerCallData.isEmpty()) { if (compilerCallData.isEmpty()) {
units = unitsToAnalyzeFromProjectParts(m_projectInfo.projectParts(), units = unitsToAnalyzeFromProjectParts(m_projectInfo.projectParts(),
m_toolchainType,
m_wordWidth); m_wordWidth);
} else { } else {
units = unitsToAnalyzeFromCompilerCallData(compilerCallData, m_wordWidth); units = unitsToAnalyzeFromCompilerCallData(compilerCallData, m_wordWidth);
@@ -231,6 +281,12 @@ static QDebug operator<<(QDebug debug, const AnalyzeUnits &analyzeUnits)
return debug; return debug;
} }
static QString toolchainType(ProjectExplorer::RunConfiguration *runConfiguration)
{
QTC_ASSERT(runConfiguration, return QString());
return ToolChainKitInformation::toolChain(runConfiguration->target()->kit())->type();
}
bool ClangStaticAnalyzerRunControl::startEngine() bool ClangStaticAnalyzerRunControl::startEngine()
{ {
m_success = false; m_success = false;
@@ -243,8 +299,8 @@ bool ClangStaticAnalyzerRunControl::startEngine()
// Check clang executable // Check clang executable
bool isValidClangExecutable; bool isValidClangExecutable;
const QString executable const QString executable = clangExecutableFromSettings(toolchainType(runConfiguration()),
= clangExecutableFromSettings(m_toolchainType, &isValidClangExecutable); &isValidClangExecutable);
if (!isValidClangExecutable) { if (!isValidClangExecutable) {
const QString errorMessage = tr("Clang Static Analyzer: Invalid executable \"%1\", stop.") const QString errorMessage = tr("Clang Static Analyzer: Invalid executable \"%1\", stop.")
.arg(executable); .arg(executable);

View File

@@ -4,7 +4,7 @@
** All rights reserved. ** All rights reserved.
** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us ** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us
** **
** This file is part of the Qt Enterprise LicenseChecker Add-on. ** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on.
** **
** Licensees holding valid Qt Enterprise licenses may use this file in ** Licensees holding valid Qt Enterprise licenses may use this file in
** accordance with the Qt Enterprise License Agreement provided with the ** accordance with the Qt Enterprise License Agreement provided with the
@@ -71,7 +71,6 @@ private:
private: private:
const CppTools::ProjectInfo m_projectInfo; const CppTools::ProjectInfo m_projectInfo;
const QString m_toolchainType;
const unsigned char m_wordWidth; const unsigned char m_wordWidth;
QString m_clangExecutable; QString m_clangExecutable;

View File

@@ -4,7 +4,7 @@
** All rights reserved. ** All rights reserved.
** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us ** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us
** **
** This file is part of the Qt Enterprise LicenseChecker Add-on. ** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on.
** **
** Licensees holding valid Qt Enterprise licenses may use this file in ** Licensees holding valid Qt Enterprise licenses may use this file in
** accordance with the Qt Enterprise License Agreement provided with the ** accordance with the Qt Enterprise License Agreement provided with the
@@ -18,6 +18,8 @@
#include "clangstaticanalyzerruncontrolfactory.h" #include "clangstaticanalyzerruncontrolfactory.h"
#include "clangstaticanalyzerconstants.h"
#include <analyzerbase/analyzermanager.h> #include <analyzerbase/analyzermanager.h>
#include <analyzerbase/analyzerruncontrol.h> #include <analyzerbase/analyzerruncontrol.h>
#include <analyzerbase/analyzerstartparameters.h> #include <analyzerbase/analyzerstartparameters.h>
@@ -51,9 +53,9 @@ ClangStaticAnalyzerRunControlFactory::ClangStaticAnalyzerRunControlFactory(
} }
bool ClangStaticAnalyzerRunControlFactory::canRun(RunConfiguration *runConfiguration, bool ClangStaticAnalyzerRunControlFactory::canRun(RunConfiguration *runConfiguration,
RunMode runMode) const Core::Id runMode) const
{ {
if (runMode != ClangStaticAnalyzerMode) if (runMode != Constants::CLANGSTATICANALYZER_RUN_MODE)
return false; return false;
Target *target = runConfiguration->target(); Target *target = runConfiguration->target();
@@ -68,7 +70,7 @@ bool ClangStaticAnalyzerRunControlFactory::canRun(RunConfiguration *runConfigura
} }
RunControl *ClangStaticAnalyzerRunControlFactory::create(RunConfiguration *runConfiguration, RunControl *ClangStaticAnalyzerRunControlFactory::create(RunConfiguration *runConfiguration,
RunMode runMode, Core::Id runMode,
QString *errorMessage) QString *errorMessage)
{ {
using namespace CppTools; using namespace CppTools;

View File

@@ -4,7 +4,7 @@
** All rights reserved. ** All rights reserved.
** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us ** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us
** **
** This file is part of the Qt Enterprise LicenseChecker Add-on. ** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on.
** **
** Licensees holding valid Qt Enterprise licenses may use this file in ** Licensees holding valid Qt Enterprise licenses may use this file in
** accordance with the Qt Enterprise License Agreement provided with the ** accordance with the Qt Enterprise License Agreement provided with the
@@ -35,10 +35,10 @@ public:
QObject *parent = 0); QObject *parent = 0);
bool canRun(ProjectExplorer::RunConfiguration *runConfiguration, bool canRun(ProjectExplorer::RunConfiguration *runConfiguration,
ProjectExplorer::RunMode runMode) const; Core::Id runMode) const;
ProjectExplorer::RunControl *create(ProjectExplorer::RunConfiguration *runConfiguration, ProjectExplorer::RunControl *create(ProjectExplorer::RunConfiguration *runConfiguration,
ProjectExplorer::RunMode runMode, Core::Id runMode,
QString *errorMessage); QString *errorMessage);
private: private:

View File

@@ -4,7 +4,7 @@
** All rights reserved. ** All rights reserved.
** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us ** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us
** **
** This file is part of the Qt Enterprise LicenseChecker Add-on. ** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on.
** **
** Licensees holding valid Qt Enterprise licenses may use this file in ** Licensees holding valid Qt Enterprise licenses may use this file in
** accordance with the Qt Enterprise License Agreement provided with the ** accordance with the Qt Enterprise License Agreement provided with the

View File

@@ -4,7 +4,7 @@
** All rights reserved. ** All rights reserved.
** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us ** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us
** **
** This file is part of the Qt Enterprise LicenseChecker Add-on. ** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on.
** **
** Licensees holding valid Qt Enterprise licenses may use this file in ** Licensees holding valid Qt Enterprise licenses may use this file in
** accordance with the Qt Enterprise License Agreement provided with the ** accordance with the Qt Enterprise License Agreement provided with the

View File

@@ -4,7 +4,7 @@
** All rights reserved. ** All rights reserved.
** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us ** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us
** **
** This file is part of the Qt Enterprise LicenseChecker Add-on. ** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on.
** **
** Licensees holding valid Qt Enterprise licenses may use this file in ** Licensees holding valid Qt Enterprise licenses may use this file in
** accordance with the Qt Enterprise License Agreement provided with the ** accordance with the Qt Enterprise License Agreement provided with the

View File

@@ -4,7 +4,7 @@
** All rights reserved. ** All rights reserved.
** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us ** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us
** **
** This file is part of the Qt Enterprise LicenseChecker Add-on. ** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on.
** **
** Licensees holding valid Qt Enterprise licenses may use this file in ** Licensees holding valid Qt Enterprise licenses may use this file in
** accordance with the Qt Enterprise License Agreement provided with the ** accordance with the Qt Enterprise License Agreement provided with the

View File

@@ -4,7 +4,7 @@
** All rights reserved. ** All rights reserved.
** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us ** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us
** **
** This file is part of the Qt Enterprise LicenseChecker Add-on. ** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on.
** **
** Licensees holding valid Qt Enterprise licenses may use this file in ** Licensees holding valid Qt Enterprise licenses may use this file in
** accordance with the Qt Enterprise License Agreement provided with the ** accordance with the Qt Enterprise License Agreement provided with the
@@ -18,6 +18,7 @@
#include "clangstaticanalyzertool.h" #include "clangstaticanalyzertool.h"
#include "clangstaticanalyzerconstants.h"
#include "clangstaticanalyzerdiagnosticmodel.h" #include "clangstaticanalyzerdiagnosticmodel.h"
#include "clangstaticanalyzerdiagnosticview.h" #include "clangstaticanalyzerdiagnosticview.h"
#include "clangstaticanalyzerruncontrol.h" #include "clangstaticanalyzerruncontrol.h"
@@ -249,7 +250,7 @@ void ClangStaticAnalyzerTool::startTool()
connect(SessionManager::instance(), &SessionManager::aboutToRemoveProject, this, connect(SessionManager::instance(), &SessionManager::aboutToRemoveProject, this,
onProjectRemoved, Qt::UniqueConnection); onProjectRemoved, Qt::UniqueConnection);
} }
ProjectExplorerPlugin::runRunConfiguration(rc, ProjectExplorer::ClangStaticAnalyzerMode); ProjectExplorerPlugin::runRunConfiguration(rc, Constants::CLANGSTATICANALYZER_RUN_MODE);
} }
CppTools::ProjectInfo ClangStaticAnalyzerTool::projectInfoBeforeBuild() const CppTools::ProjectInfo ClangStaticAnalyzerTool::projectInfoBeforeBuild() const

View File

@@ -4,7 +4,7 @@
** All rights reserved. ** All rights reserved.
** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us ** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us
** **
** This file is part of the Qt Enterprise LicenseChecker Add-on. ** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on.
** **
** Licensees holding valid Qt Enterprise licenses may use this file in ** Licensees holding valid Qt Enterprise licenses may use this file in
** accordance with the Qt Enterprise License Agreement provided with the ** accordance with the Qt Enterprise License Agreement provided with the

View File

@@ -4,7 +4,7 @@
** All rights reserved. ** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com <http://qt.digia.com/> ** For any questions to Digia, please use contact form at http://qt.digia.com <http://qt.digia.com/>
** **
** This file is part of the Qt Enterprise Qt Quick Profiler Add-on. ** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on.
** **
** Licensees holding valid Qt Enterprise licenses may use this file in ** Licensees holding valid Qt Enterprise licenses may use this file in
** accordance with the Qt Enterprise License Agreement provided with the ** accordance with the Qt Enterprise License Agreement provided with the
@@ -82,8 +82,7 @@ void ClangStaticAnalyzerUnitTests::testProject()
CppTools::Tests::ProjectOpenerAndCloser projectManager; CppTools::Tests::ProjectOpenerAndCloser projectManager;
const CppTools::ProjectInfo projectInfo = projectManager.open(projectFilePath, true); const CppTools::ProjectInfo projectInfo = projectManager.open(projectFilePath, true);
QVERIFY(projectInfo.isValid()); QVERIFY(projectInfo.isValid());
AnalyzerManager::selectTool(ClangStaticAnalyzerToolId); AnalyzerManager::selectAction(ClangStaticAnalyzerToolId, /* alsoRunIt = */ true);
AnalyzerManager::startTool();
QSignalSpy waiter(m_analyzerTool, SIGNAL(finished(bool))); QSignalSpy waiter(m_analyzerTool, SIGNAL(finished(bool)));
QVERIFY(waiter.wait(30000)); QVERIFY(waiter.wait(30000));
const QList<QVariant> arguments = waiter.takeFirst(); const QList<QVariant> arguments = waiter.takeFirst();

View File

@@ -4,7 +4,7 @@
** All rights reserved. ** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com <http://qt.digia.com/> ** For any questions to Digia, please use contact form at http://qt.digia.com <http://qt.digia.com/>
** **
** This file is part of the Qt Enterprise Qt Quick Profiler Add-on. ** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on.
** **
** Licensees holding valid Qt Enterprise licenses may use this file in ** Licensees holding valid Qt Enterprise licenses may use this file in
** accordance with the Qt Enterprise License Agreement provided with the ** accordance with the Qt Enterprise License Agreement provided with the

View File

@@ -4,7 +4,7 @@
** All rights reserved. ** All rights reserved.
** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us ** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us
** **
** This file is part of the Qt Enterprise LicenseChecker Add-on. ** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on.
** **
** Licensees holding valid Qt Enterprise licenses may use this file in ** Licensees holding valid Qt Enterprise licenses may use this file in
** accordance with the Qt Enterprise License Agreement provided with the ** accordance with the Qt Enterprise License Agreement provided with the

View File

@@ -4,7 +4,7 @@
** All rights reserved. ** All rights reserved.
** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us ** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us
** **
** This file is part of the Qt Enterprise Qt LicenseChecker Add-on. ** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on.
** **
** Licensees holding valid Qt Enterprise licenses may use this file in ** Licensees holding valid Qt Enterprise licenses may use this file in
** accordance with the Qt Enterprise License Agreement provided with the ** accordance with the Qt Enterprise License Agreement provided with the

View File

@@ -4,7 +4,7 @@
** All rights reserved. ** All rights reserved.
** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us ** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us
** **
** This file is part of the Qt Enterprise LicenseChecker Add-on. ** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on.
** **
** Licensees holding valid Qt Enterprise licenses may use this file in ** Licensees holding valid Qt Enterprise licenses may use this file in
** accordance with the Qt Enterprise License Agreement provided with the ** accordance with the Qt Enterprise License Agreement provided with the

View File

@@ -4,7 +4,7 @@
** All rights reserved. ** All rights reserved.
** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us ** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us
** **
** This file is part of the Qt Enterprise LicenseChecker Add-on. ** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on.
** **
** Licensees holding valid Qt Enterprise licenses may use this file in ** Licensees holding valid Qt Enterprise licenses may use this file in
** accordance with the Qt Enterprise License Agreement provided with the ** accordance with the Qt Enterprise License Agreement provided with the