diff options
author | Eike Ziller <eike.ziller@theqtcompany.com> | 2015-07-01 14:14:54 +0200 |
---|---|---|
committer | Eike Ziller <eike.ziller@theqtcompany.com> | 2015-07-01 14:14:59 +0200 |
commit | bed4005b3082b74f2ca1d7a495dcd7c85a9fde9b (patch) | |
tree | de921c1a2ee4dc924a411aa714b3ce8a991b0464 | |
parent | 25f09990f7c72a69c1dbff71a2a7c222540d48a6 (diff) | |
parent | 39613b3b084d16c056ea22ea327712f4c05f5437 (diff) | |
download | qt-creator-bed4005b3082b74f2ca1d7a495dcd7c85a9fde9b.tar.gz |
Merge remote-tracking branch 'origin/3.5'
Change-Id: I7decbbee280174ad58491aa494eaf6adb7b0258a
39 files changed, 166 insertions, 94 deletions
diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzer.pro b/plugins/clangstaticanalyzer/clangstaticanalyzer.pro index cdffb1f1d1..f348951ea7 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzer.pro +++ b/plugins/clangstaticanalyzer/clangstaticanalyzer.pro @@ -50,5 +50,7 @@ equals(TEST, 1) { RESOURCES += clangstaticanalyzerunittests.qrc } +CONFIG(licensechecker): DEFINES += LICENSECHECKER + DISTFILES += \ tests/tests.pri diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzer.qbs b/plugins/clangstaticanalyzer/clangstaticanalyzer.qbs index 2ccc31337c..524debd500 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzer.qbs +++ b/plugins/clangstaticanalyzer/clangstaticanalyzer.qbs @@ -1,13 +1,12 @@ import qbs -QtcPlugin { +QtcCommercialPlugin { name: "ClangStaticAnalyzer" Depends { name: "AnalyzerBase" } Depends { name: "Core" } Depends { name: "CppTools" } Depends { name: "ExtensionSystem" } - Depends { name: "LicenseChecker" } Depends { name: "ProjectExplorer" } Depends { name: "QtcSsh" } // TODO: export + recursive dependencies broken in qbs Depends { name: "Utils" } diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzer_dependencies.pri b/plugins/clangstaticanalyzer/clangstaticanalyzer_dependencies.pri index f857a18e43..22a09515c4 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzer_dependencies.pri +++ b/plugins/clangstaticanalyzer/clangstaticanalyzer_dependencies.pri @@ -4,8 +4,9 @@ QTC_LIB_DEPENDS += \ utils QTC_PLUGIN_DEPENDS += \ analyzerbase \ - cpptools \ - licensechecker + cpptools QTC_TEST_DEPENDS += \ qbsprojectmanager \ qmakeprojectmanager + +CONFIG(licensechecker): QTC_PLUGIN_DEPENDS += licensechecker diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzer_global.h b/plugins/clangstaticanalyzer/clangstaticanalyzer_global.h index bc96f936e0..46bb4566ff 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzer_global.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzer_global.h @@ -4,7 +4,7 @@ ** All rights reserved. ** 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 ** accordance with the Qt Enterprise License Agreement provided with the diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.cpp index d73fd5436a..6bc81cac64 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** 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 ** accordance with the Qt Enterprise License Agreement provided with the @@ -39,12 +39,12 @@ ClangStaticAnalyzerConfigWidget::ClangStaticAnalyzerConfigWidget( chooser->setExpectedKind(Utils::PathChooser::ExistingCommand); chooser->setHistoryCompleter(QLatin1String("ClangStaticAnalyzer.ClangCommand.History")); chooser->setPromptDialogTitle(tr("Clang Command")); - chooser->setPath(settings->clangExecutable()); const auto validator = [chooser](Utils::FancyLineEdit *edit, QString *errorMessage) { return chooser->defaultValidationFunction()(edit, errorMessage) && isClangExecutableUsable(chooser->fileName().toString(), errorMessage); }; chooser->setValidationFunction(validator); + chooser->setPath(settings->clangExecutable()); connect(m_ui->clangExecutableChooser, &Utils::PathChooser::changed, [settings](const QString &path) { settings->setClangExecutable(path); }); diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.h b/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.h index 11c6018fef..4f55be8f4e 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.h @@ -4,7 +4,7 @@ ** All rights reserved. ** 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 ** accordance with the Qt Enterprise License Agreement provided with the diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerconstants.h b/plugins/clangstaticanalyzer/clangstaticanalyzerconstants.h index 04ed79b998..1114730614 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerconstants.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerconstants.h @@ -4,7 +4,7 @@ ** All rights reserved. ** 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 ** 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 SETTINGS_ID[] = "ClangStaticAnalyzer"; +const char CLANGSTATICANALYZER_RUN_MODE[] = "ClangStaticAnalyzer.RunMode"; } // Constants } // ClangStaticAnalyzer diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnostic.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnostic.cpp index a20ed6caa8..2f626a6afd 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnostic.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnostic.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** 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 ** accordance with the Qt Enterprise License Agreement provided with the diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnostic.h b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnostic.h index dfb2f44962..4ab2e3c30d 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnostic.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnostic.h @@ -4,7 +4,7 @@ ** All rights reserved. ** 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 ** accordance with the Qt Enterprise License Agreement provided with the diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.cpp index 40f5924442..0cc4dfb9a0 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** 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 ** accordance with the Qt Enterprise License Agreement provided with the diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.h b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.h index a2dc49c26c..492624627a 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.h @@ -4,7 +4,7 @@ ** All rights reserved. ** 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 ** accordance with the Qt Enterprise License Agreement provided with the diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.cpp index f1805f2da2..a4c3fd66e3 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** 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 ** accordance with the Qt Enterprise License Agreement provided with the diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.h b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.h index 4fbdc7f866..b9b5fa6fc3 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.h @@ -4,7 +4,7 @@ ** All rights reserved. ** 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 ** accordance with the Qt Enterprise License Agreement provided with the diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerlogfilereader.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerlogfilereader.cpp index eb90543969..55f7bf0547 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerlogfilereader.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerlogfilereader.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** 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 ** accordance with the Qt Enterprise License Agreement provided with the diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerlogfilereader.h b/plugins/clangstaticanalyzer/clangstaticanalyzerlogfilereader.h index f2febffd77..f9d89d6a4b 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerlogfilereader.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerlogfilereader.h @@ -4,7 +4,7 @@ ** All rights reserved. ** 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 ** accordance with the Qt Enterprise License Agreement provided with the diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp index 6e1b2bb79a..2afd35cec3 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** 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 ** accordance with the Qt Enterprise License Agreement provided with the @@ -19,6 +19,7 @@ #include "clangstaticanalyzerplugin.h" #include "clangstaticanalyzerconfigwidget.h" +#include "clangstaticanalyzerconstants.h" #include "clangstaticanalyzerprojectsettingswidget.h" #include "clangstaticanalyzerruncontrolfactory.h" #include "clangstaticanalyzertool.h" @@ -35,9 +36,12 @@ #include <coreplugin/actionmanager/actioncontainer.h> #include <coreplugin/coreconstants.h> #include <coreplugin/dialogs/ioptionspage.h> -#include <licensechecker/licensecheckerplugin.h> #include <projectexplorer/projectpanelfactory.h> +#ifdef LICENSECHECKER +#include <licensechecker/licensecheckerplugin.h> +#endif + #include <extensionsystem/pluginmanager.h> #include <QAction> @@ -114,6 +118,7 @@ bool ClangStaticAnalyzerPlugin::initialize(const QStringList &arguments, QString panelFactory->setSimpleCreateWidgetFunction<ProjectSettingsWidget>(QIcon()); ProjectExplorer::ProjectPanelFactory::registerFactory(panelFactory); +#ifdef LICENSECHECKER LicenseChecker::LicenseCheckerPlugin *licenseChecker = ExtensionSystem::PluginManager::getObject<LicenseChecker::LicenseCheckerPlugin>(); @@ -123,8 +128,10 @@ bool ClangStaticAnalyzerPlugin::initialize(const QStringList &arguments, QString } else { qWarning() << "Invalid license, disabling Clang Static Analyzer"; } - return true; +#else // LICENSECHECKER + return initializeEnterpriseFeatures(arguments, errorString); +#endif } bool ClangStaticAnalyzerPlugin::initializeEnterpriseFeatures(const QStringList &arguments, @@ -147,7 +154,7 @@ bool ClangStaticAnalyzerPlugin::initializeEnterpriseFeatures(const QStringList & "to find bugs."); AnalyzerAction *action = new AnalyzerAction(this); - action->setRunMode(ProjectExplorer::ClangStaticAnalyzerMode); + action->setRunMode(Constants::CLANGSTATICANALYZER_RUN_MODE); action->setToolId(ClangStaticAnalyzerToolId); action->setActionId("ClangStaticAnalyzer"); action->setWidgetCreator(widgetCreator); @@ -155,7 +162,7 @@ bool ClangStaticAnalyzerPlugin::initializeEnterpriseFeatures(const QStringList & action->setCustomToolStarter([tool] { tool->startTool(); }); action->setText(tr("Clang Static Analyzer")); action->setToolTip(toolTip); - action->setMenuGroup(Constants::G_ANALYZER_TOOLS); + action->setMenuGroup(Analyzer::Constants::G_ANALYZER_TOOLS); action->setEnabled(false); AnalyzerManager::addAction(action); diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.h b/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.h index 474934e0ee..fca517e55e 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.h @@ -4,7 +4,7 @@ ** All rights reserved. ** 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 ** accordance with the Qt Enterprise License Agreement provided with the diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettings.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettings.cpp index 7ee14816be..b5a57b4410 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettings.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettings.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** 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 ** accordance with the Qt Enterprise License Agreement provided with the @@ -15,6 +15,7 @@ ** contact form at http://www.qt.io/contact-us ** ****************************************************************************/ + #include "clangstaticanalyzerprojectsettings.h" #include "clangstaticanalyzerdiagnostic.h" diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettings.h b/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettings.h index 2a993de966..a5d54f5ef7 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettings.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettings.h @@ -4,7 +4,7 @@ ** All rights reserved. ** 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 ** accordance with the Qt Enterprise License Agreement provided with the diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingsmanager.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingsmanager.cpp index 8b1637bba1..2040ac8293 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingsmanager.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingsmanager.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** 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 ** accordance with the Qt Enterprise License Agreement provided with the @@ -15,6 +15,7 @@ ** contact form at http://www.qt.io/contact-us ** ****************************************************************************/ + #include "clangstaticanalyzerprojectsettingsmanager.h" #include "clangstaticanalyzerprojectsettings.h" diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingsmanager.h b/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingsmanager.h index 97f8d79a99..9baa41a00f 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingsmanager.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingsmanager.h @@ -4,7 +4,7 @@ ** All rights reserved. ** 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 ** accordance with the Qt Enterprise License Agreement provided with the @@ -15,6 +15,7 @@ ** contact form at http://www.qt.io/contact-us ** ****************************************************************************/ + #ifndef CLANGSTATICANALYZERPROJECTSETTINGSMANAGER_H #define CLANGSTATICANALYZERPROJECTSETTINGSMANAGER_H diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingswidget.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingswidget.cpp index 580e6f750d..387b936143 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingswidget.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingswidget.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** 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 ** accordance with the Qt Enterprise License Agreement provided with the @@ -15,6 +15,7 @@ ** contact form at http://www.qt.io/contact-us ** ****************************************************************************/ + #include "clangstaticanalyzerprojectsettingswidget.h" #include "ui_clangstaticanalyzerprojectsettingswidget.h" diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingswidget.h b/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingswidget.h index 6669919736..c83fc0ce4c 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingswidget.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingswidget.h @@ -4,7 +4,7 @@ ** All rights reserved. ** 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 ** accordance with the Qt Enterprise License Agreement provided with the @@ -15,6 +15,7 @@ ** contact form at http://www.qt.io/contact-us ** ****************************************************************************/ + #ifndef CLANGSTATICANALYZERPROJECTSETTINGSWIDGET_H #define CLANGSTATICANALYZERPROJECTSETTINGSWIDGET_H diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp index 6e77de72d6..2fa5542960 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** 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 ** accordance with the Qt Enterprise License Agreement provided with the @@ -61,8 +61,6 @@ ClangStaticAnalyzerRunControl::ClangStaticAnalyzerRunControl( const ProjectInfo &projectInfo) : AnalyzerRunControl(startParams, runConfiguration) , m_projectInfo(projectInfo) - , m_toolchainType(ProjectExplorer::ToolChainKitInformation - ::toolChain(runConfiguration->target()->kit())->type()) , m_wordWidth(runConfiguration->abi().wordWidth()) , m_initialFilesToProcessSize(0) , m_filesAnalyzed(0) @@ -113,39 +111,95 @@ static QStringList tweakedArguments(const QString &filePath, return newArguments; } -static QStringList argumentsFromProjectPart(const CppTools::ProjectPart::Ptr &projectPart, - CppTools::ProjectFile::Kind fileKind, - const QString &toolchainType, - unsigned char wordWidth) +static QString createLanguageOptionMsvc(ProjectFile::Kind fileKind) { - QStringList result; - - const bool objcExt = projectPart->languageExtensions & ProjectPart::ObjectiveCExtensions; - result += CppTools::CompilerOptionsBuilder::createLanguageOption(fileKind, objcExt, - toolchainType); - result += CppTools::CompilerOptionsBuilder::createOptionsForLanguage( - projectPart->languageVersion, - projectPart->languageExtensions, false, - toolchainType); - result += CppTools::CompilerOptionsBuilder::createDefineOptions(projectPart->toolchainDefines, - false, toolchainType); - result += CppTools::CompilerOptionsBuilder::createDefineOptions(projectPart->projectDefines, - false, toolchainType); - 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; + switch (fileKind) { + case ProjectFile::CHeader: + case ProjectFile::CSource: + return QLatin1String("/TC"); + break; + case ProjectFile::CXXHeader: + case ProjectFile::CXXSource: + return QLatin1String("/TP"); + break; + default: + break; + } + return QString(); } +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( const ProjectInfo::CompilerCallData &compilerCallData, unsigned char wordWidth) @@ -169,7 +223,6 @@ static AnalyzeUnits unitsToAnalyzeFromCompilerCallData( } static AnalyzeUnits unitsToAnalyzeFromProjectParts(const QList<ProjectPart::Ptr> projectParts, - const QString &toolchainType, unsigned char wordWidth) { qCDebug(LOG) << "Taking arguments for analyzing from ProjectParts."; @@ -185,10 +238,8 @@ static AnalyzeUnits unitsToAnalyzeFromProjectParts(const QList<ProjectPart::Ptr> continue; QTC_CHECK(file.kind != ProjectFile::Unclassified); if (ProjectFile::isSource(file.kind)) { - const QStringList arguments = argumentsFromProjectPart(projectPart, - file.kind, - toolchainType, - wordWidth); + const QStringList arguments + = ClangStaticAnalyzerOptionsBuilder::build(projectPart, file.kind, wordWidth); unitsToAnalyze << AnalyzeUnit(file.path, arguments); } } @@ -205,7 +256,6 @@ AnalyzeUnits ClangStaticAnalyzerRunControl::sortedUnitsToAnalyze() const ProjectInfo::CompilerCallData compilerCallData = m_projectInfo.compilerCallData(); if (compilerCallData.isEmpty()) { units = unitsToAnalyzeFromProjectParts(m_projectInfo.projectParts(), - m_toolchainType, m_wordWidth); } else { units = unitsToAnalyzeFromCompilerCallData(compilerCallData, m_wordWidth); @@ -231,6 +281,12 @@ static QDebug operator<<(QDebug debug, const AnalyzeUnits &analyzeUnits) return debug; } +static QString toolchainType(ProjectExplorer::RunConfiguration *runConfiguration) +{ + QTC_ASSERT(runConfiguration, return QString()); + return ToolChainKitInformation::toolChain(runConfiguration->target()->kit())->type(); +} + bool ClangStaticAnalyzerRunControl::startEngine() { m_success = false; @@ -243,8 +299,8 @@ bool ClangStaticAnalyzerRunControl::startEngine() // Check clang executable bool isValidClangExecutable; - const QString executable - = clangExecutableFromSettings(m_toolchainType, &isValidClangExecutable); + const QString executable = clangExecutableFromSettings(toolchainType(runConfiguration()), + &isValidClangExecutable); if (!isValidClangExecutable) { const QString errorMessage = tr("Clang Static Analyzer: Invalid executable \"%1\", stop.") .arg(executable); diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h index 7a4729babe..f9419e21c3 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h @@ -4,7 +4,7 @@ ** All rights reserved. ** 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 ** accordance with the Qt Enterprise License Agreement provided with the @@ -71,7 +71,6 @@ private: private: const CppTools::ProjectInfo m_projectInfo; - const QString m_toolchainType; const unsigned char m_wordWidth; QString m_clangExecutable; diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp index 6531ca39a2..acc5f519e8 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** 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 ** accordance with the Qt Enterprise License Agreement provided with the @@ -18,6 +18,8 @@ #include "clangstaticanalyzerruncontrolfactory.h" +#include "clangstaticanalyzerconstants.h" + #include <analyzerbase/analyzermanager.h> #include <analyzerbase/analyzerruncontrol.h> #include <analyzerbase/analyzerstartparameters.h> @@ -51,9 +53,9 @@ ClangStaticAnalyzerRunControlFactory::ClangStaticAnalyzerRunControlFactory( } bool ClangStaticAnalyzerRunControlFactory::canRun(RunConfiguration *runConfiguration, - RunMode runMode) const + Core::Id runMode) const { - if (runMode != ClangStaticAnalyzerMode) + if (runMode != Constants::CLANGSTATICANALYZER_RUN_MODE) return false; Target *target = runConfiguration->target(); @@ -68,7 +70,7 @@ bool ClangStaticAnalyzerRunControlFactory::canRun(RunConfiguration *runConfigura } RunControl *ClangStaticAnalyzerRunControlFactory::create(RunConfiguration *runConfiguration, - RunMode runMode, + Core::Id runMode, QString *errorMessage) { using namespace CppTools; diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.h b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.h index 3d06a5e80f..68eb68e3cb 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.h @@ -4,7 +4,7 @@ ** All rights reserved. ** 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 ** accordance with the Qt Enterprise License Agreement provided with the @@ -35,10 +35,10 @@ public: QObject *parent = 0); bool canRun(ProjectExplorer::RunConfiguration *runConfiguration, - ProjectExplorer::RunMode runMode) const; + Core::Id runMode) const; ProjectExplorer::RunControl *create(ProjectExplorer::RunConfiguration *runConfiguration, - ProjectExplorer::RunMode runMode, + Core::Id runMode, QString *errorMessage); private: diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.cpp index be934bbc8c..98eba1cacd 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** 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 ** accordance with the Qt Enterprise License Agreement provided with the diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.h b/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.h index 62f8152771..6379ce8a3f 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.h @@ -4,7 +4,7 @@ ** All rights reserved. ** 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 ** accordance with the Qt Enterprise License Agreement provided with the diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzersettings.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzersettings.cpp index 774bf4941b..97c456ff81 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzersettings.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzersettings.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** 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 ** accordance with the Qt Enterprise License Agreement provided with the diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzersettings.h b/plugins/clangstaticanalyzer/clangstaticanalyzersettings.h index acd7545889..70f85d4912 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzersettings.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzersettings.h @@ -4,7 +4,7 @@ ** All rights reserved. ** 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 ** accordance with the Qt Enterprise License Agreement provided with the diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp index 38e715dfc1..959de1c597 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** 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 ** accordance with the Qt Enterprise License Agreement provided with the @@ -18,6 +18,7 @@ #include "clangstaticanalyzertool.h" +#include "clangstaticanalyzerconstants.h" #include "clangstaticanalyzerdiagnosticmodel.h" #include "clangstaticanalyzerdiagnosticview.h" #include "clangstaticanalyzerruncontrol.h" @@ -249,7 +250,7 @@ void ClangStaticAnalyzerTool::startTool() connect(SessionManager::instance(), &SessionManager::aboutToRemoveProject, this, onProjectRemoved, Qt::UniqueConnection); } - ProjectExplorerPlugin::runRunConfiguration(rc, ProjectExplorer::ClangStaticAnalyzerMode); + ProjectExplorerPlugin::runRunConfiguration(rc, Constants::CLANGSTATICANALYZER_RUN_MODE); } CppTools::ProjectInfo ClangStaticAnalyzerTool::projectInfoBeforeBuild() const diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzertool.h b/plugins/clangstaticanalyzer/clangstaticanalyzertool.h index 24bf7dbd12..3cc1ff1865 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzertool.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzertool.h @@ -4,7 +4,7 @@ ** All rights reserved. ** 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 ** accordance with the Qt Enterprise License Agreement provided with the diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.cpp index e375a0f646..faa2190726 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** 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 ** accordance with the Qt Enterprise License Agreement provided with the @@ -82,8 +82,7 @@ void ClangStaticAnalyzerUnitTests::testProject() CppTools::Tests::ProjectOpenerAndCloser projectManager; const CppTools::ProjectInfo projectInfo = projectManager.open(projectFilePath, true); QVERIFY(projectInfo.isValid()); - AnalyzerManager::selectTool(ClangStaticAnalyzerToolId); - AnalyzerManager::startTool(); + AnalyzerManager::selectAction(ClangStaticAnalyzerToolId, /* alsoRunIt = */ true); QSignalSpy waiter(m_analyzerTool, SIGNAL(finished(bool))); QVERIFY(waiter.wait(30000)); const QList<QVariant> arguments = waiter.takeFirst(); diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.h b/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.h index bbf9cc88f6..cd63b51d84 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.h @@ -4,7 +4,7 @@ ** All rights reserved. ** 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 ** accordance with the Qt Enterprise License Agreement provided with the diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerutils.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerutils.cpp index 3860f929a6..65a5bb0a65 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerutils.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerutils.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** 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 ** accordance with the Qt Enterprise License Agreement provided with the diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerutils.h b/plugins/clangstaticanalyzer/clangstaticanalyzerutils.h index ca06c4874e..38485e8210 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerutils.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerutils.h @@ -4,7 +4,7 @@ ** All rights reserved. ** 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 ** accordance with the Qt Enterprise License Agreement provided with the diff --git a/plugins/clangstaticanalyzer/tests/clangstaticanalyzerlogfilereader/tst_clangstaticanalyzerlogfilereader.cpp b/plugins/clangstaticanalyzer/tests/clangstaticanalyzerlogfilereader/tst_clangstaticanalyzerlogfilereader.cpp index 89547adcaa..ebd0e5ab00 100644 --- a/plugins/clangstaticanalyzer/tests/clangstaticanalyzerlogfilereader/tst_clangstaticanalyzerlogfilereader.cpp +++ b/plugins/clangstaticanalyzer/tests/clangstaticanalyzerlogfilereader/tst_clangstaticanalyzerlogfilereader.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** 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 ** accordance with the Qt Enterprise License Agreement provided with the diff --git a/plugins/clangstaticanalyzer/tests/clangstaticanalyzerrunner/tst_clangstaticanalyzerrunner.cpp b/plugins/clangstaticanalyzer/tests/clangstaticanalyzerrunner/tst_clangstaticanalyzerrunner.cpp index 53d31b1d7e..95bab274b8 100644 --- a/plugins/clangstaticanalyzer/tests/clangstaticanalyzerrunner/tst_clangstaticanalyzerrunner.cpp +++ b/plugins/clangstaticanalyzer/tests/clangstaticanalyzerrunner/tst_clangstaticanalyzerrunner.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** 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 ** accordance with the Qt Enterprise License Agreement provided with the |