From bd3195ec6bb96379c59079627da39b2db297bb4a Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Tue, 23 Jun 2015 09:24:54 +0200 Subject: Adapt to upstream API change in AnalyzerManager Change-Id: Ibc1748db410d99d2b1d58ca3af535c629b0593f0 Reviewed-by: Andre Poenitz --- plugins/clangstaticanalyzer/clangstaticanalyzerunittests.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.cpp index e375a0f646..a4611c6ef7 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.cpp @@ -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 arguments = waiter.takeFirst(); -- cgit v1.2.1 From d49232bbf122f9b65e9a1c25d296cdb9d130d4dd Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Thu, 11 Jun 2015 17:29:00 +0200 Subject: Make licensechecker dependency optional Change-Id: Ie867d2da37a507d36caaf16494f996b88ca4e142 Reviewed-by: Christian Kandeler --- plugins/clangstaticanalyzer/clangstaticanalyzer.pro | 2 ++ .../clangstaticanalyzer/clangstaticanalyzer_dependencies.pri | 5 +++-- plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp | 10 ++++++++-- 3 files changed, 13 insertions(+), 4 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_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/clangstaticanalyzerplugin.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp index 6e1b2bb79a..6668bfe9de 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp @@ -35,9 +35,12 @@ #include #include #include -#include #include +#ifdef LICENSECHECKER +#include +#endif + #include #include @@ -114,6 +117,7 @@ bool ClangStaticAnalyzerPlugin::initialize(const QStringList &arguments, QString panelFactory->setSimpleCreateWidgetFunction(QIcon()); ProjectExplorer::ProjectPanelFactory::registerFactory(panelFactory); +#ifdef LICENSECHECKER LicenseChecker::LicenseCheckerPlugin *licenseChecker = ExtensionSystem::PluginManager::getObject(); @@ -123,8 +127,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, -- cgit v1.2.1 From 44f0bb287c577169b408fb5833bf9583799487ae Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Thu, 25 Jun 2015 14:17:11 +0200 Subject: Adapt to upstream API change in CompilerOptionsBuilder Change-Id: I895e8a32ca8adc1c5f1b4791a3fcc5f18c5078ab Reviewed-by: Christian Kandeler --- .../clangstaticanalyzerruncontrol.cpp | 32 +++++++--------------- 1 file changed, 10 insertions(+), 22 deletions(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp index 6e77de72d6..9281673bec 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp @@ -118,32 +118,20 @@ static QStringList argumentsFromProjectPart(const CppTools::ProjectPart::Ptr &pr const QString &toolchainType, unsigned char wordWidth) { - 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); + CompilerOptionsBuilder optionsBuilder(projectPart); + optionsBuilder.addLanguageOption(fileKind, toolchainType); + optionsBuilder.addOptionsForLanguage(false, toolchainType); + optionsBuilder.addToolchainAndProjectDefines(toolchainType); + optionsBuilder.addHeaderPathOptions(CompilerOptionsBuilder::IsBlackListed(), toolchainType); if (toolchainType == QLatin1String("msvc")) - result += QLatin1String("/EHsc"); // clang-cl does not understand exceptions + optionsBuilder.add(QLatin1String("/EHsc")); // clang-cl does not understand exceptions else - result += QLatin1String("-fPIC"); // TODO: Remove? + optionsBuilder.add(QLatin1String("-fPIC")); // TODO: Remove? - prependWordWidthArgumentIfNotIncluded(&result, wordWidth); - - return result; + QStringList options = optionsBuilder.options(); + prependWordWidthArgumentIfNotIncluded(&options, wordWidth); + return options; } static AnalyzeUnits unitsToAnalyzeFromCompilerCallData( -- cgit v1.2.1 From 3529df2e6e468faf9d5bf113d7c4c45f647368f8 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Thu, 25 Jun 2015 17:29:41 +0200 Subject: Fix license header Change-Id: I017092613cdec7c00736442c10ca80b3c74f0189 Reviewed-by: Christian Kandeler --- plugins/clangstaticanalyzer/clangstaticanalyzer_global.h | 2 +- plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.cpp | 2 +- plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.h | 2 +- plugins/clangstaticanalyzer/clangstaticanalyzerconstants.h | 2 +- plugins/clangstaticanalyzer/clangstaticanalyzerdiagnostic.cpp | 2 +- plugins/clangstaticanalyzer/clangstaticanalyzerdiagnostic.h | 2 +- plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.cpp | 2 +- plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.h | 2 +- plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.cpp | 2 +- plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.h | 2 +- plugins/clangstaticanalyzer/clangstaticanalyzerlogfilereader.cpp | 2 +- plugins/clangstaticanalyzer/clangstaticanalyzerlogfilereader.h | 2 +- plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp | 2 +- plugins/clangstaticanalyzer/clangstaticanalyzerplugin.h | 2 +- plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettings.cpp | 3 ++- plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettings.h | 2 +- .../clangstaticanalyzer/clangstaticanalyzerprojectsettingsmanager.cpp | 3 ++- .../clangstaticanalyzer/clangstaticanalyzerprojectsettingsmanager.h | 3 ++- .../clangstaticanalyzer/clangstaticanalyzerprojectsettingswidget.cpp | 3 ++- plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingswidget.h | 3 ++- plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp | 2 +- plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h | 2 +- plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp | 2 +- plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.h | 2 +- plugins/clangstaticanalyzer/clangstaticanalyzerrunner.cpp | 2 +- plugins/clangstaticanalyzer/clangstaticanalyzerrunner.h | 2 +- plugins/clangstaticanalyzer/clangstaticanalyzersettings.cpp | 2 +- plugins/clangstaticanalyzer/clangstaticanalyzersettings.h | 2 +- plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp | 2 +- plugins/clangstaticanalyzer/clangstaticanalyzertool.h | 2 +- plugins/clangstaticanalyzer/clangstaticanalyzerunittests.cpp | 2 +- plugins/clangstaticanalyzer/clangstaticanalyzerunittests.h | 2 +- plugins/clangstaticanalyzer/clangstaticanalyzerutils.cpp | 2 +- plugins/clangstaticanalyzer/clangstaticanalyzerutils.h | 2 +- .../tst_clangstaticanalyzerlogfilereader.cpp | 2 +- .../tests/clangstaticanalyzerrunner/tst_clangstaticanalyzerrunner.cpp | 2 +- 36 files changed, 41 insertions(+), 36 deletions(-) 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..b8fb5cfa47 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 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..0a0e734a7b 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 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 6668bfe9de..f31e7c3298 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 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 9281673bec..35590e8284 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 diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h index 7a4729babe..f9456df30a 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 diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp index 6531ca39a2..81a8c21ec1 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 diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.h b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.h index 3d06a5e80f..9afd9f9f5c 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 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..e6181c01e5 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 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 a4611c6ef7..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 ** -** 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/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 ** -** 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 -- cgit v1.2.1 From 73ec42f62399601938026612692a3969965ed3ec Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Wed, 24 Jun 2015 16:00:44 +0200 Subject: qbs build: Soft dependency on LicenseChecker. Change-Id: Ia74c556155f5c0c0344cabf4ba13b36e31430c68 Reviewed-by: Christian Stenger --- plugins/clangstaticanalyzer/clangstaticanalyzer.qbs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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" } -- cgit v1.2.1 From c26e6e398bc3e924b7dddb4e48b7c379f8a9b539 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Fri, 26 Jun 2015 09:15:51 +0200 Subject: Settings widget: Make sure initial path is also validated. Without this patch, validation kicks in only on user input. Change-Id: I791c45b214e7e171f59c66c7d96f3e85a668427e Reviewed-by: Nikolai Kosjar --- plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.cpp index b8fb5cfa47..6bc81cac64 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.cpp @@ -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); }); -- cgit v1.2.1 From fafb0cb8d46b9a1515d3913129785428e599fd80 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Fri, 26 Jun 2015 13:53:50 +0200 Subject: Adapt to upstream API change in CompilerOptionsBuilder II Change-Id: I196b69846e22136773cf3cbf463a413d840dc4d2 Reviewed-by: Christian Kandeler --- .../clangstaticanalyzerruncontrol.cpp | 142 +++++++++++++++++---- .../clangstaticanalyzerruncontrol.h | 1 - 2 files changed, 114 insertions(+), 29 deletions(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp index 35590e8284..0a1e65676a 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp @@ -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,27 +111,113 @@ 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) { - CompilerOptionsBuilder optionsBuilder(projectPart); - optionsBuilder.addLanguageOption(fileKind, toolchainType); - optionsBuilder.addOptionsForLanguage(false, toolchainType); - optionsBuilder.addToolchainAndProjectDefines(toolchainType); - optionsBuilder.addHeaderPathOptions(CompilerOptionsBuilder::IsBlackListed(), toolchainType); - - if (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; + 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(); + } + + bool excludeDefineLine(const QByteArray &defineLine) const override + { + if (CompilerOptionsBuilder::excludeDefineLine(defineLine)) + return true; + + // gcc 4.9 has: + // #define __has_include(STR) __has_include__(STR) + // #define __has_include_next(STR) __has_include_next__(STR) + // The right-hand sides are gcc built-ins that clang does not understand, and they'd + // override clang's own (non-macro, it seems) definitions of the symbols on the left-hand + // side. + const bool isGccToolchain = m_projectPart->toolchainType == QLatin1String("gcc"); + if (isGccToolchain && defineLine.contains("has_include")) + return true; + + return false; + } + +private: + bool m_isMsvcToolchain; +}; + static AnalyzeUnits unitsToAnalyzeFromCompilerCallData( const ProjectInfo::CompilerCallData &compilerCallData, unsigned char wordWidth) @@ -157,7 +241,6 @@ static AnalyzeUnits unitsToAnalyzeFromCompilerCallData( } static AnalyzeUnits unitsToAnalyzeFromProjectParts(const QList projectParts, - const QString &toolchainType, unsigned char wordWidth) { qCDebug(LOG) << "Taking arguments for analyzing from ProjectParts."; @@ -173,10 +256,8 @@ static AnalyzeUnits unitsToAnalyzeFromProjectParts(const QList 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); } } @@ -193,7 +274,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); @@ -219,6 +299,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; @@ -231,8 +317,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 f9456df30a..f9419e21c3 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h @@ -71,7 +71,6 @@ private: private: const CppTools::ProjectInfo m_projectInfo; - const QString m_toolchainType; const unsigned char m_wordWidth; QString m_clangExecutable; -- cgit v1.2.1 From 33ee3ffcca22f08fe8de88504cc2c689ca1b2025 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Mon, 29 Jun 2015 13:16:07 +0200 Subject: Adapt to upstream API change in CompilerOptionsBuilder III excludeDefineLine() can go since the relevant check is now in the base class (again). Change-Id: I572586cc8b52cdd3479b84c677149e3c10a6b804 Reviewed-by: Christian Kandeler --- .../clangstaticanalyzerruncontrol.cpp | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp index 0a1e65676a..2fa5542960 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp @@ -196,24 +196,6 @@ private: return CompilerOptionsBuilder::defineOption(); } - bool excludeDefineLine(const QByteArray &defineLine) const override - { - if (CompilerOptionsBuilder::excludeDefineLine(defineLine)) - return true; - - // gcc 4.9 has: - // #define __has_include(STR) __has_include__(STR) - // #define __has_include_next(STR) __has_include_next__(STR) - // The right-hand sides are gcc built-ins that clang does not understand, and they'd - // override clang's own (non-macro, it seems) definitions of the symbols on the left-hand - // side. - const bool isGccToolchain = m_projectPart->toolchainType == QLatin1String("gcc"); - if (isGccToolchain && defineLine.contains("has_include")) - return true; - - return false; - } - private: bool m_isMsvcToolchain; }; -- cgit v1.2.1 From 39613b3b084d16c056ea22ea327712f4c05f5437 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Tue, 30 Jun 2015 10:56:56 +0200 Subject: Adapt to changes to run mode Change-Id: I9e299d6fa49920ffa98ececb5b96e9512055ba34 Reviewed-by: Nikolai Kosjar --- plugins/clangstaticanalyzer/clangstaticanalyzerconstants.h | 1 + plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp | 5 +++-- .../clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp | 8 +++++--- .../clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.h | 4 ++-- plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp | 3 ++- 5 files changed, 13 insertions(+), 8 deletions(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerconstants.h b/plugins/clangstaticanalyzer/clangstaticanalyzerconstants.h index 0a0e734a7b..1114730614 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerconstants.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerconstants.h @@ -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/clangstaticanalyzerplugin.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp index f31e7c3298..2afd35cec3 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp @@ -19,6 +19,7 @@ #include "clangstaticanalyzerplugin.h" #include "clangstaticanalyzerconfigwidget.h" +#include "clangstaticanalyzerconstants.h" #include "clangstaticanalyzerprojectsettingswidget.h" #include "clangstaticanalyzerruncontrolfactory.h" #include "clangstaticanalyzertool.h" @@ -153,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); @@ -161,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/clangstaticanalyzerruncontrolfactory.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp index 81a8c21ec1..acc5f519e8 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp @@ -18,6 +18,8 @@ #include "clangstaticanalyzerruncontrolfactory.h" +#include "clangstaticanalyzerconstants.h" + #include #include #include @@ -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 9afd9f9f5c..68eb68e3cb 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.h @@ -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/clangstaticanalyzertool.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp index e6181c01e5..959de1c597 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp @@ -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 -- cgit v1.2.1