From b3e07a53dbaa3ae9c89971da6ac2eaf044faf4c5 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 15 Oct 2014 11:36:09 +0200 Subject: [PATCH 001/111] Initial commit From b9f9eb7ae5d84c2b1200becc66680a4a8cda9e94 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Thu, 25 Sep 2014 11:11:58 +0200 Subject: [PATCH 002/111] Import Clang Static Analyzer plugin This plugin adds "Clang Static Analyzer" to the Analyze mode, which processes all implementation/source project files of the current project. For this, it will call the clang executable for each file. The found diagnostics will be displayed in a view similar to the one used in "Valgrind Memory Analyzer". The user can specify the clang executable to use and the number of concurrent processes to launch in Menu: Tools > Options > Analyzer > Clang Static Analyzer. Main TODOs: * Fiddle around the appropriate command line options, currently only defines and include paths are passed on. * Tests on Windows / OS X. * Remove dependency to clangcodemodel by moving the functions that create command line arguments to CppTools. Mostly they are not even specific to clang (but would also work with gcc). * Maybe limit to a range of tested clang versions. * How to deal with directory containing all the log files after the user starts a new run or Creator is shut down? (delete it? leave it there? make it configurable?). * Find out how to properly integrate the tests. Imaginable future additions: * Adding a button to load result/log files from a directory, e.g. if the user used the 'scan-build' approach. * Adding a button with a filter menu in order to display only diagnostics from certain categories, similar to "Valgrind Memory Analyzer". Change-Id: I6aeb5dfdbdfa239a06c03dd8759a983df71b77ea Reviewed-by: Eike Ziller --- .gitignore | 2 + clangstaticanalyzer.pro | 6 + .../ClangStaticAnalyzer.json.in | 15 + .../clangstaticanalyzer.pro | 42 ++ .../clangstaticanalyzer_dependencies.pri | 9 + .../clangstaticanalyzer_global.h | 31 ++ .../clangstaticanalyzerconfigwidget.cpp | 58 +++ .../clangstaticanalyzerconfigwidget.h | 48 +++ .../clangstaticanalyzerconfigwidget.ui | 99 +++++ .../clangstaticanalyzerconstants.h | 31 ++ .../clangstaticanalyzerdiagnostic.cpp | 50 +++ .../clangstaticanalyzerdiagnostic.h | 73 ++++ .../clangstaticanalyzerdiagnosticmodel.cpp | 121 ++++++ .../clangstaticanalyzerdiagnosticmodel.h | 50 +++ .../clangstaticanalyzerdiagnosticview.cpp | 223 +++++++++++ .../clangstaticanalyzerdiagnosticview.h | 43 ++ .../clangstaticanalyzerlogfilereader.cpp | 374 ++++++++++++++++++ .../clangstaticanalyzerlogfilereader.h | 38 ++ .../clangstaticanalyzerplugin.cpp | 161 ++++++++ .../clangstaticanalyzerplugin.h | 52 +++ .../clangstaticanalyzerruncontrol.cpp | 235 +++++++++++ .../clangstaticanalyzerruncontrol.h | 81 ++++ .../clangstaticanalyzerruncontrolfactory.cpp | 62 +++ .../clangstaticanalyzerruncontrolfactory.h | 45 +++ .../clangstaticanalyzerrunner.cpp | 165 ++++++++ .../clangstaticanalyzerrunner.h | 71 ++++ .../clangstaticanalyzersettings.cpp | 98 +++++ .../clangstaticanalyzersettings.h | 54 +++ .../clangstaticanalyzertool.cpp | 187 +++++++++ .../clangstaticanalyzertool.h | 63 +++ .../clangstaticanalyzerutils.cpp | 75 ++++ .../clangstaticanalyzerutils.h | 43 ++ .../clangstaticanalyzerlogfilereader.pro | 14 + .../data/noDiagnostics.plist | 14 + .../data/someDiagnostics.plist | 162 ++++++++ .../tst_clangstaticanalyzerlogfilereader.cpp | 175 ++++++++ .../clangstaticanalyzerrunner.pro | 11 + .../tst_clangstaticanalyzerrunner.cpp | 167 ++++++++ plugins/clangstaticanalyzer/tests/tests.pri | 21 + plugins/clangstaticanalyzer/tests/tests.pro | 6 + qtcreatorlibrary.pri | 7 + qtcreatorplugin.pri | 8 + 42 files changed, 3290 insertions(+) create mode 100644 .gitignore create mode 100644 clangstaticanalyzer.pro create mode 100644 plugins/clangstaticanalyzer/ClangStaticAnalyzer.json.in create mode 100644 plugins/clangstaticanalyzer/clangstaticanalyzer.pro create mode 100644 plugins/clangstaticanalyzer/clangstaticanalyzer_dependencies.pri create mode 100644 plugins/clangstaticanalyzer/clangstaticanalyzer_global.h create mode 100644 plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.cpp create mode 100644 plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.h create mode 100644 plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.ui create mode 100644 plugins/clangstaticanalyzer/clangstaticanalyzerconstants.h create mode 100644 plugins/clangstaticanalyzer/clangstaticanalyzerdiagnostic.cpp create mode 100644 plugins/clangstaticanalyzer/clangstaticanalyzerdiagnostic.h create mode 100644 plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.cpp create mode 100644 plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.h create mode 100644 plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.cpp create mode 100644 plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.h create mode 100644 plugins/clangstaticanalyzer/clangstaticanalyzerlogfilereader.cpp create mode 100644 plugins/clangstaticanalyzer/clangstaticanalyzerlogfilereader.h create mode 100644 plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp create mode 100644 plugins/clangstaticanalyzer/clangstaticanalyzerplugin.h create mode 100644 plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp create mode 100644 plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h create mode 100644 plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp create mode 100644 plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.h create mode 100644 plugins/clangstaticanalyzer/clangstaticanalyzerrunner.cpp create mode 100644 plugins/clangstaticanalyzer/clangstaticanalyzerrunner.h create mode 100644 plugins/clangstaticanalyzer/clangstaticanalyzersettings.cpp create mode 100644 plugins/clangstaticanalyzer/clangstaticanalyzersettings.h create mode 100644 plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp create mode 100644 plugins/clangstaticanalyzer/clangstaticanalyzertool.h create mode 100644 plugins/clangstaticanalyzer/clangstaticanalyzerutils.cpp create mode 100644 plugins/clangstaticanalyzer/clangstaticanalyzerutils.h create mode 100644 plugins/clangstaticanalyzer/tests/clangstaticanalyzerlogfilereader/clangstaticanalyzerlogfilereader.pro create mode 100644 plugins/clangstaticanalyzer/tests/clangstaticanalyzerlogfilereader/data/noDiagnostics.plist create mode 100644 plugins/clangstaticanalyzer/tests/clangstaticanalyzerlogfilereader/data/someDiagnostics.plist create mode 100644 plugins/clangstaticanalyzer/tests/clangstaticanalyzerlogfilereader/tst_clangstaticanalyzerlogfilereader.cpp create mode 100644 plugins/clangstaticanalyzer/tests/clangstaticanalyzerrunner/clangstaticanalyzerrunner.pro create mode 100644 plugins/clangstaticanalyzer/tests/clangstaticanalyzerrunner/tst_clangstaticanalyzerrunner.cpp create mode 100644 plugins/clangstaticanalyzer/tests/tests.pri create mode 100644 plugins/clangstaticanalyzer/tests/tests.pro create mode 100644 qtcreatorlibrary.pri create mode 100644 qtcreatorplugin.pri diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000000..444078f3cdf --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*.pro.user + diff --git a/clangstaticanalyzer.pro b/clangstaticanalyzer.pro new file mode 100644 index 00000000000..5a433f2bd4e --- /dev/null +++ b/clangstaticanalyzer.pro @@ -0,0 +1,6 @@ +TEMPLATE = subdirs +CONFIG += ordered + +SUBDIRS += plugins/clangstaticanalyzer + +QMAKE_EXTRA_TARGETS = docs install_docs # dummy targets for consistency diff --git a/plugins/clangstaticanalyzer/ClangStaticAnalyzer.json.in b/plugins/clangstaticanalyzer/ClangStaticAnalyzer.json.in new file mode 100644 index 00000000000..0203fe1f027 --- /dev/null +++ b/plugins/clangstaticanalyzer/ClangStaticAnalyzer.json.in @@ -0,0 +1,15 @@ +{ + \"Name\" : \"ClangStaticAnalyzer\", + \"Version\" : \"$$QTCREATOR_VERSION\", + \"CompatVersion\" : \"$$QTCREATOR_COMPAT_VERSION\", + \"Vendor\" : \"Digia Plc\", + \"Copyright\" : \"(C) 2014 Digia Plc\", + \"License\" : [ \"Commercial Usage\", + \"\", + \"Licensees holding valid Qt Commercial licenses may use this plugin in accordance with the Qt Commercial License Agreement provided with the Software or, alternatively, in accordance with the terms contained in a written agreement between you and Digia.\" + ], + \"Category\" : \"Code Analyzer\", + \"Description\" : \"ClangStaticAnalyzer Plugin.\", + \"Url\" : \"http://qt.digia.com\", + $$dependencyList +} diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzer.pro b/plugins/clangstaticanalyzer/clangstaticanalyzer.pro new file mode 100644 index 00000000000..22c94b2bf6f --- /dev/null +++ b/plugins/clangstaticanalyzer/clangstaticanalyzer.pro @@ -0,0 +1,42 @@ +TARGET = ClangStaticAnalyzer +TEMPLATE = lib + +PROVIDER = Digia +include(../../qtcreatorplugin.pri) +include(clangstaticanalyzer_dependencies.pri) + +SOURCES += \ + clangstaticanalyzerconfigwidget.cpp \ + clangstaticanalyzerdiagnostic.cpp \ + clangstaticanalyzerdiagnosticmodel.cpp \ + clangstaticanalyzerdiagnosticview.cpp \ + clangstaticanalyzerlogfilereader.cpp \ + clangstaticanalyzerplugin.cpp \ + clangstaticanalyzerruncontrol.cpp \ + clangstaticanalyzerruncontrolfactory.cpp \ + clangstaticanalyzerrunner.cpp \ + clangstaticanalyzersettings.cpp \ + clangstaticanalyzertool.cpp \ + clangstaticanalyzerutils.cpp + +HEADERS += \ + clangstaticanalyzerconfigwidget.h \ + clangstaticanalyzerconstants.h \ + clangstaticanalyzerdiagnostic.h \ + clangstaticanalyzerdiagnosticmodel.h \ + clangstaticanalyzerdiagnosticview.h \ + clangstaticanalyzer_global.h \ + clangstaticanalyzerlogfilereader.h \ + clangstaticanalyzerplugin.h \ + clangstaticanalyzerruncontrolfactory.h \ + clangstaticanalyzerruncontrol.h \ + clangstaticanalyzerrunner.h \ + clangstaticanalyzersettings.h \ + clangstaticanalyzertool.h \ + clangstaticanalyzerutils.h + +FORMS += \ + clangstaticanalyzerconfigwidget.ui + +DISTFILES += \ + tests/tests.pri diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzer_dependencies.pri b/plugins/clangstaticanalyzer/clangstaticanalyzer_dependencies.pri new file mode 100644 index 00000000000..8579739916a --- /dev/null +++ b/plugins/clangstaticanalyzer/clangstaticanalyzer_dependencies.pri @@ -0,0 +1,9 @@ +QTC_PLUGIN_NAME = ClangStaticAnalyzer +QTC_LIB_DEPENDS += \ + extensionsystem \ + utils +QTC_PLUGIN_DEPENDS += \ + analyzerbase \ + clangcodemodel \ + cpptools \ + licensechecker diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzer_global.h b/plugins/clangstaticanalyzer/clangstaticanalyzer_global.h new file mode 100644 index 00000000000..a3fc0a8b852 --- /dev/null +++ b/plugins/clangstaticanalyzer/clangstaticanalyzer_global.h @@ -0,0 +1,31 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc +** 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. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** +****************************************************************************/ + +#ifndef CLANGSTATICANALYZER_GLOBAL_H +#define CLANGSTATICANALYZER_GLOBAL_H + +#include + +#if defined(CLANGSTATICANALYZER_LIBRARY) +# define CLANGSTATICANALYZER_EXPORT Q_DECL_EXPORT +#else +# define CLANGSTATICANALYZER_EXPORT Q_DECL_IMPORT +#endif + +#endif // CLANGSTATICANALYZER_GLOBAL_H + diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.cpp new file mode 100644 index 00000000000..c0ae86af94a --- /dev/null +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.cpp @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc +** 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 LicenseChecker Add-on. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** +****************************************************************************/ + +#include "clangstaticanalyzerconfigwidget.h" +#include "ui_clangstaticanalyzerconfigwidget.h" + +#include + +namespace ClangStaticAnalyzer { +namespace Internal { + +ClangStaticAnalyzerConfigWidget::ClangStaticAnalyzerConfigWidget( + ClangStaticAnalyzerSettings *settings, + QWidget *parent) + : QWidget(parent) + , m_ui(new Ui::ClangStaticAnalyzerConfigWidget) + , m_settings(settings) +{ + m_ui->setupUi(this); + + m_ui->clangExecutableChooser->setExpectedKind(Utils::PathChooser::ExistingCommand); + m_ui->clangExecutableChooser->setHistoryCompleter( + QLatin1String("ClangStaticAnalyzer.ClangCommand.History")); + m_ui->clangExecutableChooser->setPromptDialogTitle(tr("Clang Command")); + m_ui->clangExecutableChooser->setPath(settings->clangExecutable()); + connect(m_ui->clangExecutableChooser, &Utils::PathChooser::changed, + m_settings, &ClangStaticAnalyzerSettings::setClangExecutable); + + m_ui->simultaneousProccessesSpinBox->setValue(settings->simultaneousProcesses()); + m_ui->simultaneousProccessesSpinBox->setMinimum(1); + m_ui->simultaneousProccessesSpinBox->setMaximum(QThread::idealThreadCount()); + connect(m_ui->simultaneousProccessesSpinBox, + static_cast(&QSpinBox::valueChanged), + m_settings, &ClangStaticAnalyzerSettings::setSimultaneousProcesses); +} + +ClangStaticAnalyzerConfigWidget::~ClangStaticAnalyzerConfigWidget() +{ + delete m_ui; +} + +} // namespace Internal +} // namespace ClangStaticAnalyzer diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.h b/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.h new file mode 100644 index 00000000000..939766622af --- /dev/null +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.h @@ -0,0 +1,48 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc +** 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 LicenseChecker Add-on. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** +****************************************************************************/ + +#ifndef CLANGSTATICANALYZERCONFIGWIDGET_H +#define CLANGSTATICANALYZERCONFIGWIDGET_H + +#include "clangstaticanalyzersettings.h" + +#include + +namespace ClangStaticAnalyzer { +namespace Internal { + +namespace Ui { class ClangStaticAnalyzerConfigWidget; } + +class ClangStaticAnalyzerConfigWidget : public QWidget +{ + Q_OBJECT + +public: + explicit ClangStaticAnalyzerConfigWidget(ClangStaticAnalyzerSettings *settings, + QWidget *parent = 0); + ~ClangStaticAnalyzerConfigWidget(); + +private: + Ui::ClangStaticAnalyzerConfigWidget *m_ui; + ClangStaticAnalyzerSettings *m_settings; +}; + +} // namespace Internal +} // namespace ClangStaticAnalyzer + +#endif // CLANGSTATICANALYZERCONFIGWIDGET_H diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.ui b/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.ui new file mode 100644 index 00000000000..800733a3317 --- /dev/null +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.ui @@ -0,0 +1,99 @@ + + + ClangStaticAnalyzer::Internal::ClangStaticAnalyzerConfigWidget + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + + General + + + + + + Clang executable: + + + + + + + + + + + + + + Simultaneous processes: + + + + + + + + + 1 + + + 32 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + Qt::Vertical + + + + 20 + 183 + + + + + + + + + Utils::PathChooser + QWidget +
utils/pathchooser.h
+ 1 +
+
+ + +
diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerconstants.h b/plugins/clangstaticanalyzer/clangstaticanalyzerconstants.h new file mode 100644 index 00000000000..85a05087a61 --- /dev/null +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerconstants.h @@ -0,0 +1,31 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc +** 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 LicenseChecker Add-on. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** +****************************************************************************/ + +#ifndef CLANGSTATICANALYZERCONSTANTS_H +#define CLANGSTATICANALYZERCONSTANTS_H + +namespace ClangStaticAnalyzer { +namespace Constants { + +const char CLANG_EXECUTABLE_BASE_NAME[] = "clang"; +const char SETTINGS_ID[] = "ClangStaticAnalyzer"; + +} // Constants +} // ClangStaticAnalyzer + +#endif // CLANGSTATICANALYZERCONSTANTS_H diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnostic.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnostic.cpp new file mode 100644 index 00000000000..e9152ffa47e --- /dev/null +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnostic.cpp @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc +** 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 LicenseChecker Add-on. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** +****************************************************************************/ + +#include "clangstaticanalyzerdiagnostic.h" + +namespace ClangStaticAnalyzer { +namespace Internal { + +Location::Location() + : line(0), column(0) +{ +} + +Location::Location(const QString &filePath, int line, int column) + : filePath(filePath), line(line), column(column) +{ +} + +bool Location::isValid() const +{ + return !filePath.isEmpty() && line >= 0 && column >= 0; +} + +ExplainingStep::ExplainingStep() + : depth(0) +{ +} + +bool ExplainingStep::isValid() const +{ + return location.isValid() && !ranges.isEmpty() && !message.isEmpty(); +} + +} // namespace Internal +} // namespace ClangStaticAnalyzer diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnostic.h b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnostic.h new file mode 100644 index 00000000000..3348cfa416d --- /dev/null +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnostic.h @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc +** 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 LicenseChecker Add-on. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** +****************************************************************************/ + +#ifndef CLANGSTATICANALZYERDIAGNOSTIC_H +#define CLANGSTATICANALZYERDIAGNOSTIC_H + +#include +#include +#include + +namespace ClangStaticAnalyzer { +namespace Internal { + +class Location +{ +public: + Location(); + Location(const QString &filePath, int line, int column); + + bool isValid() const; + + QString filePath; + int line; + int column; +}; + +class ExplainingStep +{ +public: + ExplainingStep(); + + bool isValid() const; + + QString message; + QString extendedMessage; + Location location; + QList ranges; + int depth; +}; + +class Diagnostic +{ +public: + QString description; + QString category; + QString type; + QString issueContextKind; + QString issueContext; + Location location; + QList explainingSteps; +}; + +} // namespace Internal +} // namespace ClangStaticAnalyzer + +Q_DECLARE_METATYPE(ClangStaticAnalyzer::Internal::Diagnostic) + +#endif // CLANGSTATICANALZYERDIAGNOSTIC_H diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.cpp new file mode 100644 index 00000000000..2318c50c05b --- /dev/null +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.cpp @@ -0,0 +1,121 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc +** 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 LicenseChecker Add-on. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** +****************************************************************************/ + +#include "clangstaticanalyzerdiagnosticmodel.h" + +#include "clangstaticanalyzerutils.h" + +#include + +namespace ClangStaticAnalyzer { +namespace Internal { + +ClangStaticAnalyzerDiagnosticModel::ClangStaticAnalyzerDiagnosticModel(QObject *parent) + : QAbstractListModel(parent) +{ +} + +void ClangStaticAnalyzerDiagnosticModel::addDiagnostics(const QList &diagnostics) +{ + beginInsertRows(QModelIndex(), m_diagnostics.size(), + m_diagnostics.size() + diagnostics.size() - 1 ); + m_diagnostics += diagnostics; + endInsertRows(); +} + +void ClangStaticAnalyzerDiagnosticModel::clear() +{ + beginResetModel(); + m_diagnostics.clear(); + endResetModel(); +} + +int ClangStaticAnalyzerDiagnosticModel::rowCount(const QModelIndex &parent) const +{ + return parent.isValid() ? 0 : m_diagnostics.count(); +} + +static QString createDiagnosticToolTipString(const Diagnostic &diagnostic) +{ + typedef QPair StringPair; + QList lines; + + if (!diagnostic.category.isEmpty()) { + lines << qMakePair( + QCoreApplication::translate("ClangStaticAnalyzer::Diagnostic", "Category:"), + diagnostic.category); + } + + if (!diagnostic.type.isEmpty()) { + lines << qMakePair( + QCoreApplication::translate("ClangStaticAnalyzer::Diagnostic", "Type:"), + diagnostic.type); + } + + if (!diagnostic.issueContext.isEmpty() && !diagnostic.issueContextKind.isEmpty()) { + lines << qMakePair( + QCoreApplication::translate("ClangStaticAnalyzer::Diagnostic", "Context:"), + diagnostic.issueContextKind + QLatin1Char(' ') + diagnostic.issueContext); + } + + lines << qMakePair( + QCoreApplication::translate("ClangStaticAnalyzer::Diagnostic", "Location:"), + createFullLocationString(diagnostic.location)); + + QString html = QLatin1String("" + "" + "\n" + "
"); + + foreach (const StringPair &pair, lines) { + html += QLatin1String("
"); + html += pair.first; + html += QLatin1String("
"); + html += pair.second; + html += QLatin1String("
\n"); + } + html += QLatin1String("
"); + return html; +} + +QVariant ClangStaticAnalyzerDiagnosticModel::data(const QModelIndex &index, int role) const +{ + if (!index.isValid()) + return QVariant(); + + if (index.parent().isValid()) + return QVariant(); + + const int row = index.row(); + if (row < 0 || row >= m_diagnostics.size()) + return QVariant(); + + const Diagnostic diagnostic = m_diagnostics.at(row); + + if (role == Qt::DisplayRole) + return QString(QLatin1String("Some specific diagnostic")); // TODO: Remove? + else if (role == Qt::ToolTipRole) + return createDiagnosticToolTipString(diagnostic); + else if (role == Qt::UserRole) + return QVariant::fromValue(diagnostic); + + return QVariant(); +} + +} // namespace Internal +} // namespace ClangStaticAnalyzer diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.h b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.h new file mode 100644 index 00000000000..beccf89a846 --- /dev/null +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.h @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc +** 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 LicenseChecker Add-on. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** +****************************************************************************/ + +#ifndef CLANGSTATICANALYZERDIAGNOSTICMODEL_H +#define CLANGSTATICANALYZERDIAGNOSTICMODEL_H + +#include "clangstaticanalyzerlogfilereader.h" + +#include + +namespace ClangStaticAnalyzer { +namespace Internal { + +class ClangStaticAnalyzerDiagnosticModel : public QAbstractListModel +{ + Q_OBJECT + +public: + ClangStaticAnalyzerDiagnosticModel(QObject *parent = 0); + + void addDiagnostics(const QList &diagnostics); + void clear(); + + // QAbstractListModel interface + int rowCount(const QModelIndex &parent = QModelIndex()) const; + QVariant data(const QModelIndex &index, int role) const; + +private: + QList m_diagnostics; +}; + +} // namespace Internal +} // namespace ClangStaticAnalyzer + +#endif // CLANGSTATICANALYZERDIAGNOSTICMODEL_H diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.cpp new file mode 100644 index 00000000000..fd9e216ed76 --- /dev/null +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.cpp @@ -0,0 +1,223 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc +** 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 LicenseChecker Add-on. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** +****************************************************************************/ + +#include "clangstaticanalyzerdiagnosticview.h" + +#include "clangstaticanalyzerlogfilereader.h" +#include "clangstaticanalyzerutils.h" + +#include + +#include +#include +#include +#include +#include + +using namespace Analyzer; + +namespace { + +QLabel *createCommonLabel() +{ + QLabel *label = new QLabel; + label->setWordWrap(true); + label->setContentsMargins(0, 0, 0, 0); + label->setMargin(0); + label->setIndent(10); + return label; +} + +QString createSummaryText(const ClangStaticAnalyzer::Internal::Diagnostic &diagnostic, + const QPalette &palette) +{ + const QColor color = palette.color(QPalette::Text); + const QString linkStyle = QString::fromLatin1("style=\"color:rgba(%1, %2, %3, %4);\"") + .arg(color.red()) + .arg(color.green()) + .arg(color.blue()) + .arg(int(0.7 * 255)); + const QString fileName = QFileInfo(diagnostic.location.filePath).fileName(); + const QString location = fileName + QLatin1Char(' ') + + QString::number(diagnostic.location.line); + return QString::fromLatin1("%1  %2") + .arg(diagnostic.description, location, linkStyle); +} + +QLabel *createSummaryLabel(const ClangStaticAnalyzer::Internal::Diagnostic &diagnostic) +{ + QLabel *label = createCommonLabel(); + QPalette palette = label->palette(); + palette.setBrush(QPalette::Text, palette.highlightedText()); + label->setPalette(palette); + label->setText(createSummaryText(diagnostic, palette)); + return label; +} + +QLabel *createExplainingStepLabel(const QFont &font, bool useAlternateRowPalette) +{ + QLabel *label = createCommonLabel(); + + // Font + QFont fixedPitchFont = font; + fixedPitchFont.setFixedPitch(true); + label->setFont(fixedPitchFont); + + // Background + label->setAutoFillBackground(true); + if (useAlternateRowPalette) { + QPalette p = label->palette(); + p.setBrush(QPalette::Base, p.alternateBase()); + label->setPalette(p); + } + + return label; +} + +QString createLocationString(const ClangStaticAnalyzer::Internal::Location &location, + bool withMarkup) +{ + const QString filePath = location.filePath; + const QString fileName = QFileInfo(filePath).fileName(); + const QString lineNumber = QString::number(location.line); + const QString columnNumber = QString::number(location.column - 1); + const QString fileNameAndLine = fileName + QLatin1Char(':') + lineNumber; + + if (withMarkup) { + return QLatin1String("in ") + + fileNameAndLine + + QLatin1String(""); + } else { + return QLatin1String("in ") + fileNameAndLine; + } +} + +QString createExplainingStepNumberString(int number) +{ + const int fieldWidth = 2; + return QString::fromLatin1("%1:").arg(number, fieldWidth); +} + +QString createExplainingStepToolTipString(const ClangStaticAnalyzer::Internal::ExplainingStep &step) +{ + if (step.message == step.extendedMessage) + return createFullLocationString(step.location); + + typedef QPair StringPair; + QList lines; + + if (!step.message.isEmpty()) { + lines << qMakePair( + QCoreApplication::translate("ClangStaticAnalyzer::ExplainingStep", "Message:"), + step.message); + } + if (!step.extendedMessage.isEmpty()) { + lines << qMakePair( + QCoreApplication::translate("ClangStaticAnalyzer::ExplainingStep", "Extended Message:"), + step.extendedMessage); + } + + lines << qMakePair( + QCoreApplication::translate("ClangStaticAnalyzer::ExplainingStep", "Location:"), + createFullLocationString(step.location)); + + QString html = QLatin1String("" + "" + "\n" + "
"); + + foreach (const StringPair &pair, lines) { + html += QLatin1String("
"); + html += pair.first; + html += QLatin1String("
"); + html += pair.second; + html += QLatin1String("
\n"); + } + html += QLatin1String("
"); + return html; +} + +} // anonymous namespace + +namespace ClangStaticAnalyzer { +namespace Internal { + +ClangStaticAnalyzerDiagnosticDelegate::ClangStaticAnalyzerDiagnosticDelegate(QListView *parent) + : DetailedErrorDelegate(parent) +{ +} + +DetailedErrorDelegate::SummaryLineInfo ClangStaticAnalyzerDiagnosticDelegate::summaryInfo( + const QModelIndex &index) const +{ + const Diagnostic diagnostic = index.data(Qt::UserRole).value(); + + DetailedErrorDelegate::SummaryLineInfo info; + info.errorText = diagnostic.description; + info.errorLocation = createLocationString(diagnostic.location, /*withMarkup=*/ false); + return info; +} + +void ClangStaticAnalyzerDiagnosticDelegate::copy() +{ + qDebug() << Q_FUNC_INFO; +} + +QWidget *ClangStaticAnalyzerDiagnosticDelegate::createDetailsWidget(const QFont &font, + const QModelIndex &index, + QWidget *parent) const +{ + QWidget *widget = new QWidget(parent); + QVBoxLayout *layout = new QVBoxLayout; + + const Diagnostic diagnostic = index.data(Qt::UserRole).value(); + + // Add summary label + QLabel *summaryLineLabel = createSummaryLabel(diagnostic); + connect(summaryLineLabel, &QLabel::linkActivated, + this, &ClangStaticAnalyzerDiagnosticDelegate::openLinkInEditor); + layout->addWidget(summaryLineLabel); + + // Add labels for explaining steps + int explainingStepNumber = 1; + foreach (const ExplainingStep &explainingStep, diagnostic.explainingSteps) { + const QString text = createExplainingStepNumberString(explainingStepNumber++) + + QLatin1Char(' ') + + explainingStep.extendedMessage + + QLatin1Char(' ') + + createLocationString(explainingStep.location, /*withMarkup=*/ true); + + QLabel *label = createExplainingStepLabel(font, explainingStepNumber % 2 == 0); + label->setParent(widget); + label->setText(text); + label->setToolTip(createExplainingStepToolTipString(explainingStep)); + connect(label, &QLabel::linkActivated, + this, &ClangStaticAnalyzerDiagnosticDelegate::openLinkInEditor); + layout->addWidget(label); + } + + layout->setContentsMargins(0, 0, 0, 0); + layout->setSpacing(0); + widget->setLayout(layout); + return widget; +} + +} // namespace Internal +} // namespace ClangStaticAnalyzer diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.h b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.h new file mode 100644 index 00000000000..551aff3e723 --- /dev/null +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.h @@ -0,0 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc +** 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 LicenseChecker Add-on. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** +****************************************************************************/ + +#ifndef CLANGSTATICANALYZERDIAGNOSTICVIEW_H +#define CLANGSTATICANALYZERDIAGNOSTICVIEW_H + +#include + +namespace ClangStaticAnalyzer { +namespace Internal { + +class ClangStaticAnalyzerDiagnosticDelegate : public Analyzer::DetailedErrorDelegate +{ +public: + ClangStaticAnalyzerDiagnosticDelegate(QListView *parent); + + SummaryLineInfo summaryInfo(const QModelIndex &index) const; + void copy(); + +private: + QWidget *createDetailsWidget(const QFont &font, const QModelIndex &index, + QWidget *parent) const; +}; + +} // namespace Internal +} // namespace ClangStaticAnalyzer + +#endif // CLANGSTATICANALYZERDIAGNOSTICVIEW_H diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerlogfilereader.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerlogfilereader.cpp new file mode 100644 index 00000000000..22bbb4cb73f --- /dev/null +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerlogfilereader.cpp @@ -0,0 +1,374 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc +** 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 LicenseChecker Add-on. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** +****************************************************************************/ + +#include "clangstaticanalyzerlogfilereader.h" + +#include +#include +#include +#include +#include + +#include + +namespace ClangStaticAnalyzer { +namespace Internal { + +class ClangStaticAnalyzerLogFileReader +{ +public: + ClangStaticAnalyzerLogFileReader(const QString &filePath); + + QXmlStreamReader::Error read(); + + // Output + QString clangVersion() const; + QStringList files() const; + QList diagnostics() const; + +private: + void readPlist(); + void readTopLevelDict(); + void readDiagnosticsArray(); + void readDiagnosticsDict(); + QList readPathArray(); + ExplainingStep readPathDict(); + Location readLocationDict(bool elementIsRead = false); + QList readRangesArray(); + + QString readString(); + QStringList readStringArray(); + int readInteger(bool *convertedSuccessfully); + +private: + QString m_filePath; + QXmlStreamReader m_xml; + + QString m_clangVersion; + QStringList m_referencedFiles; + QList m_diagnostics; +}; + +QList LogFileReader::read(const QString &filePath, QString *errorMessage) +{ + const QList emptyList; + + // Check file path + QFileInfo fi(filePath); + if (!fi.exists() || !fi.isReadable()) { + if (errorMessage) { + *errorMessage = QObject::tr("File \"%1\" does not exist or is not readable.") + .arg(filePath); + } + return emptyList; + } + + // Read + ClangStaticAnalyzerLogFileReader reader(filePath); + const QXmlStreamReader::Error error = reader.read(); + + // Return diagnostics + switch (error) { + case QXmlStreamReader::NoError: + return reader.diagnostics(); + + // Handle errors + case QXmlStreamReader::UnexpectedElementError: + if (errorMessage) { + *errorMessage = QObject::tr("Could not read file \"%1\": UnexpectedElementError.") + .arg(filePath); + } // fall-through + case QXmlStreamReader::CustomError: + if (errorMessage) { + *errorMessage = QObject::tr("Could not read file \"%1\": CustomError.") + .arg(filePath); + } // fall-through + case QXmlStreamReader::NotWellFormedError: + if (errorMessage) { + *errorMessage = QObject::tr("Could not read file \"%1\": NotWellFormedError.") + .arg(filePath); + } // fall-through + case QXmlStreamReader::PrematureEndOfDocumentError: + if (errorMessage) { + *errorMessage = QObject::tr("Could not read file \"%1\": PrematureEndOfDocumentError.") + .arg(filePath); + } // fall-through + default: + return emptyList; + } +} + +ClangStaticAnalyzerLogFileReader::ClangStaticAnalyzerLogFileReader(const QString &filePath) + : m_filePath(filePath) +{ +} + +QXmlStreamReader::Error ClangStaticAnalyzerLogFileReader::read() +{ + QTC_ASSERT(!m_filePath.isEmpty(), return QXmlStreamReader::CustomError); + QFile file(m_filePath); + QTC_ASSERT(file.open(QIODevice::ReadOnly | QIODevice::Text), + return QXmlStreamReader::CustomError); + + m_xml.setDevice(&file); + readPlist(); + + // If file is empty, m_xml.error() == QXmlStreamReader::PrematureEndOfDocumentError + return m_xml.error(); +} + +QString ClangStaticAnalyzerLogFileReader::clangVersion() const +{ + return m_clangVersion; +} + +QStringList ClangStaticAnalyzerLogFileReader::files() const +{ + return m_referencedFiles; +} + +QList ClangStaticAnalyzerLogFileReader::diagnostics() const +{ + return m_diagnostics; +} + +void ClangStaticAnalyzerLogFileReader::readPlist() +{ + if (m_xml.readNextStartElement()) { + if (m_xml.name() == QLatin1String("plist")) { + if (m_xml.attributes().value(QLatin1String("version")) == QLatin1String("1.0")) + readTopLevelDict(); + } else { + m_xml.raiseError(QObject::tr("File is not a plist version 1.0 file.")); + } + } +} + +void ClangStaticAnalyzerLogFileReader::readTopLevelDict() +{ + QTC_ASSERT(m_xml.isStartElement() && m_xml.name() == QLatin1String("plist"), return); + QTC_ASSERT(m_xml.readNextStartElement() && m_xml.name() == QLatin1String("dict"), return); + + while (m_xml.readNextStartElement()) { + if (m_xml.name() == QLatin1String("key")) { + const QString key = m_xml.readElementText(); + if (key == QLatin1String("clang_version")) + m_clangVersion = readString(); + else if (key == QLatin1String("files")) + m_referencedFiles = readStringArray(); + else if (key == QLatin1String("diagnostics")) + readDiagnosticsArray(); + } else { + m_xml.skipCurrentElement(); + } + } +} + +void ClangStaticAnalyzerLogFileReader::readDiagnosticsArray() +{ + if (m_xml.readNextStartElement() && m_xml.name() == QLatin1String("array")) { + while (m_xml.readNextStartElement() && m_xml.name() == QLatin1String("dict")) + readDiagnosticsDict(); + } +} + +void ClangStaticAnalyzerLogFileReader::readDiagnosticsDict() +{ + QTC_ASSERT(m_xml.isStartElement() && m_xml.name() == QLatin1String("dict"), return); + + Diagnostic diagnostic; + + while (m_xml.readNextStartElement()) { + if (m_xml.name() == QLatin1String("key")) { + const QString key = m_xml.readElementText(); + if (key == QLatin1String("path")) + diagnostic.explainingSteps = readPathArray(); + else if (key == QLatin1String("description")) + diagnostic.description = readString(); + else if (key == QLatin1String("category")) + diagnostic.category = readString(); + else if (key == QLatin1String("type")) + diagnostic.type = readString(); + else if (key == QLatin1String("issue_context_kind")) + diagnostic.issueContextKind = readString(); + else if (key == QLatin1String("issue_context")) + diagnostic.issueContext = readString(); + else if (key == QLatin1String("location")) + diagnostic.location = readLocationDict(); + } else { + m_xml.skipCurrentElement(); + } + } + + m_diagnostics << diagnostic; +} + +QList ClangStaticAnalyzerLogFileReader::readPathArray() +{ + QList result; + + if (m_xml.readNextStartElement() && m_xml.name() == QLatin1String("array")) { + while (m_xml.readNextStartElement() && m_xml.name() == QLatin1String("dict")) { + const ExplainingStep step = readPathDict(); + if (step.isValid()) + result << step; + } + } + + return result; +} + +ExplainingStep ClangStaticAnalyzerLogFileReader::readPathDict() +{ + ExplainingStep explainingStep; + + QTC_ASSERT(m_xml.isStartElement() && m_xml.name() == QLatin1String("dict"), + return explainingStep); + + // We are interested only in dict entries an kind=event type + if (m_xml.readNextStartElement()) { + if (m_xml.name() == QLatin1String("key")) { + const QString key = m_xml.readElementText(); + QTC_ASSERT(key == QLatin1String("kind"), return explainingStep); + const QString kind = readString(); + if (kind != QLatin1String("event")) { + m_xml.skipCurrentElement(); + return explainingStep; + } + } + } + + bool depthOk; + + while (m_xml.readNextStartElement()) { + if (m_xml.name() == QLatin1String("key")) { + const QString key = m_xml.readElementText(); + if (key == QLatin1String("location")) + explainingStep.location = readLocationDict(); + else if (key == QLatin1String("ranges")) + explainingStep.ranges = readRangesArray(); + else if (key == QLatin1String("depth")) + explainingStep.depth = readInteger(&depthOk); + else if (key == QLatin1String("message")) + explainingStep.message = readString(); + else if (key == QLatin1String("extended_message")) + explainingStep.extendedMessage = readString(); + } else { + m_xml.skipCurrentElement(); + } + } + + QTC_CHECK(depthOk); + return explainingStep; +} + +Location ClangStaticAnalyzerLogFileReader::readLocationDict(bool elementIsRead) +{ + Location location; + if (elementIsRead) { + QTC_ASSERT(m_xml.isStartElement() && m_xml.name() == QLatin1String("dict"), + return location); + } else { + QTC_ASSERT(m_xml.readNextStartElement() && m_xml.name() == QLatin1String("dict"), + return location); + } + + int line = 0; + int column = 0; + int fileIndex = 0; + bool lineOk, columnOk, fileIndexOk; + + // Collect values + while (m_xml.readNextStartElement()) { + if (m_xml.name() == QLatin1String("key")) { + const QString keyName = m_xml.readElementText(); + if (keyName == QLatin1String("line")) + line = readInteger(&lineOk); + else if (keyName == QLatin1String("col")) + column = readInteger(&columnOk); + else if (keyName == QLatin1String("file")) + fileIndex = readInteger(&fileIndexOk); + } else { + m_xml.skipCurrentElement(); + } + } + + if (lineOk && columnOk && fileIndexOk) { + QTC_ASSERT(fileIndex < m_referencedFiles.size(), return location); + location = Location(m_referencedFiles.at(fileIndex), line, column); + } + return location; +} + +QList ClangStaticAnalyzerLogFileReader::readRangesArray() +{ + QList result; + + // It's an array of arrays... + QTC_ASSERT(m_xml.readNextStartElement() && m_xml.name() == QLatin1String("array"), + return result); + QTC_ASSERT(m_xml.readNextStartElement() && m_xml.name() == QLatin1String("array"), + return result); + + while (m_xml.readNextStartElement() && m_xml.name() == QLatin1String("dict")) + result << readLocationDict(true); + + m_xml.skipCurrentElement(); // Laeve outer array + return result; +} + +QString ClangStaticAnalyzerLogFileReader::readString() +{ + if (m_xml.readNextStartElement() && m_xml.name() == QLatin1String("string")) + return m_xml.readElementText(); + + m_xml.raiseError(QObject::tr("Expected a string element.")); + return QString(); +} + +QStringList ClangStaticAnalyzerLogFileReader::readStringArray() +{ + if (m_xml.readNextStartElement() && m_xml.name() == QLatin1String("array")) { + QStringList result; + while (m_xml.readNextStartElement() && m_xml.name() == QLatin1String("string")) { + const QString string = m_xml.readElementText(); + if (!string.isEmpty()) + result << string; + } + return result; + } + + m_xml.raiseError(QObject::tr("Expected an array element.")); + return QStringList(); +} + +int ClangStaticAnalyzerLogFileReader::readInteger(bool *convertedSuccessfully) +{ + if (m_xml.readNextStartElement() && m_xml.name() == QLatin1String("integer")) { + const QString contents = m_xml.readElementText(); + return contents.toInt(convertedSuccessfully); + } + + m_xml.raiseError(QObject::tr("Expected an integer element.")); + if (convertedSuccessfully) + *convertedSuccessfully = false; + return -1; +} + +} // namespace Internal +} // namespace ClangStaticAnalyzer diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerlogfilereader.h b/plugins/clangstaticanalyzer/clangstaticanalyzerlogfilereader.h new file mode 100644 index 00000000000..fe8f5075ff0 --- /dev/null +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerlogfilereader.h @@ -0,0 +1,38 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc +** 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 LicenseChecker Add-on. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** +****************************************************************************/ + +#ifndef CLANGSTATICANALYZERLOGFILEREADER_H +#define CLANGSTATICANALYZERLOGFILEREADER_H + +#include "clangstaticanalyzerdiagnostic.h" + +#include + +namespace ClangStaticAnalyzer { +namespace Internal { + +class LogFileReader +{ +public: + static QList read(const QString &filePath, QString *errorMessage); +}; + +} // namespace Internal +} // namespace ClangStaticAnalyzer + +#endif // CLANGSTATICANALYZERLOGFILEREADER_H diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp new file mode 100644 index 00000000000..0a321d64e88 --- /dev/null +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp @@ -0,0 +1,161 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc +** 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. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** +****************************************************************************/ + +#include "clangstaticanalyzerplugin.h" + +#include "clangstaticanalyzerconfigwidget.h" +#include "clangstaticanalyzerruncontrolfactory.h" +#include "clangstaticanalyzertool.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include + +#include + +using namespace Analyzer; + +namespace ClangStaticAnalyzer { +namespace Internal { + +class ClangStaticAnalyzerOptionsPage : public Core::IOptionsPage +{ +public: + explicit ClangStaticAnalyzerOptionsPage() + { + setId("Analyzer.ClangStaticAnalyzer.Settings"); // TODO: Get it from "clangstaticanalyzersettings.h" + setDisplayName(QCoreApplication::translate( + "ClangStaticAnalyzer::Internal::ClangStaticAnalyzerOptionsPage", + "Clang Static Analyzer")); + setCategory("T.Analyzer"); + setDisplayCategory(QCoreApplication::translate("Analyzer", "Analyzer")); + setCategoryIcon(QLatin1String(":/images/analyzer_category.png")); + } + + QWidget *widget() + { + if (!m_widget) + m_widget = new ClangStaticAnalyzerConfigWidget(ClangStaticAnalyzerSettings::instance()); + return m_widget; + } + + void apply() + { + ClangStaticAnalyzerSettings::instance()->writeSettings(); + } + + void finish() + { + delete m_widget; + } + +private: + QPointer m_widget; +}; + +ClangStaticAnalyzerPlugin::ClangStaticAnalyzerPlugin() +{ + // Create your members +} + +ClangStaticAnalyzerPlugin::~ClangStaticAnalyzerPlugin() +{ + // Unregister objects from the plugin manager's object pool + // Delete members +} + +bool ClangStaticAnalyzerPlugin::initialize(const QStringList &arguments, QString *errorString) +{ + // Register objects in the plugin manager's object pool + // Load settings + // Add actions to menus + // Connect to other plugins' signals + // In the initialize method, a plugin can be sure that the plugins it + // depends on have initialized their members. + + LicenseChecker::LicenseCheckerPlugin *licenseChecker + = ExtensionSystem::PluginManager::getObject(); + + if (licenseChecker && licenseChecker->hasValidLicense()) { + if (licenseChecker->enterpriseFeatures()) + return initializeEnterpriseFeatures(arguments, errorString); + } else { + qWarning() << "Invalid license, disabling Clang Static Analyzer"; + } + + return true; +} + +bool ClangStaticAnalyzerPlugin::initializeEnterpriseFeatures(const QStringList &arguments, + QString *errorString) +{ + Q_UNUSED(arguments); + Q_UNUSED(errorString); + + addAutoReleasedObject(new ClangStaticAnalyzerOptionsPage); + addAutoReleasedObject(new ClangStaticAnalyzerRunControlFactory); + + m_analyzerTool = new ClangStaticAnalyzerTool(this); + + const QString toolTip = tr("Clang Static Analyzer uses the analyzer from the clang project " + "to find bugs."); + + AnalyzerAction *action = new AnalyzerAction(this); + action->setId("ClangStaticAnalyzer"); + action->setTool(m_analyzerTool); + action->setText(tr("Clang Static Analyzer")); + action->setToolTip(toolTip); + action->setMenuGroup(Constants::G_ANALYZER_TOOLS); + action->setStartMode(StartLocal); + action->setEnabled(false); + AnalyzerManager::addAction(action); + + return true; +} + +void ClangStaticAnalyzerPlugin::extensionsInitialized() +{ + // Retrieve objects from the plugin manager's object pool + // In the extensionsInitialized method, a plugin can be sure that all + // plugins that depend on it are completely initialized. +} + +ExtensionSystem::IPlugin::ShutdownFlag ClangStaticAnalyzerPlugin::aboutToShutdown() +{ + // Save settings + // Disconnect from signals that are not needed during shutdown + // Hide UI (if you add UI that is not in the main window directly) + return SynchronousShutdown; +} + +} // namespace Internal +} // namespace ClangStaticAnalyzerPlugin diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.h b/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.h new file mode 100644 index 00000000000..d96611a16f2 --- /dev/null +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.h @@ -0,0 +1,52 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc +** 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. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** +****************************************************************************/ + +#ifndef CLANGSTATICANALYZERPLUGIN_H +#define CLANGSTATICANALYZERPLUGIN_H + +#include + +namespace ClangStaticAnalyzer { +namespace Internal { + +class ClangStaticAnalyzerTool; +class ClangStaticAnalyzerSettings; + +class ClangStaticAnalyzerPlugin : public ExtensionSystem::IPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "ClangStaticAnalyzer.json") + +public: + ClangStaticAnalyzerPlugin(); + ~ClangStaticAnalyzerPlugin(); + + bool initialize(const QStringList &arguments, QString *errorString); + bool initializeEnterpriseFeatures(const QStringList &arguments, QString *errorString); + void extensionsInitialized(); + ShutdownFlag aboutToShutdown(); + +private: + ClangStaticAnalyzerTool *m_analyzerTool; +}; + +} // namespace Internal +} // namespace ClangStaticAnalyzerPlugin + +#endif // CLANGSTATICANALYZERPLUGIN_H + diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp new file mode 100644 index 00000000000..b459f5c0229 --- /dev/null +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp @@ -0,0 +1,235 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc +** 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 LicenseChecker Add-on. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** +****************************************************************************/ + +#include "clangstaticanalyzerruncontrol.h" + +#include "clangstaticanalyzerlogfilereader.h" +#include "clangstaticanalyzerrunner.h" +#include "clangstaticanalyzersettings.h" +#include "clangstaticanalyzerutils.h" + +#include + +#include + +#include +#include + +#include +#include + +#include +#include + +#include +#include + +using namespace CppTools; +using namespace ProjectExplorer; + +static Q_LOGGING_CATEGORY(LOG, "qt.clangstaticanalyzer.runcontrol") + +namespace ClangStaticAnalyzer { +namespace Internal { + +ClangStaticAnalyzerRunControl::ClangStaticAnalyzerRunControl( + const Analyzer::AnalyzerStartParameters &startParams, + ProjectExplorer::RunConfiguration *runConfiguration) + : AnalyzerRunControl(startParams, runConfiguration) + , m_initialFilesToProcessSize(0) + , m_runningProcesses(0) +{ +} + +static QList calculateFilesToProcess( + Project *project) +{ + typedef ClangStaticAnalyzerRunControl::FileConfiguration ProjectFileConfiguration; + QTC_ASSERT(project, return QList()); + ProjectInfo projectInfo = CppModelManager::instance()->projectInfo(project); + QTC_ASSERT(projectInfo, return QList()); + + QList files; + const QList projectParts = projectInfo.projectParts(); + foreach (const ProjectPart::Ptr &projectPart, projectParts) { + foreach (const ProjectFile &file, projectPart->files) { + if (file.path == CppModelManager::configurationFileName()) + continue; + QTC_CHECK(file.kind != ProjectFile::Unclassified); + if (ProjectFile::isSource(file.kind)) + files << ProjectFileConfiguration(file.path, projectPart); + } + } + + return files; +} + +bool ClangStaticAnalyzerRunControl::startEngine() +{ + emit starting(this); + + Project *currentProject = ProjectExplorerPlugin::currentProject(); + QTC_ASSERT(currentProject, emit finished(); return false); + + // Check clang executable + bool isValidClangExecutable; + const QString executable = clangExecutableFromSettings(&isValidClangExecutable); + if (!isValidClangExecutable) { + emit appendMessage(tr("Clang Static Analyzer: Invalid executable \"%1\", stop.\n") + .arg(executable), + Utils::ErrorMessageFormat); + emit finished(); + return false; + } + m_clangExecutable = executable; + + // Create log dir + QTemporaryDir temporaryDir(QDir::tempPath() + QLatin1String("/qtc-clangstaticanalyzer-XXXXXX")); + temporaryDir.setAutoRemove(false); + if (!temporaryDir.isValid()) { + emit appendMessage(tr("Clang Static Analyzer: Failed to create temporary dir, stop.\n"), + Utils::ErrorMessageFormat); + emit finished(); + return false; + } + m_clangLogFileDir = temporaryDir.path(); + + // Collect files + const QList filesToProcess = calculateFilesToProcess(currentProject); + qCDebug(LOG()) << "Files to process:"; + foreach (const FileConfiguration &fileConfig, filesToProcess) { + qCDebug(LOG()) << fileConfig.filePath + QLatin1String(" [") + + fileConfig.projectPart->projectFile + QLatin1Char(']'); + } + m_filesToProcess = filesToProcess; + m_initialFilesToProcessSize = m_filesToProcess.count(); + + // Set up progress information + using namespace Core; + FutureProgress *futureProgress + = ProgressManager::addTask(m_progress.future(), tr("Analyzing"), "ClangStaticAnalyzer"); + futureProgress->setKeepOnFinish(FutureProgress::HideOnFinish); + connect(futureProgress, &FutureProgress::canceled, + this, &ClangStaticAnalyzerRunControl::onProgressCanceled); + m_progress.setProgressRange(0, m_initialFilesToProcessSize); + m_progress.reportStarted(); + + // Start process(es) + const int parallelRuns = ClangStaticAnalyzerSettings::instance()->simultaneousProcesses(); + QTC_ASSERT(parallelRuns >= 1, emit finished(); return false); + m_runningProcesses = 0; + while (m_runningProcesses < parallelRuns && !m_filesToProcess.isEmpty()) + analyzeNextFile(); + return true; +} + +void ClangStaticAnalyzerRunControl::stopEngine() +{ + m_filesToProcess.clear(); +} + +QStringList createDefinesAndIncludesOptions(const ProjectPart::Ptr projectPart) +{ + QStringList result; + result += ClangCodeModel::Utils::createDefineOptions(projectPart->projectDefines, false); + result += ClangCodeModel::Utils::createHeaderPathOptions(projectPart->headerPaths); + result += QLatin1String("-fPIC"); // TODO: Remove? + return result; +} + +void ClangStaticAnalyzerRunControl::analyzeNextFile() +{ + if (m_progress.isFinished()) + return; // The previous call already reported that we are finished. + + if (m_filesToProcess.isEmpty()) { + QTC_ASSERT(m_runningProcesses >= 0, return); + if (m_runningProcesses == 0) { + m_progress.reportFinished(); + emit finished(); + } + return; + } + + const FileConfiguration config = m_filesToProcess.takeFirst(); + const QString filePath = config.filePath; + const QStringList definesAndIncludesOptions + = createDefinesAndIncludesOptions(config.projectPart); + + ClangStaticAnalyzerRunner *runner = createRunner(); + qCDebug(LOG) << "analyzeNextFile:" << filePath; + QTC_ASSERT(runner->run(filePath, definesAndIncludesOptions), return); + ++m_runningProcesses; +} + +ClangStaticAnalyzerRunner *ClangStaticAnalyzerRunControl::createRunner() +{ + QTC_ASSERT(!m_clangExecutable.isEmpty(), return 0); + QTC_ASSERT(!m_clangLogFileDir.isEmpty(), return 0); + + ClangStaticAnalyzerRunner *runner + = new ClangStaticAnalyzerRunner(m_clangExecutable, m_clangLogFileDir, this); + connect(runner, &ClangStaticAnalyzerRunner::finishedWithSuccess, + this, &ClangStaticAnalyzerRunControl::onRunnerFinishedWithSuccess); + connect(runner, &ClangStaticAnalyzerRunner::finishedWithFailure, + this, &ClangStaticAnalyzerRunControl::onRunnerFinishedWithFailure); + return runner; +} + +void ClangStaticAnalyzerRunControl::onRunnerFinishedWithSuccess(const QString &logFilePath) +{ + qCDebug(LOG) << "onRunnerFinishedWithSuccess:" << logFilePath; + handleFinished(); + + QString errorMessage; + const QList diagnostics = LogFileReader::read(logFilePath, &errorMessage); + if (!errorMessage.isEmpty()) + qCDebug(LOG) << "onRunnerFinishedWithSuccess: Error reading log file:" << errorMessage; + if (!diagnostics.isEmpty()) + emit newDiagnosticsAvailable(diagnostics); +} + +void ClangStaticAnalyzerRunControl::onRunnerFinishedWithFailure(const QString &errorMessage, + const QString &errorDetails) +{ + qCDebug(LOG) << "onRunnerFinishedWithFailure:" << errorMessage << errorDetails; + handleFinished(); +} + +void ClangStaticAnalyzerRunControl::handleFinished() +{ + --m_runningProcesses; + updateProgressValue(); + sender()->deleteLater(); + analyzeNextFile(); +} + +void ClangStaticAnalyzerRunControl::onProgressCanceled() +{ + Analyzer::AnalyzerManager::stopTool(); + m_progress.reportCanceled(); + m_progress.reportFinished(); +} + +void ClangStaticAnalyzerRunControl::updateProgressValue() +{ + m_progress.setProgressValue(m_initialFilesToProcessSize - m_filesToProcess.size()); +} + +} // namespace Internal +} // namespace ClangStaticAnalyzer diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h new file mode 100644 index 00000000000..37148b399d7 --- /dev/null +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc +** 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 LicenseChecker Add-on. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** +****************************************************************************/ + +#ifndef CLANGSTATICANALYZERRUNCONTROL_H +#define CLANGSTATICANALYZERRUNCONTROL_H + +#include +#include + +#include +#include + +namespace ClangStaticAnalyzer { +namespace Internal { + +class ClangStaticAnalyzerRunner; +class Diagnostic; + +class ClangStaticAnalyzerRunControl : public Analyzer::AnalyzerRunControl +{ + Q_OBJECT + +public: + struct FileConfiguration { + FileConfiguration(const QString &filePath, const CppTools::ProjectPart::Ptr &projectPart) + : filePath(filePath) + , projectPart(projectPart) {} + + QString filePath; + CppTools::ProjectPart::Ptr projectPart; + }; + +public: + explicit ClangStaticAnalyzerRunControl(const Analyzer::AnalyzerStartParameters &startParams, + ProjectExplorer::RunConfiguration *runConfiguration); + + bool startEngine(); + void stopEngine(); + +signals: + void newDiagnosticsAvailable(const QList &diagnostics); + +private: + void analyzeNextFile(); + ClangStaticAnalyzerRunner *createRunner(); + + void onRunnerFinishedWithSuccess(const QString &logFilePath); + void onRunnerFinishedWithFailure(const QString &errorMessage, const QString &errorDetails); + void handleFinished(); + + void onProgressCanceled(); + void updateProgressValue(); + +private: + QString m_clangExecutable; + QString m_clangLogFileDir; + QFutureInterface m_progress; + QList m_filesToProcess; + int m_initialFilesToProcessSize; + int m_runningProcesses; +}; + +} // namespace Internal +} // namespace ClangStaticAnalyzer + +#endif // CLANGSTATICANALYZERRUNCONTROL_H diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp new file mode 100644 index 00000000000..dbc165c805e --- /dev/null +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc +** 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 LicenseChecker Add-on. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** +****************************************************************************/ + +#include "clangstaticanalyzerruncontrolfactory.h" + +#include +#include +#include + +#include + +using namespace Analyzer; +using namespace ProjectExplorer; + +namespace ClangStaticAnalyzer { +namespace Internal { + +ClangStaticAnalyzerRunControlFactory::ClangStaticAnalyzerRunControlFactory(QObject *parent) + : IRunControlFactory(parent) +{ +} + +bool ClangStaticAnalyzerRunControlFactory::canRun(RunConfiguration *runConfiguration, + RunMode runMode) const +{ + return runMode == ClangStaticAnalyzerMode + && (qobject_cast(runConfiguration)); +} + +RunControl *ClangStaticAnalyzerRunControlFactory::create(RunConfiguration *runConfiguration, + RunMode runMode, + QString *errorMessage) +{ + Q_UNUSED(errorMessage); + Q_UNUSED(runMode); + + auto *rc = qobject_cast(runConfiguration); + QTC_ASSERT(rc, return 0); + + AnalyzerStartParameters sp; + sp.runMode = runMode; + sp.startMode = StartLocal; + return AnalyzerManager::createRunControl(sp, runConfiguration); +} + +} // namespace Internal +} // namespace ClangStaticAnalyzer diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.h b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.h new file mode 100644 index 00000000000..ec3b2d8c9c0 --- /dev/null +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.h @@ -0,0 +1,45 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc +** 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 LicenseChecker Add-on. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** +****************************************************************************/ + +#ifndef CLANGSTATICANALYZERRUNCONTROLFACTORY_H +#define CLANGSTATICANALYZERRUNCONTROLFACTORY_H + +#include + +namespace ClangStaticAnalyzer { +namespace Internal { + +class ClangStaticAnalyzerRunControlFactory : public ProjectExplorer::IRunControlFactory +{ + Q_OBJECT + +public: + explicit ClangStaticAnalyzerRunControlFactory(QObject *parent = 0); + + bool canRun(ProjectExplorer::RunConfiguration *runConfiguration, + ProjectExplorer::RunMode runMode) const; + + ProjectExplorer::RunControl *create(ProjectExplorer::RunConfiguration *runConfiguration, + ProjectExplorer::RunMode runMode, + QString *errorMessage); +}; + +} // namespace Internal +} // namespace ClangStaticAnalyzer + +#endif // CLANGSTATICANALYZERRUNCONTROLFACTORY_H diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.cpp new file mode 100644 index 00000000000..3db69c644b8 --- /dev/null +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.cpp @@ -0,0 +1,165 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc +** 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 LicenseChecker Add-on. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** +****************************************************************************/ + +#include "clangstaticanalyzerrunner.h" + +#include "clangstaticanalyzerconstants.h" + +#include +#include +#include +#include +#include + +static Q_LOGGING_CATEGORY(LOG, "qt.clangstaticanalyzer.runner") + +static QString generalProcessError() +{ + return QObject::tr("An error occurred with the clang static analyzer process."); +} + +static QString finishedDueToCrash() +{ + return QObject::tr("Clang static analyzer crashed."); +} + +static QStringList constructCommandLineArguments(const QString &filePath, + const QString &logFile, + const QStringList &definesAndIncludes) +{ + QStringList arguments = QStringList() + << QLatin1String("--analyze") + << QLatin1String("-o") + << logFile + ; + arguments += definesAndIncludes; + arguments << filePath; + return arguments; +} + +namespace ClangStaticAnalyzer { +namespace Internal { + +QString finishedWithBadExitCode(int exitCode) +{ + return QObject::tr("Clang static analyzer finished with exit code: %1.").arg(exitCode); +} + +ClangStaticAnalyzerRunner::ClangStaticAnalyzerRunner(const QString &clangExecutable, + const QString &clangLogFileDir, + QObject *parent) + : QObject(parent) + , m_clangExecutable(clangExecutable) + , m_clangLogFileDir(clangLogFileDir) +{ + QTC_CHECK(!m_clangExecutable.isEmpty()); + QTC_CHECK(!m_clangLogFileDir.isEmpty()); + + m_process.setProcessChannelMode(QProcess::MergedChannels); + connect(&m_process, &QProcess::started, + this, &ClangStaticAnalyzerRunner::onProcessStarted); + connect(&m_process, static_cast(&QProcess::finished), + this, &ClangStaticAnalyzerRunner::onProcessFinished); + connect(&m_process, static_cast(&QProcess::error), + this, &ClangStaticAnalyzerRunner::onProcessError); + connect(&m_process, &QProcess::readyRead, + this, &ClangStaticAnalyzerRunner::onProcessOutput); +} + +ClangStaticAnalyzerRunner::~ClangStaticAnalyzerRunner() +{ + const QProcess::ProcessState processState = m_process.state(); + if (processState == QProcess::Starting || processState == QProcess::Running) + m_process.kill(); +} + +bool ClangStaticAnalyzerRunner::run(const QString &filePath, const QStringList &definesAndIncludes) +{ + QTC_ASSERT(!m_clangExecutable.isEmpty(), return false); + + m_processOutput.clear(); + + m_logFile = createLogFile(filePath); + QTC_ASSERT(!m_logFile.isEmpty(), return false); + const QStringList arguments = constructCommandLineArguments(filePath, m_logFile, + definesAndIncludes); + m_commandLine = m_clangExecutable + QLatin1Char(' ') + arguments.join(QLatin1Char(' ')); + + qCDebug(LOG) << "Starting" << m_commandLine; + m_process.start(m_clangExecutable, arguments); + return true; +} + +void ClangStaticAnalyzerRunner::onProcessStarted() +{ + emit started(); +} + +void ClangStaticAnalyzerRunner::onProcessFinished(int exitCode, QProcess::ExitStatus exitStatus) +{ + if (exitStatus == QProcess::NormalExit) { + if (exitCode == 0) + emit finishedWithSuccess(m_logFile); + else + emit finishedWithFailure(finishedWithBadExitCode(exitCode), processCommandlineAndOutput()); + } else { // == QProcess::CrashExit + emit finishedWithFailure(finishedDueToCrash(), processCommandlineAndOutput()); + } +} + +void ClangStaticAnalyzerRunner::onProcessError(QProcess::ProcessError error) +{ + if (error == QProcess::Crashed) + return; // handled by slot of finished() + + emit finishedWithFailure(generalProcessError(), processCommandlineAndOutput()); +} + +void ClangStaticAnalyzerRunner::onProcessOutput() +{ + m_processOutput.append(m_process.readAll()); +} + +QString ClangStaticAnalyzerRunner::createLogFile(const QString &filePath) const +{ + const QString fileName = QFileInfo(filePath).fileName(); + const QString fileTemplate = m_clangLogFileDir + + QLatin1String("/report-") + fileName + QLatin1String("-XXXXXX.plist"); + + QTemporaryFile temporaryFile; + temporaryFile.setAutoRemove(false); + temporaryFile.setFileTemplate(fileTemplate); + if (temporaryFile.open()) { + temporaryFile.close(); + return temporaryFile.fileName(); + } + return QString(); +} + +QString ClangStaticAnalyzerRunner::processCommandlineAndOutput() const +{ + return QObject::tr("Command line: \"%1\"\n" + "Process Error: \"%2\"\n" + "Output:\n\"%3\"") + .arg(m_commandLine, + QString::number(m_process.error()), + QString::fromLocal8Bit(m_processOutput)); +} + +} // namespace Internal +} // namespace ClangStaticAnalyzer diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.h b/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.h new file mode 100644 index 00000000000..ada1b67d87d --- /dev/null +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.h @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc +** 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 LicenseChecker Add-on. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** +****************************************************************************/ + +#ifndef CLANGSTATICANALYZERRUNNER_H +#define CLANGSTATICANALYZERRUNNER_H + +#include +#include + +#include +#include + +namespace ClangStaticAnalyzer { +namespace Internal { + +QString finishedWithBadExitCode(int exitCode); // exposed for tests + +class ClangStaticAnalyzerRunner : public QObject +{ + Q_OBJECT + +public: + ClangStaticAnalyzerRunner(const QString &clangExecutable, + const QString &clangLogFileDir, + QObject *parent = 0); + ~ClangStaticAnalyzerRunner(); + + bool run(const QString &filePath, const QStringList &definesAndIncludes = QStringList()); + +signals: + void started(); + void finishedWithSuccess(const QString &logFilePath); + void finishedWithFailure(const QString &errorMessage, const QString &errorDetails); + +private: + void onProcessStarted(); + void onProcessFinished(int exitCode, QProcess::ExitStatus exitStatus); + void onProcessError(QProcess::ProcessError error); + void onProcessOutput(); + + QString createLogFile(const QString &filePath) const; + QString processCommandlineAndOutput() const; + +private: + QString m_clangExecutable; + QString m_clangLogFileDir; + QString m_logFile; + QString m_commandLine; + QProcess m_process; + QByteArray m_processOutput; +}; + +} // namespace Internal +} // namespace ClangStaticAnalyzer + +#endif // CLANGSTATICANALYZERRUNNER_H diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzersettings.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzersettings.cpp new file mode 100644 index 00000000000..a6445b16305 --- /dev/null +++ b/plugins/clangstaticanalyzer/clangstaticanalyzersettings.cpp @@ -0,0 +1,98 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc +** 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 LicenseChecker Add-on. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** +****************************************************************************/ + +#include "clangstaticanalyzersettings.h" + +#include "clangstaticanalyzerconstants.h" + +#include + +#include +#include + +#include +#include + +static const char clangExecutableKey[] = "clangExecutable"; +static const char simultaneousProcessesKey[] = "simultaneousProcesses"; + +namespace ClangStaticAnalyzer { +namespace Internal { + +ClangStaticAnalyzerSettings::ClangStaticAnalyzerSettings() + : m_simultaneousProcesses(-1) +{ + readSettings(); +} + +ClangStaticAnalyzerSettings *ClangStaticAnalyzerSettings::instance() +{ + static ClangStaticAnalyzerSettings instance; + return &instance; +} + +QString ClangStaticAnalyzerSettings::clangExecutable() const +{ + return m_clangExecutable; +} + +void ClangStaticAnalyzerSettings::setClangExecutable(const QString &exectuable) +{ + QTC_ASSERT(!exectuable.isEmpty(), return); + m_clangExecutable = exectuable; +} + +int ClangStaticAnalyzerSettings::simultaneousProcesses() const +{ + return m_simultaneousProcesses; +} + +void ClangStaticAnalyzerSettings::setSimultaneousProcesses(int processes) +{ + QTC_ASSERT(processes >=1, return); + m_simultaneousProcesses = processes; +} + +void ClangStaticAnalyzerSettings::readSettings() +{ + QSettings *settings = Core::ICore::settings(); + settings->beginGroup(QLatin1String(Constants::SETTINGS_ID)); + + const QString defaultClangExecutable = Utils::HostOsInfo::withExecutableSuffix( + QLatin1String(Constants::CLANG_EXECUTABLE_BASE_NAME)); + setClangExecutable(settings->value(QLatin1String(clangExecutableKey), + defaultClangExecutable).toString()); + + const int defaultSimultaneousProcesses = qMax(0, QThread::idealThreadCount() / 2); + setSimultaneousProcesses(settings->value(QLatin1String(simultaneousProcessesKey), + defaultSimultaneousProcesses).toInt()); + + settings->endGroup(); +} + +void ClangStaticAnalyzerSettings::writeSettings() const +{ + QSettings *settings = Core::ICore::settings(); + settings->beginGroup(QLatin1String(Constants::SETTINGS_ID)); + settings->setValue(QLatin1String(clangExecutableKey), clangExecutable()); + settings->setValue(QLatin1String(simultaneousProcessesKey), simultaneousProcesses()); + settings->endGroup(); +} + +} // namespace Internal +} // namespace ClangStaticAnalyzer diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzersettings.h b/plugins/clangstaticanalyzer/clangstaticanalyzersettings.h new file mode 100644 index 00000000000..bca154c561e --- /dev/null +++ b/plugins/clangstaticanalyzer/clangstaticanalyzersettings.h @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc +** 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 LicenseChecker Add-on. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** +****************************************************************************/ + +#ifndef CLANGSTATICANALYZERSETTINGS_H +#define CLANGSTATICANALYZERSETTINGS_H + +#include +#include + +namespace ClangStaticAnalyzer { +namespace Internal { + +class ClangStaticAnalyzerSettings : public QObject +{ + Q_OBJECT + +public: + static ClangStaticAnalyzerSettings *instance(); + + void writeSettings() const; + + QString clangExecutable() const; + void setClangExecutable(const QString &exectuable); + + int simultaneousProcesses() const; + void setSimultaneousProcesses(int processes); + +private: + ClangStaticAnalyzerSettings(); + void readSettings(); + + QString m_clangExecutable; + int m_simultaneousProcesses; +}; + +} // namespace Internal +} // namespace ClangStaticAnalyzer + +#endif // CLANGSTATICANALYZERSETTINGS_H diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp new file mode 100644 index 00000000000..143043d73fe --- /dev/null +++ b/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp @@ -0,0 +1,187 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc +** 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 LicenseChecker Add-on. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** +****************************************************************************/ + +#include "clangstaticanalyzertool.h" + +#include "clangstaticanalyzerdiagnosticmodel.h" +#include "clangstaticanalyzerdiagnosticview.h" +#include "clangstaticanalyzerruncontrol.h" + +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include + +using namespace Analyzer; +using namespace ProjectExplorer; + +namespace ClangStaticAnalyzer { +namespace Internal { + +ClangStaticAnalyzerTool::ClangStaticAnalyzerTool(QObject *parent) + : IAnalyzerTool(parent) + , m_diagnosticModel(0) + , m_diagnosticView(0) + , m_goBack(0) + , m_goNext(0) +{ + setObjectName(QLatin1String("ClangStaticAnalyzerTool")); + setRunMode(ProjectExplorer::ClangStaticAnalyzerMode); + setToolMode(AnyMode); +} + +QWidget *ClangStaticAnalyzerTool::createWidgets() +{ + QTC_ASSERT(!m_diagnosticView, return 0); + QTC_ASSERT(!m_diagnosticModel, return 0); + QTC_ASSERT(!m_goBack, return 0); + QTC_ASSERT(!m_goNext, return 0); + + // + // Diagnostic View + // + m_diagnosticView = new DetailedErrorView; + m_diagnosticView->setItemDelegate(new ClangStaticAnalyzerDiagnosticDelegate(m_diagnosticView)); + m_diagnosticView->setObjectName(QLatin1String("ClangStaticAnalyzerIssuesView")); + m_diagnosticView->setFrameStyle(QFrame::NoFrame); + m_diagnosticView->setAttribute(Qt::WA_MacShowFocusRect, false); + m_diagnosticModel = new ClangStaticAnalyzerDiagnosticModel(m_diagnosticView); + // TODO: Make use of the proxy model + QSortFilterProxyModel *proxyModel = new QSortFilterProxyModel(m_diagnosticView); + proxyModel->setSourceModel(m_diagnosticModel); + m_diagnosticView->setModel(proxyModel); + m_diagnosticView->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); + m_diagnosticView->setAutoScroll(false); + m_diagnosticView->setObjectName(QLatin1String("ClangStaticAnalyzerIssuesView")); + m_diagnosticView->setWindowTitle(tr("Clang Static Analyzer Issues")); + + QDockWidget *issuesDock = AnalyzerManager::createDockWidget(this, m_diagnosticView); + issuesDock->show(); + Utils::FancyMainWindow *mw = AnalyzerManager::mainWindow(); + mw->splitDockWidget(mw->toolBarDockWidget(), issuesDock, Qt::Vertical); + + // + // Toolbar widget + // + QHBoxLayout *layout = new QHBoxLayout; + layout->setMargin(0); + layout->setSpacing(0); + + QAction *action = 0; + QToolButton *button = 0; + + // Go to previous diagnostic + action = new QAction(this); + action->setDisabled(true); + action->setIcon(QIcon(QLatin1String(Core::Constants::ICON_PREV))); + action->setToolTip(tr("Go to previous bug.")); + connect(action, &QAction::triggered, m_diagnosticView, &DetailedErrorView::goBack); + button = new QToolButton; + button->setDefaultAction(action); + layout->addWidget(button); + m_goBack = action; + + // Go to next diagnostic + action = new QAction(this); + action->setDisabled(true); + action->setIcon(QIcon(QLatin1String(Core::Constants::ICON_NEXT))); + action->setToolTip(tr("Go to next bug.")); + connect(action, &QAction::triggered, m_diagnosticView, &DetailedErrorView::goNext); + button = new QToolButton; + button->setDefaultAction(action); + layout->addWidget(button); + m_goNext = action; + + layout->addStretch(); + + QWidget *toolbarWidget = new QWidget; + toolbarWidget->setObjectName(QLatin1String("ClangStaticAnalyzerToolBarWidget")); + toolbarWidget->setLayout(layout); + return toolbarWidget; +} + +AnalyzerRunControl *ClangStaticAnalyzerTool::createRunControl( + const AnalyzerStartParameters &sp, + ProjectExplorer::RunConfiguration *runConfiguration) +{ + ClangStaticAnalyzerRunControl *engine = new ClangStaticAnalyzerRunControl(sp, runConfiguration); + connect(engine, &ClangStaticAnalyzerRunControl::starting, + this, &ClangStaticAnalyzerTool::onEngineIsStarting); + connect(engine, &ClangStaticAnalyzerRunControl::newDiagnosticsAvailable, + this, &ClangStaticAnalyzerTool::onNewDiagnosticsAvailable); + connect(engine, &ClangStaticAnalyzerRunControl::finished, + this, &ClangStaticAnalyzerTool::onEngineFinished); + return engine; +} + +void ClangStaticAnalyzerTool::startTool(StartMode mode) +{ + QTC_ASSERT(mode == Analyzer::StartLocal, return); + + AnalyzerManager::showMode(); + if (Project *pro = SessionManager::startupProject()) + ProjectExplorerPlugin::instance()->runProject(pro, runMode()); +} + +void ClangStaticAnalyzerTool::onEngineIsStarting() +{ + QTC_ASSERT(m_diagnosticModel, return); + m_diagnosticModel->clear(); + setBusyCursor(true); +} + +void ClangStaticAnalyzerTool::onNewDiagnosticsAvailable(const QList &diagnostics) +{ + QTC_ASSERT(m_diagnosticModel, return); + m_diagnosticModel->addDiagnostics(diagnostics); +} + +void ClangStaticAnalyzerTool::onEngineFinished() +{ + QTC_ASSERT(m_goBack, return); + QTC_ASSERT(m_goNext, return); + QTC_ASSERT(m_diagnosticModel, return); + const int issuesFound = m_diagnosticModel->rowCount(); + m_goBack->setEnabled(issuesFound > 1); + m_goNext->setEnabled(issuesFound > 1); + setBusyCursor(false); + + AnalyzerManager::showStatusMessage(issuesFound > 0 + ? AnalyzerManager::tr("Clang Static Analyzer finished, %n issues were found.", 0, issuesFound) + : AnalyzerManager::tr("Clang Static Analyzer finished, no issues were found.")); +} + +void ClangStaticAnalyzerTool::setBusyCursor(bool busy) +{ + QTC_ASSERT(m_diagnosticView, return); + QCursor cursor(busy ? Qt::BusyCursor : Qt::ArrowCursor); + m_diagnosticView->setCursor(cursor); +} + +} // namespace Internal +} // namespace ClangStaticAnalyzer diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzertool.h b/plugins/clangstaticanalyzer/clangstaticanalyzertool.h new file mode 100644 index 00000000000..2cb1393a7a8 --- /dev/null +++ b/plugins/clangstaticanalyzer/clangstaticanalyzertool.h @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc +** 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 LicenseChecker Add-on. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** +****************************************************************************/ + +#ifndef CLANGSTATICANALYZERTOOL_H +#define CLANGSTATICANALYZERTOOL_H + +#include + +namespace Analyzer { class DetailedErrorView; } + +namespace ClangStaticAnalyzer { +namespace Internal { + +class ClangStaticAnalyzerDiagnosticModel; +class ClangStaticAnalyzerDiagnosticView; +class Diagnostic; + +class ClangStaticAnalyzerTool : public Analyzer::IAnalyzerTool +{ + Q_OBJECT + +public: + explicit ClangStaticAnalyzerTool(QObject *parent = 0); + +private: + QWidget *createWidgets(); + Analyzer::AnalyzerRunControl *createRunControl(const Analyzer::AnalyzerStartParameters &sp, + ProjectExplorer::RunConfiguration *runConfiguration); + void startTool(Analyzer::StartMode mode); + + void onEngineIsStarting(); + void onNewDiagnosticsAvailable(const QList &diagnostics); + void onEngineFinished(); + + void setBusyCursor(bool busy); + +private: + ClangStaticAnalyzerDiagnosticModel *m_diagnosticModel; + Analyzer::DetailedErrorView *m_diagnosticView; + + QAction *m_goBack; + QAction *m_goNext; +}; + +} // namespace Internal +} // namespace ClangStaticAnalyzer + +#endif // CLANGSTATICANALYZERTOOL_H diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerutils.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerutils.cpp new file mode 100644 index 00000000000..6beff9e1928 --- /dev/null +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerutils.cpp @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc +** 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 LicenseChecker Add-on. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** +****************************************************************************/ + +#include "clangstaticanalyzerutils.h" + +#include "clangstaticanalyzerdiagnostic.h" +#include "clangstaticanalyzersettings.h" + +#include + +#include + +static bool isFileExecutable(const QString &executablePath) +{ + if (executablePath.isEmpty()) + return false; + + const QFileInfo fileInfo(executablePath); + return fileInfo.isFile() && fileInfo.isExecutable(); +} + +namespace ClangStaticAnalyzer { +namespace Internal { + +QString clangExecutableFromSettings(bool *isValid) +{ + return clangExecutable(ClangStaticAnalyzerSettings::instance()->clangExecutable(), isValid); +} + +QString clangExecutable(const QString &fileNameOrPath, bool *isValid) +{ + QString executable = fileNameOrPath; + if (executable.isEmpty()) { + *isValid = false; + return executable; + } + + if (!QFileInfo(executable).isAbsolute()) { + const Utils::Environment &environment = Utils::Environment::systemEnvironment(); + const QString executableFromPath = environment.searchInPath(executable).toString(); + if (executableFromPath.isEmpty()) { + *isValid = false; + return executable; + } + executable = executableFromPath; + } + + *isValid = isFileExecutable(executable); + return executable; +} + +QString createFullLocationString(const ClangStaticAnalyzer::Internal::Location &location) +{ + const QString filePath = location.filePath; + const QString lineNumber = QString::number(location.line); + return filePath + QLatin1Char(':') + lineNumber; +} + +} // namespace Internal +} // namespace ClangStaticAnalyzer diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerutils.h b/plugins/clangstaticanalyzer/clangstaticanalyzerutils.h new file mode 100644 index 00000000000..8c634700228 --- /dev/null +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerutils.h @@ -0,0 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc +** 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 LicenseChecker Add-on. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** +****************************************************************************/ + +#ifndef CLANGSTATICANALYZERUTILS_H +#define CLANGSTATICANALYZERUTILS_H + +#include + +QT_BEGIN_NAMESPACE +class QString; +QT_END_NAMESPACE + + + +namespace ClangStaticAnalyzer { +namespace Internal { + +class Location; + +QString clangExecutable(const QString &fileNameOrPath, bool *isValid); +QString clangExecutableFromSettings(bool *isValid); + +QString createFullLocationString(const ClangStaticAnalyzer::Internal::Location &location); + +} // namespace Internal +} // namespace ClangStaticAnalyzer + +#endif // CLANGSTATICANALYZERUTILS_H diff --git a/plugins/clangstaticanalyzer/tests/clangstaticanalyzerlogfilereader/clangstaticanalyzerlogfilereader.pro b/plugins/clangstaticanalyzer/tests/clangstaticanalyzerlogfilereader/clangstaticanalyzerlogfilereader.pro new file mode 100644 index 00000000000..d9dda64f85d --- /dev/null +++ b/plugins/clangstaticanalyzer/tests/clangstaticanalyzerlogfilereader/clangstaticanalyzerlogfilereader.pro @@ -0,0 +1,14 @@ +include(../tests.pri) + +TARGET = tst_clangstaticanalyzerlogfilereader + +DEFINES += SRCDIR=\\\"$$PWD/\\\" + +SOURCES += \ + tst_clangstaticanalyzerlogfilereader.cpp \ + $$PLUGINDIR/clangstaticanalyzerdiagnostic.cpp \ + $$PLUGINDIR/clangstaticanalyzerlogfilereader.cpp + +HEADERS += \ + $$PLUGINDIR/clangstaticanalyzerdiagnostic.h \ + $$PLUGINDIR/clangstaticanalyzerlogfilereader.h diff --git a/plugins/clangstaticanalyzer/tests/clangstaticanalyzerlogfilereader/data/noDiagnostics.plist b/plugins/clangstaticanalyzer/tests/clangstaticanalyzerlogfilereader/data/noDiagnostics.plist new file mode 100644 index 00000000000..2cccbf770f9 --- /dev/null +++ b/plugins/clangstaticanalyzer/tests/clangstaticanalyzerlogfilereader/data/noDiagnostics.plist @@ -0,0 +1,14 @@ + + + + + clang_version +Ubuntu clang version 3.5-1ubuntu1 (trunk) (based on LLVM 3.5) + files + + + diagnostics + + + + \ No newline at end of file diff --git a/plugins/clangstaticanalyzer/tests/clangstaticanalyzerlogfilereader/data/someDiagnostics.plist b/plugins/clangstaticanalyzer/tests/clangstaticanalyzerlogfilereader/data/someDiagnostics.plist new file mode 100644 index 00000000000..3fa5effad2d --- /dev/null +++ b/plugins/clangstaticanalyzer/tests/clangstaticanalyzerlogfilereader/data/someDiagnostics.plist @@ -0,0 +1,162 @@ + + + + + clang_version +Ubuntu clang version 3.5-1ubuntu1 (trunk) (based on LLVM 3.5) + files + + ../csatestproject/core.CallAndMessage3.cpp + + diagnostics + + + path + + + kindcontrol + edges + + + start + + + line34 + col3 + file0 + + + line34 + col6 + file0 + + + end + + + line35 + col3 + file0 + + + line35 + col5 + file0 + + + + + + + kindevent + location + + line35 + col3 + file0 + + ranges + + + + line35 + col3 + file0 + + + line35 + col9 + file0 + + + + depth0 + extended_message + Null pointer value stored to 'foo' + message + Null pointer value stored to 'foo' + + + kindcontrol + edges + + + start + + + line35 + col3 + file0 + + + line35 + col5 + file0 + + + end + + + line36 + col3 + file0 + + + line36 + col5 + file0 + + + + + + + kindevent + location + + line36 + col3 + file0 + + ranges + + + + line36 + col3 + file0 + + + line36 + col5 + file0 + + + + depth0 + extended_message + Called function pointer is null (null dereference) + message + Called function pointer is null (null dereference) + + + descriptionCalled function pointer is null (null dereference) + categoryLogic error + typeCalled function pointer is null (null dereference) + issue_context_kindfunction + issue_contexttest + issue_hash3 + location + + line36 + col3 + file0 + + HTMLDiagnostics_files + + report-6c3c2a.html + + + + + \ No newline at end of file diff --git a/plugins/clangstaticanalyzer/tests/clangstaticanalyzerlogfilereader/tst_clangstaticanalyzerlogfilereader.cpp b/plugins/clangstaticanalyzer/tests/clangstaticanalyzerlogfilereader/tst_clangstaticanalyzerlogfilereader.cpp new file mode 100644 index 00000000000..76dd0cf8625 --- /dev/null +++ b/plugins/clangstaticanalyzer/tests/clangstaticanalyzerlogfilereader/tst_clangstaticanalyzerlogfilereader.cpp @@ -0,0 +1,175 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc +** 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 LicenseChecker Add-on. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** +****************************************************************************/ + +#include + +#include + +#include + +enum { debug = 0 }; + +namespace ClangStaticAnalyzer { +namespace Internal { + +static bool operator==(const Location &first, const Location &second) +{ + return first.filePath == second.filePath + && first.line == second.line + && first.column == second.column; +} + +} // namespace Internal +} // namespace ClangStaticAnalyzer + +using namespace ClangStaticAnalyzer::Internal; + +namespace { + +QDebug operator<<(QDebug dbg, const Location &location) +{ + dbg.nospace() << "Location(" << location.filePath << ", " + << location.line << ", " + << location.column << ')'; + return dbg.space(); +} + +QDebug operator<<(QDebug dbg, const ExplainingStep &step) +{ + dbg << '\n' + << " ExplainingStep\n" + << " location:" << step.location << '\n' + << " ranges:\n"; + foreach (const Location &location, step.ranges) + dbg << " " << location << '\n'; + dbg + << " message:" << step.message << '\n' + << " extendedMessage:" << step.extendedMessage << '\n' + << " depth:" << step.depth << '\n'; + return dbg; +} + +QDebug operator<<(QDebug dbg, const Diagnostic &diagnostic) +{ + dbg << "\nDiagnostic\n" + << " description:" << diagnostic.description << '\n' + << " category:" << diagnostic.category << '\n' + << " type:" << diagnostic.type << '\n' + << " issueContextKind:" << diagnostic.issueContextKind << '\n' + << " issueContext:" << diagnostic.issueContext << '\n' + << " location:" << diagnostic.location << '\n' + << " explaining steps:\n"; + foreach (const ExplainingStep &explaingStep, diagnostic.explainingSteps) + dbg << explaingStep; + return dbg; +} + +bool createEmptyFile(const QString &filePath) +{ + Utils::FileSaver saver(filePath); + return saver.write("") && saver.finalize(); +} + +QString testFilePath(const QString &relativePath) +{ + const QString fullPath = QString::fromLatin1(SRCDIR) + relativePath; + const QFileInfo fi(fullPath); + if (fi.exists() && fi.isReadable()) + return fullPath; + return QString(); +} + +} // anonymous namespace + +class ClangStaticAnalyzerLogFileReaderTest : public QObject +{ + Q_OBJECT + +private slots: + void readEmptyFile(); + void readFileWithNoDiagnostics(); + void readFileWithDiagnostics(); +}; + +void ClangStaticAnalyzerLogFileReaderTest::readEmptyFile() +{ + const QString filePath = QDir::tempPath() + QLatin1String("/empty.file"); + QVERIFY(createEmptyFile(filePath)); + + QString errorMessage; + const QList diagnostics = LogFileReader::read(filePath, &errorMessage); + QVERIFY(!errorMessage.isEmpty()); + if (debug) + qDebug() << errorMessage; + QVERIFY(diagnostics.isEmpty()); +} + +void ClangStaticAnalyzerLogFileReaderTest::readFileWithNoDiagnostics() +{ + const QString filePath = testFilePath(QLatin1String("/data/noDiagnostics.plist")); + + QString errorMessage; + const QList diagnostics = LogFileReader::read(filePath, &errorMessage); + QVERIFY(errorMessage.isEmpty()); + QVERIFY(diagnostics.isEmpty()); +} + +void ClangStaticAnalyzerLogFileReaderTest::readFileWithDiagnostics() +{ + const QString filePath = testFilePath(QLatin1String("/data/someDiagnostics.plist")); + + QString errorMessage; + const QList diagnostics = LogFileReader::read(filePath, &errorMessage); + QVERIFY(errorMessage.isEmpty()); + QVERIFY(!diagnostics.isEmpty()); + + const QString commonPath = QLatin1String("../csatestproject/core.CallAndMessage3.cpp"); + + const Diagnostic d1 = diagnostics.first(); + if (debug) + qDebug() << d1; + QCOMPARE(d1.description, QLatin1String("Called function pointer is null (null dereference)")); + QCOMPARE(d1.category, QLatin1String("Logic error")); + QCOMPARE(d1.type, d1.description); + QCOMPARE(d1.issueContextKind, QLatin1String("function")); + QCOMPARE(d1.issueContext, QLatin1String("test")); + QCOMPARE(d1.location, Location(commonPath, 36, 3)); + + QCOMPARE(d1.explainingSteps.size(), 2); + const ExplainingStep step1 = d1.explainingSteps.at(0); + QCOMPARE(step1.location, Location(commonPath, 35, 3)); + QCOMPARE(step1.ranges.size(), 2); + QCOMPARE(step1.ranges.at(0), Location(commonPath, 35, 3)); + QCOMPARE(step1.ranges.at(1), Location(commonPath, 35, 9)); + QCOMPARE(step1.depth, 0); + QCOMPARE(step1.message, QLatin1String("Null pointer value stored to 'foo'")); + QCOMPARE(step1.extendedMessage, step1.message); + + const ExplainingStep step2 = d1.explainingSteps.at(1); + QCOMPARE(step2.location, Location(commonPath, 36, 3)); + QCOMPARE(step2.ranges.size(), 2); + QCOMPARE(step2.ranges.at(0), Location(commonPath, 36, 3)); + QCOMPARE(step2.ranges.at(1), Location(commonPath, 36, 5)); + QCOMPARE(step2.depth, 0); + QCOMPARE(step2.message, QLatin1String("Called function pointer is null (null dereference)")); + QCOMPARE(step2.extendedMessage, step2.message); +} + +QTEST_MAIN(ClangStaticAnalyzerLogFileReaderTest) + +#include "tst_clangstaticanalyzerlogfilereader.moc" diff --git a/plugins/clangstaticanalyzer/tests/clangstaticanalyzerrunner/clangstaticanalyzerrunner.pro b/plugins/clangstaticanalyzer/tests/clangstaticanalyzerrunner/clangstaticanalyzerrunner.pro new file mode 100644 index 00000000000..b19bae40928 --- /dev/null +++ b/plugins/clangstaticanalyzer/tests/clangstaticanalyzerrunner/clangstaticanalyzerrunner.pro @@ -0,0 +1,11 @@ +include(../tests.pri) + +TARGET = tst_clangstaticanalyzerrunnertest + +DEFINES += SRCDIR=\\\"$$PWD/\\\" + +SOURCES += \ + tst_clangstaticanalyzerrunner.cpp \ + $$PLUGINDIR/clangstaticanalyzerrunner.cpp +HEADERS += \ + $$PLUGINDIR/clangstaticanalyzerrunner.h diff --git a/plugins/clangstaticanalyzer/tests/clangstaticanalyzerrunner/tst_clangstaticanalyzerrunner.cpp b/plugins/clangstaticanalyzer/tests/clangstaticanalyzerrunner/tst_clangstaticanalyzerrunner.cpp new file mode 100644 index 00000000000..c3a51062c8f --- /dev/null +++ b/plugins/clangstaticanalyzer/tests/clangstaticanalyzerrunner/tst_clangstaticanalyzerrunner.cpp @@ -0,0 +1,167 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc +** 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 LicenseChecker Add-on. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** +****************************************************************************/ + +#include +#include + +#include + +using namespace ClangStaticAnalyzer::Internal; + +class ClangStaticAnalyzerRunnerTest : public QObject +{ + Q_OBJECT + +public: + ClangStaticAnalyzerRunnerTest() {} + virtual ~ClangStaticAnalyzerRunnerTest() {} + +private slots: + void runWithTestCodeGeneratedOneIssue(); + void runWithNonExistentFileToAnalyze(); +}; + +static bool writeFile(const QString &filePath, const QByteArray &source) +{ + Utils::FileSaver saver(filePath); + return saver.write(source) && saver.finalize(); +} + +class ClangStaticAnalyzerRunnerSignalTester +{ +public: + ClangStaticAnalyzerRunnerSignalTester(ClangStaticAnalyzerRunner *runner); + + bool expectStartedSignal(); + bool expectFinishWithSuccessSignal(); + bool expectFinishWithFailureSignal(const QString &expectedErrorMessage = QString()); + +private: + QSignalSpy m_spyStarted; + QSignalSpy m_spyFinishedWithFailure; + QSignalSpy m_spyFinishedWithSuccess; +}; + +ClangStaticAnalyzerRunnerSignalTester::ClangStaticAnalyzerRunnerSignalTester( + ClangStaticAnalyzerRunner *runner) + : m_spyStarted(runner, SIGNAL(started())) + , m_spyFinishedWithFailure(runner, SIGNAL(finishedWithFailure(QString,QString))) + , m_spyFinishedWithSuccess(runner, SIGNAL(finishedWithSuccess(QString))) +{ +} + +bool ClangStaticAnalyzerRunnerSignalTester::expectStartedSignal() +{ + if (m_spyStarted.wait()) { + if (m_spyStarted.size() != 1) { + qDebug() << "started() emitted more than once."; + return false; + } + } else { + qDebug() << "started() not emitted."; + return false; + } + + return true; +} + +bool ClangStaticAnalyzerRunnerSignalTester::expectFinishWithSuccessSignal() +{ + if (m_spyFinishedWithSuccess.wait()) { + if (m_spyFinishedWithSuccess.size() != 1) { + qDebug() << "finishedWithSuccess() emitted more than once."; + return false; + } + } else { + qDebug() << "finishedWithSuccess() not emitted."; + return false; + } + + if (m_spyFinishedWithFailure.size() != 0) { + qDebug() << "finishedWithFailure() emitted."; + return false; + } + + return true; +} + +bool ClangStaticAnalyzerRunnerSignalTester::expectFinishWithFailureSignal( + const QString &expectedErrorMessage) +{ + if (m_spyFinishedWithFailure.wait()) { + if (m_spyFinishedWithFailure.size() == 1) { + const QList args = m_spyFinishedWithFailure.at(0); + const QString errorMessage = args.at(0).toString(); + if (errorMessage == expectedErrorMessage) { + if (m_spyFinishedWithSuccess.size() != 0) { + qDebug() << "Got expected error, but finishedWithSuccess() was also emitted."; + return false; + } + return true; + } else { + qDebug() << "Actual error message:" << errorMessage; + qDebug() << "Expected error message:" << expectedErrorMessage; + return false; + } + } else { + qDebug() << "Finished with more than one failure (expected only one)."; + return false; + } + } else { + qDebug() << "Not finished with failure, but expected."; + return false; + } +} + +void ClangStaticAnalyzerRunnerTest::runWithTestCodeGeneratedOneIssue() +{ + const QString testFilePath = QDir::tempPath() + QLatin1String("/testcode.cpp"); + const QByteArray source = + "void f(int *p) {}\n" + "void f2(int *p) {\n" + " delete p;\n" + " f(p); // warn: use after free\n" + "}\n"; + QVERIFY(writeFile(testFilePath, source)); + + QTemporaryDir temporaryDir(QDir::tempPath() + QLatin1String("/qtc-clangstaticanalyzer-XXXXXX")); + QVERIFY(temporaryDir.isValid()); + ClangStaticAnalyzerRunner runner(QLatin1String("clang"), temporaryDir.path()); + + ClangStaticAnalyzerRunnerSignalTester st(&runner); + QVERIFY(runner.run(testFilePath)); + QVERIFY(st.expectStartedSignal()); + QVERIFY(st.expectFinishWithSuccessSignal()); +} + +void ClangStaticAnalyzerRunnerTest::runWithNonExistentFileToAnalyze() +{ + QTemporaryDir temporaryDir(QDir::tempPath() + QLatin1String("/qtc-clangstaticanalyzer-XXXXXX")); + QVERIFY(temporaryDir.isValid()); + ClangStaticAnalyzerRunner runner(QLatin1String("clang"), temporaryDir.path()); + + ClangStaticAnalyzerRunnerSignalTester st(&runner); + QVERIFY(runner.run(QLatin1String("not.existing.file.111"))); + + QVERIFY(st.expectStartedSignal()); + QVERIFY(st.expectFinishWithFailureSignal(finishedWithBadExitCode(1))); +} + +QTEST_MAIN(ClangStaticAnalyzerRunnerTest) + +#include "tst_clangstaticanalyzerrunner.moc" diff --git a/plugins/clangstaticanalyzer/tests/tests.pri b/plugins/clangstaticanalyzer/tests/tests.pri new file mode 100644 index 00000000000..f7971f2624b --- /dev/null +++ b/plugins/clangstaticanalyzer/tests/tests.pri @@ -0,0 +1,21 @@ +QTC_LIB_DEPENDS += utils + +isEmpty(IDE_SOURCE_TREE): IDE_SOURCE_TREE=$$(QTC_SOURCE) +isEmpty(IDE_BUILD_TREE): IDE_BUILD_TREE=$$(QTC_BUILD) +isEmpty(IDE_SOURCE_TREE): error(Set QTC_SOURCE environment variable) +isEmpty(IDE_BUILD_TREE): error(Set QTC_BUILD environment variable) +isEmpty(QTC_PLUGIN_DIRS): error(Set QTC_PLUGIN_DIRS environment variable for extra plugins) + +include(../../../../qt-creator/qtcreator.pri) +include(../../../../qt-creator/tests/auto/qttestrpath.pri) + +PLUGINDIR=$$PWD/../ + +QT += testlib +QT -= gui + +CONFIG += console +CONFIG += testcase +CONFIG -= app_bundle + +TEMPLATE = app diff --git a/plugins/clangstaticanalyzer/tests/tests.pro b/plugins/clangstaticanalyzer/tests/tests.pro new file mode 100644 index 00000000000..72e7c586e9d --- /dev/null +++ b/plugins/clangstaticanalyzer/tests/tests.pro @@ -0,0 +1,6 @@ +TEMPLATE = subdirs +CONFIG += ordered + +SUBDIRS = \ + clangstaticanalyzerrunner \ + clangstaticanalyzerlogfilereader diff --git a/qtcreatorlibrary.pri b/qtcreatorlibrary.pri new file mode 100644 index 00000000000..aa11abf7005 --- /dev/null +++ b/qtcreatorlibrary.pri @@ -0,0 +1,7 @@ +IDE_SOURCE_TREE=$$(QTC_SOURCE) +IDE_BUILD_TREE=$$(QTC_BUILD) + +isEmpty(IDE_SOURCE_TREE):error(Set QTC_SOURCE environment variable) +isEmpty(IDE_BUILD_TREE):error(Set QTC_BUILD environment variable) + +include($$IDE_SOURCE_TREE/src/qtcreatorlibrary.pri) diff --git a/qtcreatorplugin.pri b/qtcreatorplugin.pri new file mode 100644 index 00000000000..190dbed1c3b --- /dev/null +++ b/qtcreatorplugin.pri @@ -0,0 +1,8 @@ +isEmpty(IDE_SOURCE_TREE): IDE_SOURCE_TREE=$$(QTC_SOURCE) +isEmpty(IDE_BUILD_TREE): IDE_BUILD_TREE=$$(QTC_BUILD) + +isEmpty(IDE_SOURCE_TREE):error(Set QTC_SOURCE environment variable) +isEmpty(IDE_BUILD_TREE):error(Set QTC_BUILD environment variable) + +INCLUDEPATH+= $$PWD/plugins +include($$IDE_SOURCE_TREE/src/qtcreatorplugin.pri) From 65f5c4c79aa3e0ab4a635bce6a18433f11977a91 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Thu, 16 Oct 2014 13:33:55 +0200 Subject: [PATCH 003/111] There is no PROVIDER anymore Change-Id: Id78aa8deda3907bd586726e0def1aba47ad6da1a Reviewed-by: Nikolai Kosjar --- plugins/clangstaticanalyzer/clangstaticanalyzer.pro | 1 - 1 file changed, 1 deletion(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzer.pro b/plugins/clangstaticanalyzer/clangstaticanalyzer.pro index 22c94b2bf6f..5c7e91c599f 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzer.pro +++ b/plugins/clangstaticanalyzer/clangstaticanalyzer.pro @@ -1,7 +1,6 @@ TARGET = ClangStaticAnalyzer TEMPLATE = lib -PROVIDER = Digia include(../../qtcreatorplugin.pri) include(clangstaticanalyzer_dependencies.pri) From 1bd5911005dff043c173803bd9387593e4fb2e55 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Thu, 16 Oct 2014 13:44:44 +0200 Subject: [PATCH 004/111] Only build it if the clang code model would be built Change-Id: I8e2ecb56f0c6cfdcbdce9b580db84f3c6c5c709e Reviewed-by: Nikolai Kosjar --- clangstaticanalyzer.pro | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/clangstaticanalyzer.pro b/clangstaticanalyzer.pro index 5a433f2bd4e..16928841eeb 100644 --- a/clangstaticanalyzer.pro +++ b/clangstaticanalyzer.pro @@ -1,6 +1,10 @@ TEMPLATE = subdirs CONFIG += ordered -SUBDIRS += plugins/clangstaticanalyzer +#only build on same condition as clang code model plugin +isEmpty(LLVM_INSTALL_DIR):LLVM_INSTALL_DIR=$$(LLVM_INSTALL_DIR) +!isEmpty(LLVM_INSTALL_DIR) { + SUBDIRS += plugins/clangstaticanalyzer +} QMAKE_EXTRA_TARGETS = docs install_docs # dummy targets for consistency From 002d0c1d855d6ed08b311ef02ba5b7bf04ed41c2 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Thu, 16 Oct 2014 14:07:47 +0200 Subject: [PATCH 005/111] Align to qt-creator 3.3 changes Change-Id: I3873c869f678c82b1e88c3860f62385de19ff20d Reviewed-by: Nikolai Kosjar --- .../clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp index b459f5c0229..1509e153107 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp @@ -31,6 +31,7 @@ #include #include +#include #include #include @@ -146,8 +147,8 @@ void ClangStaticAnalyzerRunControl::stopEngine() QStringList createDefinesAndIncludesOptions(const ProjectPart::Ptr projectPart) { QStringList result; - result += ClangCodeModel::Utils::createDefineOptions(projectPart->projectDefines, false); - result += ClangCodeModel::Utils::createHeaderPathOptions(projectPart->headerPaths); + result += CppTools::CompilerOptionsBuilder::createDefineOptions(projectPart->projectDefines); + result += CppTools::CompilerOptionsBuilder::createHeaderPathOptions(projectPart->headerPaths); result += QLatin1String("-fPIC"); // TODO: Remove? return result; } From c23adeaa9722c5286776539f03beecad5be16ce4 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Thu, 16 Oct 2014 15:19:12 +0200 Subject: [PATCH 006/111] Remove ClangCodeModel depenency Change-Id: I9357c380b2e432e7af61c7c14164ae5c196fccbd Reviewed-by: Nikolai Kosjar --- clangstaticanalyzer.pro | 6 +----- .../clangstaticanalyzer_dependencies.pri | 1 - 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/clangstaticanalyzer.pro b/clangstaticanalyzer.pro index 16928841eeb..5a433f2bd4e 100644 --- a/clangstaticanalyzer.pro +++ b/clangstaticanalyzer.pro @@ -1,10 +1,6 @@ TEMPLATE = subdirs CONFIG += ordered -#only build on same condition as clang code model plugin -isEmpty(LLVM_INSTALL_DIR):LLVM_INSTALL_DIR=$$(LLVM_INSTALL_DIR) -!isEmpty(LLVM_INSTALL_DIR) { - SUBDIRS += plugins/clangstaticanalyzer -} +SUBDIRS += plugins/clangstaticanalyzer QMAKE_EXTRA_TARGETS = docs install_docs # dummy targets for consistency diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzer_dependencies.pri b/plugins/clangstaticanalyzer/clangstaticanalyzer_dependencies.pri index 8579739916a..0ca1dbad9b1 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzer_dependencies.pri +++ b/plugins/clangstaticanalyzer/clangstaticanalyzer_dependencies.pri @@ -4,6 +4,5 @@ QTC_LIB_DEPENDS += \ utils QTC_PLUGIN_DEPENDS += \ analyzerbase \ - clangcodemodel \ cpptools \ licensechecker From 1eaef8dbb043c5055edb2f74bb0b46c3fa3a45d1 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Mon, 20 Oct 2014 13:08:49 +0200 Subject: [PATCH 007/111] Fix logging category names Change-Id: Ie4568879656a9c6c7f1713b354c4a8cf59934dd7 Reviewed-by: Nikolai Kosjar --- plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp | 2 +- plugins/clangstaticanalyzer/clangstaticanalyzerrunner.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp index 1509e153107..e30a58077a7 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp @@ -43,7 +43,7 @@ using namespace CppTools; using namespace ProjectExplorer; -static Q_LOGGING_CATEGORY(LOG, "qt.clangstaticanalyzer.runcontrol") +static Q_LOGGING_CATEGORY(LOG, "qtc.clangstaticanalyzer.runcontrol") namespace ClangStaticAnalyzer { namespace Internal { diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.cpp index 3db69c644b8..34732cfafa3 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.cpp @@ -26,7 +26,7 @@ #include #include -static Q_LOGGING_CATEGORY(LOG, "qt.clangstaticanalyzer.runner") +static Q_LOGGING_CATEGORY(LOG, "qtc.clangstaticanalyzer.runner") static QString generalProcessError() { From 8cca190dfc51f16b6dcc76f8a1337498cf6b5fcb Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Thu, 23 Oct 2014 17:19:54 +0200 Subject: [PATCH 008/111] Set experimental attribute Change-Id: I0eb38defb189c58b52de7cb424a7e2b72e0d205d Reviewed-by: Nikolai Kosjar --- plugins/clangstaticanalyzer/ClangStaticAnalyzer.json.in | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/clangstaticanalyzer/ClangStaticAnalyzer.json.in b/plugins/clangstaticanalyzer/ClangStaticAnalyzer.json.in index 0203fe1f027..77cc31b40d6 100644 --- a/plugins/clangstaticanalyzer/ClangStaticAnalyzer.json.in +++ b/plugins/clangstaticanalyzer/ClangStaticAnalyzer.json.in @@ -2,6 +2,7 @@ \"Name\" : \"ClangStaticAnalyzer\", \"Version\" : \"$$QTCREATOR_VERSION\", \"CompatVersion\" : \"$$QTCREATOR_COMPAT_VERSION\", + \"Experimental\" : true, \"Vendor\" : \"Digia Plc\", \"Copyright\" : \"(C) 2014 Digia Plc\", \"License\" : [ \"Commercial Usage\", From 3f8314024cdd6bfd76629826805b680f6756d117 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Thu, 23 Oct 2014 15:31:35 +0200 Subject: [PATCH 009/111] RunControl: Pass on toolchain defines and language options Change-Id: I3a44707f7f27e1b4bb781886b63b23a3c20e0414 Reviewed-by: Nikolai Kosjar --- .../clangstaticanalyzerruncontrol.cpp | 57 +++++++++++-------- .../clangstaticanalyzerruncontrol.h | 13 +++-- .../clangstaticanalyzerrunner.cpp | 10 ++-- .../clangstaticanalyzerrunner.h | 3 +- 4 files changed, 50 insertions(+), 33 deletions(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp index e30a58077a7..7710571effc 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp @@ -57,15 +57,15 @@ ClangStaticAnalyzerRunControl::ClangStaticAnalyzerRunControl( { } -static QList calculateFilesToProcess( +static QList calculateFilesToProcess( Project *project) { - typedef ClangStaticAnalyzerRunControl::FileConfiguration ProjectFileConfiguration; - QTC_ASSERT(project, return QList()); + typedef ClangStaticAnalyzerRunControl::SourceFileConfiguration SourceFileConfiguration; + QTC_ASSERT(project, return QList()); ProjectInfo projectInfo = CppModelManager::instance()->projectInfo(project); - QTC_ASSERT(projectInfo, return QList()); + QTC_ASSERT(projectInfo, return QList()); - QList files; + QList files; const QList projectParts = projectInfo.projectParts(); foreach (const ProjectPart::Ptr &projectPart, projectParts) { foreach (const ProjectFile &file, projectPart->files) { @@ -73,7 +73,7 @@ static QList calculateFilesToP continue; QTC_CHECK(file.kind != ProjectFile::Unclassified); if (ProjectFile::isSource(file.kind)) - files << ProjectFileConfiguration(file.path, projectPart); + files << SourceFileConfiguration(file, projectPart); } } @@ -111,10 +111,10 @@ bool ClangStaticAnalyzerRunControl::startEngine() m_clangLogFileDir = temporaryDir.path(); // Collect files - const QList filesToProcess = calculateFilesToProcess(currentProject); + const QList filesToProcess = calculateFilesToProcess(currentProject); qCDebug(LOG()) << "Files to process:"; - foreach (const FileConfiguration &fileConfig, filesToProcess) { - qCDebug(LOG()) << fileConfig.filePath + QLatin1String(" [") + foreach (const SourceFileConfiguration &fileConfig, filesToProcess) { + qCDebug(LOG()) << fileConfig.file.path + QLatin1String(" [") + fileConfig.projectPart->projectFile + QLatin1Char(']'); } m_filesToProcess = filesToProcess; @@ -144,15 +144,6 @@ void ClangStaticAnalyzerRunControl::stopEngine() m_filesToProcess.clear(); } -QStringList createDefinesAndIncludesOptions(const ProjectPart::Ptr projectPart) -{ - QStringList result; - result += CppTools::CompilerOptionsBuilder::createDefineOptions(projectPart->projectDefines); - result += CppTools::CompilerOptionsBuilder::createHeaderPathOptions(projectPart->headerPaths); - result += QLatin1String("-fPIC"); // TODO: Remove? - return result; -} - void ClangStaticAnalyzerRunControl::analyzeNextFile() { if (m_progress.isFinished()) @@ -167,14 +158,13 @@ void ClangStaticAnalyzerRunControl::analyzeNextFile() return; } - const FileConfiguration config = m_filesToProcess.takeFirst(); - const QString filePath = config.filePath; - const QStringList definesAndIncludesOptions - = createDefinesAndIncludesOptions(config.projectPart); + const SourceFileConfiguration config = m_filesToProcess.takeFirst(); + const QString filePath = config.file.path; + const QStringList options = config.createClangOptions(); ClangStaticAnalyzerRunner *runner = createRunner(); qCDebug(LOG) << "analyzeNextFile:" << filePath; - QTC_ASSERT(runner->run(filePath, definesAndIncludesOptions), return); + QTC_ASSERT(runner->run(filePath, options), return); ++m_runningProcesses; } @@ -232,5 +222,26 @@ void ClangStaticAnalyzerRunControl::updateProgressValue() m_progress.setProgressValue(m_initialFilesToProcessSize - m_filesToProcess.size()); } +QStringList ClangStaticAnalyzerRunControl::SourceFileConfiguration::createClangOptions() const +{ + QStringList result; + + if (file.path.endsWith(QLatin1String("cppmodelmanager.cpp"))) { + qDebug() << "here"; + } + + const bool objcExt = projectPart->languageExtensions & ProjectPart::ObjectiveCExtensions; + result += CppTools::CompilerOptionsBuilder::createLanguageOption(file.kind, objcExt); + result += CppTools::CompilerOptionsBuilder::createOptionsForLanguage( + projectPart->languageVersion, + projectPart->languageExtensions); + result += CppTools::CompilerOptionsBuilder::createDefineOptions(projectPart->toolchainDefines); + result += CppTools::CompilerOptionsBuilder::createDefineOptions(projectPart->projectDefines); + result += CppTools::CompilerOptionsBuilder::createHeaderPathOptions(projectPart->headerPaths); + result += QLatin1String("-fPIC"); // TODO: Remove? + + return result; +} + } // namespace Internal } // namespace ClangStaticAnalyzer diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h index 37148b399d7..036793571ef 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h @@ -36,12 +36,15 @@ class ClangStaticAnalyzerRunControl : public Analyzer::AnalyzerRunControl Q_OBJECT public: - struct FileConfiguration { - FileConfiguration(const QString &filePath, const CppTools::ProjectPart::Ptr &projectPart) - : filePath(filePath) + struct SourceFileConfiguration { + SourceFileConfiguration(const CppTools::ProjectFile &projectFile, + const CppTools::ProjectPart::Ptr &projectPart) + : file(projectFile) , projectPart(projectPart) {} - QString filePath; + QStringList createClangOptions() const; + + CppTools::ProjectFile file; CppTools::ProjectPart::Ptr projectPart; }; @@ -70,7 +73,7 @@ private: QString m_clangExecutable; QString m_clangLogFileDir; QFutureInterface m_progress; - QList m_filesToProcess; + QList m_filesToProcess; int m_initialFilesToProcessSize; int m_runningProcesses; }; diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.cpp index 34732cfafa3..2f5dad462e1 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.cpp @@ -40,14 +40,14 @@ static QString finishedDueToCrash() static QStringList constructCommandLineArguments(const QString &filePath, const QString &logFile, - const QStringList &definesAndIncludes) + const QStringList &options) { QStringList arguments = QStringList() << QLatin1String("--analyze") << QLatin1String("-o") << logFile ; - arguments += definesAndIncludes; + arguments += options; arguments << filePath; return arguments; } @@ -88,16 +88,18 @@ ClangStaticAnalyzerRunner::~ClangStaticAnalyzerRunner() m_process.kill(); } -bool ClangStaticAnalyzerRunner::run(const QString &filePath, const QStringList &definesAndIncludes) +bool ClangStaticAnalyzerRunner::run(const QString &filePath, const QStringList &compilerOptions) { QTC_ASSERT(!m_clangExecutable.isEmpty(), return false); + QTC_CHECK(!compilerOptions.contains(QLatin1String("-o"))); + QTC_CHECK(!compilerOptions.contains(filePath)); m_processOutput.clear(); m_logFile = createLogFile(filePath); QTC_ASSERT(!m_logFile.isEmpty(), return false); const QStringList arguments = constructCommandLineArguments(filePath, m_logFile, - definesAndIncludes); + compilerOptions); m_commandLine = m_clangExecutable + QLatin1Char(' ') + arguments.join(QLatin1Char(' ')); qCDebug(LOG) << "Starting" << m_commandLine; diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.h b/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.h index ada1b67d87d..cfd19727fe0 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.h @@ -40,7 +40,8 @@ public: QObject *parent = 0); ~ClangStaticAnalyzerRunner(); - bool run(const QString &filePath, const QStringList &definesAndIncludes = QStringList()); + // compilerOptions is expected to contain everything except: -o filePath + bool run(const QString &filePath, const QStringList &compilerOptions = QStringList()); signals: void started(); From a8f06e858f4019c025b108b4585c2dfc16f3cc4a Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Fri, 24 Oct 2014 10:21:32 +0200 Subject: [PATCH 010/111] RunControl: Use the project from the RunConfiguration Change-Id: I9f9214bc82e9d3ebecb3974ff5197f4af885fa07 Reviewed-by: Nikolai Kosjar --- .../clangstaticanalyzerruncontrol.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp index 7710571effc..f4ba4eb9751 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp @@ -34,8 +34,8 @@ #include #include -#include #include +#include #include #include @@ -84,8 +84,12 @@ bool ClangStaticAnalyzerRunControl::startEngine() { emit starting(this); - Project *currentProject = ProjectExplorerPlugin::currentProject(); - QTC_ASSERT(currentProject, emit finished(); return false); + RunConfiguration *runConfig = runConfiguration(); + QTC_ASSERT(runConfig, emit finished(); return false); + Target *target = runConfig->target(); + QTC_ASSERT(target, emit finished(); return false); + Project *project = target->project(); + QTC_ASSERT(project, emit finished(); return false); // Check clang executable bool isValidClangExecutable; @@ -111,7 +115,7 @@ bool ClangStaticAnalyzerRunControl::startEngine() m_clangLogFileDir = temporaryDir.path(); // Collect files - const QList filesToProcess = calculateFilesToProcess(currentProject); + const QList filesToProcess = calculateFilesToProcess(project); qCDebug(LOG()) << "Files to process:"; foreach (const SourceFileConfiguration &fileConfig, filesToProcess) { qCDebug(LOG()) << fileConfig.file.path + QLatin1String(" [") From 3163b602e1dd81e3fd958514df461f1986cf9b33 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Fri, 24 Oct 2014 10:23:15 +0200 Subject: [PATCH 011/111] Remove some debug code Change-Id: I0c23a5956ae921cdbe1e87cd12c3bc247fdedfbc Reviewed-by: Nikolai Kosjar --- plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp index f4ba4eb9751..ea583e5161a 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp @@ -230,10 +230,6 @@ QStringList ClangStaticAnalyzerRunControl::SourceFileConfiguration::createClangO { QStringList result; - if (file.path.endsWith(QLatin1String("cppmodelmanager.cpp"))) { - qDebug() << "here"; - } - const bool objcExt = projectPart->languageExtensions & ProjectPart::ObjectiveCExtensions; result += CppTools::CompilerOptionsBuilder::createLanguageOption(file.kind, objcExt); result += CppTools::CompilerOptionsBuilder::createOptionsForLanguage( From 168682571f1f5803b27cd062df0bc735c917c39d Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Fri, 24 Oct 2014 10:24:16 +0200 Subject: [PATCH 012/111] RunControl: qCDebug(LOG()) --> qCDebug(LOG) Change-Id: I31ae029e2bd66badebfb40dc026d7de2158c4c13 Reviewed-by: Nikolai Kosjar --- plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp index ea583e5161a..595514697eb 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp @@ -116,9 +116,9 @@ bool ClangStaticAnalyzerRunControl::startEngine() // Collect files const QList filesToProcess = calculateFilesToProcess(project); - qCDebug(LOG()) << "Files to process:"; + qCDebug(LOG) << "Files to process:"; foreach (const SourceFileConfiguration &fileConfig, filesToProcess) { - qCDebug(LOG()) << fileConfig.file.path + QLatin1String(" [") + qCDebug(LOG) << fileConfig.file.path + QLatin1String(" [") + fileConfig.projectPart->projectFile + QLatin1Char(']'); } m_filesToProcess = filesToProcess; From 76e920f71bcf7efdb1e42d64d1f8cf18636ef7ba Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Fri, 24 Oct 2014 10:41:36 +0200 Subject: [PATCH 013/111] Tests: Fix reference to qtcreator directory Change-Id: I1ba118394a3b97d9a2f6ddf94b1d12e0133c3d9d Reviewed-by: Nikolai Kosjar --- plugins/clangstaticanalyzer/tests/tests.pri | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/clangstaticanalyzer/tests/tests.pri b/plugins/clangstaticanalyzer/tests/tests.pri index f7971f2624b..88c0e5ab0c9 100644 --- a/plugins/clangstaticanalyzer/tests/tests.pri +++ b/plugins/clangstaticanalyzer/tests/tests.pri @@ -6,8 +6,8 @@ isEmpty(IDE_SOURCE_TREE): error(Set QTC_SOURCE environment variable) isEmpty(IDE_BUILD_TREE): error(Set QTC_BUILD environment variable) isEmpty(QTC_PLUGIN_DIRS): error(Set QTC_PLUGIN_DIRS environment variable for extra plugins) -include(../../../../qt-creator/qtcreator.pri) -include(../../../../qt-creator/tests/auto/qttestrpath.pri) +include($$IDE_SOURCE_TREE/qtcreator.pri) +include($$IDE_SOURCE_TREE/tests/auto/qttestrpath.pri) PLUGINDIR=$$PWD/../ From 5634d16e4a84381f5a73fe9121527cbdae5df6d3 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Fri, 24 Oct 2014 11:07:24 +0200 Subject: [PATCH 014/111] Tests: Fix running tests Change-Id: I5e32a900ce5a55ae4d49dd8fdae7e375e861a227 Reviewed-by: Nikolai Kosjar --- plugins/clangstaticanalyzer/tests/tests.pri | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/clangstaticanalyzer/tests/tests.pri b/plugins/clangstaticanalyzer/tests/tests.pri index 88c0e5ab0c9..b7cfc9154c8 100644 --- a/plugins/clangstaticanalyzer/tests/tests.pri +++ b/plugins/clangstaticanalyzer/tests/tests.pri @@ -4,13 +4,13 @@ isEmpty(IDE_SOURCE_TREE): IDE_SOURCE_TREE=$$(QTC_SOURCE) isEmpty(IDE_BUILD_TREE): IDE_BUILD_TREE=$$(QTC_BUILD) isEmpty(IDE_SOURCE_TREE): error(Set QTC_SOURCE environment variable) isEmpty(IDE_BUILD_TREE): error(Set QTC_BUILD environment variable) -isEmpty(QTC_PLUGIN_DIRS): error(Set QTC_PLUGIN_DIRS environment variable for extra plugins) + +PLUGINDIR = $$PWD/.. +INCLUDEPATH += $$PLUGINDIR/.. include($$IDE_SOURCE_TREE/qtcreator.pri) include($$IDE_SOURCE_TREE/tests/auto/qttestrpath.pri) -PLUGINDIR=$$PWD/../ - QT += testlib QT -= gui From 8fc13e4afda2dadd1621d6111e2823bebc4a1048 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Fri, 24 Oct 2014 11:30:33 +0200 Subject: [PATCH 015/111] Runner: Clarify requirements for run() Change-Id: I51bfe1382e7692582dc361a65f104c17e578eb53 Reviewed-by: Nikolai Kosjar --- plugins/clangstaticanalyzer/clangstaticanalyzerrunner.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.h b/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.h index cfd19727fe0..b535ec10778 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.h @@ -40,7 +40,9 @@ public: QObject *parent = 0); ~ClangStaticAnalyzerRunner(); - // compilerOptions is expected to contain everything except: -o filePath + // compilerOptions is expected to contain everything except: + // (1) filePath, that is the file to analyze + // (2) -o output-file bool run(const QString &filePath, const QStringList &compilerOptions = QStringList()); signals: From c7c93810c403f4d2a936255953c70df32761cb23 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Mon, 27 Oct 2014 15:00:32 +0100 Subject: [PATCH 016/111] RunControlFactory: Do not limit to LocalApplicationRunConfiguration Change-Id: I088ef62b8baf98392cbda962f272ea4742bb8fc1 Reviewed-by: Nikolai Kosjar --- .../clangstaticanalyzerruncontrolfactory.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp index dbc165c805e..b07802d797e 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp @@ -22,8 +22,6 @@ #include #include -#include - using namespace Analyzer; using namespace ProjectExplorer; @@ -38,8 +36,8 @@ ClangStaticAnalyzerRunControlFactory::ClangStaticAnalyzerRunControlFactory(QObje bool ClangStaticAnalyzerRunControlFactory::canRun(RunConfiguration *runConfiguration, RunMode runMode) const { - return runMode == ClangStaticAnalyzerMode - && (qobject_cast(runConfiguration)); + Q_UNUSED(runConfiguration); + return runMode == ClangStaticAnalyzerMode; } RunControl *ClangStaticAnalyzerRunControlFactory::create(RunConfiguration *runConfiguration, @@ -49,9 +47,6 @@ RunControl *ClangStaticAnalyzerRunControlFactory::create(RunConfiguration *runCo Q_UNUSED(errorMessage); Q_UNUSED(runMode); - auto *rc = qobject_cast(runConfiguration); - QTC_ASSERT(rc, return 0); - AnalyzerStartParameters sp; sp.runMode = runMode; sp.startMode = StartLocal; From c9feffd2a05d986185a0c7e5bd3b58d65b81c9df Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Mon, 27 Oct 2014 15:13:17 +0100 Subject: [PATCH 017/111] RunControlFactory: Limit to Clang/GCC toolchain Change-Id: Ib50572a062f0bbe9950fee108b53ba8e7370f459 Reviewed-by: Nikolai Kosjar --- .../clangstaticanalyzerruncontrolfactory.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp index b07802d797e..a8896b45654 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp @@ -22,6 +22,12 @@ #include #include +#include +#include +#include +#include +#include + using namespace Analyzer; using namespace ProjectExplorer; @@ -36,8 +42,16 @@ ClangStaticAnalyzerRunControlFactory::ClangStaticAnalyzerRunControlFactory(QObje bool ClangStaticAnalyzerRunControlFactory::canRun(RunConfiguration *runConfiguration, RunMode runMode) const { - Q_UNUSED(runConfiguration); - return runMode == ClangStaticAnalyzerMode; + if (runMode != ClangStaticAnalyzerMode) + return false; + + Target *target = runConfiguration->target(); + QTC_ASSERT(target, return false); + Kit *kit = target->kit(); + QTC_ASSERT(kit, return false); + ToolChain *toolChain = ToolChainKitInformation::toolChain(kit); + QTC_ASSERT(toolChain, return false); + return toolChain->type() == QLatin1String("clang") || toolChain->type() == QLatin1String("gcc"); } RunControl *ClangStaticAnalyzerRunControlFactory::create(RunConfiguration *runConfiguration, From cb49d04f460cea9beba84587a710efac78189b69 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Tue, 28 Oct 2014 09:52:52 +0100 Subject: [PATCH 018/111] Runner: Print command line with quoted arguments ...for easier debugging. Change-Id: I53d4128defd9ac03350ce38d4d3f687191921a15 Reviewed-by: Nikolai Kosjar --- plugins/clangstaticanalyzer/clangstaticanalyzerrunner.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.cpp index 2f5dad462e1..e3c63625bf7 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.cpp @@ -100,7 +100,7 @@ bool ClangStaticAnalyzerRunner::run(const QString &filePath, const QStringList & QTC_ASSERT(!m_logFile.isEmpty(), return false); const QStringList arguments = constructCommandLineArguments(filePath, m_logFile, compilerOptions); - m_commandLine = m_clangExecutable + QLatin1Char(' ') + arguments.join(QLatin1Char(' ')); + m_commandLine = (QStringList(m_clangExecutable) + arguments).join(QLatin1String("\" \"")); qCDebug(LOG) << "Starting" << m_commandLine; m_process.start(m_clangExecutable, arguments); From 4acbedf841436b88843c7c18dfdef711ad9c00a2 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Tue, 28 Oct 2014 09:44:26 +0100 Subject: [PATCH 019/111] RunControl: Fix 'Stop' Terminate/kill current runners, so that the GUI will reflect that quite soon and not if all runners finished. Change-Id: I83eed6ecf1678444a8b38bab6cc05d8694a4eb49 Reviewed-by: Nikolai Kosjar --- .../clangstaticanalyzerruncontrol.cpp | 20 ++++++++++++------- .../clangstaticanalyzerruncontrol.h | 2 +- .../clangstaticanalyzerrunner.cpp | 9 +++++++-- 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp index 595514697eb..86939bdfd9e 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp @@ -53,7 +53,6 @@ ClangStaticAnalyzerRunControl::ClangStaticAnalyzerRunControl( ProjectExplorer::RunConfiguration *runConfiguration) : AnalyzerRunControl(startParams, runConfiguration) , m_initialFilesToProcessSize(0) - , m_runningProcesses(0) { } @@ -135,17 +134,25 @@ bool ClangStaticAnalyzerRunControl::startEngine() m_progress.reportStarted(); // Start process(es) + m_runners.clear(); const int parallelRuns = ClangStaticAnalyzerSettings::instance()->simultaneousProcesses(); QTC_ASSERT(parallelRuns >= 1, emit finished(); return false); - m_runningProcesses = 0; - while (m_runningProcesses < parallelRuns && !m_filesToProcess.isEmpty()) + while (m_runners.size() < parallelRuns && !m_filesToProcess.isEmpty()) analyzeNextFile(); return true; } void ClangStaticAnalyzerRunControl::stopEngine() { + QSetIterator i(m_runners); + while (i.hasNext()) { + ClangStaticAnalyzerRunner *runner = i.next(); + QObject::disconnect(runner, 0, this, 0); + delete runner; + } + m_runners.clear(); m_filesToProcess.clear(); + analyzeNextFile(); // emits finished } void ClangStaticAnalyzerRunControl::analyzeNextFile() @@ -154,8 +161,7 @@ void ClangStaticAnalyzerRunControl::analyzeNextFile() return; // The previous call already reported that we are finished. if (m_filesToProcess.isEmpty()) { - QTC_ASSERT(m_runningProcesses >= 0, return); - if (m_runningProcesses == 0) { + if (m_runners.size() == 0) { m_progress.reportFinished(); emit finished(); } @@ -167,9 +173,9 @@ void ClangStaticAnalyzerRunControl::analyzeNextFile() const QStringList options = config.createClangOptions(); ClangStaticAnalyzerRunner *runner = createRunner(); + m_runners.insert(runner); qCDebug(LOG) << "analyzeNextFile:" << filePath; QTC_ASSERT(runner->run(filePath, options), return); - ++m_runningProcesses; } ClangStaticAnalyzerRunner *ClangStaticAnalyzerRunControl::createRunner() @@ -208,7 +214,7 @@ void ClangStaticAnalyzerRunControl::onRunnerFinishedWithFailure(const QString &e void ClangStaticAnalyzerRunControl::handleFinished() { - --m_runningProcesses; + m_runners.remove(qobject_cast(sender())); updateProgressValue(); sender()->deleteLater(); analyzeNextFile(); diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h index 036793571ef..661594bf112 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h @@ -74,8 +74,8 @@ private: QString m_clangLogFileDir; QFutureInterface m_progress; QList m_filesToProcess; + QSet m_runners; int m_initialFilesToProcessSize; - int m_runningProcesses; }; } // namespace Internal diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.cpp index e3c63625bf7..ed8efb93f84 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.cpp @@ -84,8 +84,13 @@ ClangStaticAnalyzerRunner::ClangStaticAnalyzerRunner(const QString &clangExecuta ClangStaticAnalyzerRunner::~ClangStaticAnalyzerRunner() { const QProcess::ProcessState processState = m_process.state(); - if (processState == QProcess::Starting || processState == QProcess::Running) - m_process.kill(); + if (processState == QProcess::Starting || processState == QProcess::Running) { + m_process.terminate(); + if (!m_process.waitForFinished(500)) { + m_process.kill(); + m_process.waitForFinished(); + } + } } bool ClangStaticAnalyzerRunner::run(const QString &filePath, const QStringList &compilerOptions) From f6eb83490a3f4a793eea1dad3d0d23e4d2fc801c Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Wed, 29 Oct 2014 10:40:00 +0100 Subject: [PATCH 020/111] RunControl: Announce starting and finishing in Application output pane Change-Id: I040f848dbdd6ef92ce03525e91c4b536390df9b4 Reviewed-by: Nikolai Kosjar --- .../clangstaticanalyzerruncontrol.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp index 86939bdfd9e..e0c7b11e716 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp @@ -90,12 +90,16 @@ bool ClangStaticAnalyzerRunControl::startEngine() Project *project = target->project(); QTC_ASSERT(project, emit finished(); return false); + const QString projectFile = project->projectFilePath().toString(); + appendMessage(tr("Running Clang Static Analyzer on %1").arg(projectFile) + QLatin1Char('\n'), + Utils::NormalMessageFormat); + // Check clang executable bool isValidClangExecutable; const QString executable = clangExecutableFromSettings(&isValidClangExecutable); if (!isValidClangExecutable) { - emit appendMessage(tr("Clang Static Analyzer: Invalid executable \"%1\", stop.\n") - .arg(executable), + emit appendMessage(tr("Clang Static Analyzer: Invalid executable \"%1\", stop.") + .arg(executable) + QLatin1Char('\n'), Utils::ErrorMessageFormat); emit finished(); return false; @@ -106,8 +110,8 @@ bool ClangStaticAnalyzerRunControl::startEngine() QTemporaryDir temporaryDir(QDir::tempPath() + QLatin1String("/qtc-clangstaticanalyzer-XXXXXX")); temporaryDir.setAutoRemove(false); if (!temporaryDir.isValid()) { - emit appendMessage(tr("Clang Static Analyzer: Failed to create temporary dir, stop.\n"), - Utils::ErrorMessageFormat); + emit appendMessage(tr("Clang Static Analyzer: Failed to create temporary dir, stop.") + + QLatin1Char('\n'), Utils::ErrorMessageFormat); emit finished(); return false; } @@ -162,6 +166,8 @@ void ClangStaticAnalyzerRunControl::analyzeNextFile() if (m_filesToProcess.isEmpty()) { if (m_runners.size() == 0) { + appendMessage(tr("Clang Static Analyzer finished.") + QLatin1Char('\n'), + Utils::NormalMessageFormat); m_progress.reportFinished(); emit finished(); } @@ -199,6 +205,7 @@ void ClangStaticAnalyzerRunControl::onRunnerFinishedWithSuccess(const QString &l QString errorMessage; const QList diagnostics = LogFileReader::read(logFilePath, &errorMessage); + QTC_CHECK(errorMessage.isEmpty()); if (!errorMessage.isEmpty()) qCDebug(LOG) << "onRunnerFinishedWithSuccess: Error reading log file:" << errorMessage; if (!diagnostics.isEmpty()) From 23136eb749b15daa9dc4be0b7e3d5aca949cd747 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Thu, 30 Oct 2014 17:35:52 +0100 Subject: [PATCH 021/111] RunControl: Show more status in Application Output pane Change-Id: I07e80e5a987612c19247a2d9a0628382b1136a06 Reviewed-by: Nikolai Kosjar --- .../clangstaticanalyzerruncontrol.cpp | 42 +++++++++++++++---- .../clangstaticanalyzerruncontrol.h | 2 + .../clangstaticanalyzerrunner.cpp | 10 ++++- .../clangstaticanalyzerrunner.h | 3 ++ 4 files changed, 48 insertions(+), 9 deletions(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp index e0c7b11e716..7c7e8a15547 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp @@ -53,6 +53,8 @@ ClangStaticAnalyzerRunControl::ClangStaticAnalyzerRunControl( ProjectExplorer::RunConfiguration *runConfiguration) : AnalyzerRunControl(startParams, runConfiguration) , m_initialFilesToProcessSize(0) + , m_filesAnalyzed(0) + , m_filesNotAnalyzed(0) { } @@ -126,6 +128,8 @@ bool ClangStaticAnalyzerRunControl::startEngine() } m_filesToProcess = filesToProcess; m_initialFilesToProcessSize = m_filesToProcess.count(); + m_filesAnalyzed = 0; + m_filesNotAnalyzed = 0; // Set up progress information using namespace Core; @@ -156,7 +160,10 @@ void ClangStaticAnalyzerRunControl::stopEngine() } m_runners.clear(); m_filesToProcess.clear(); - analyzeNextFile(); // emits finished + appendMessage(tr("Clang Static Analyzer stopped by user.") + QLatin1Char('\n'), + Utils::NormalMessageFormat); + m_progress.reportFinished(); + emit finished(); } void ClangStaticAnalyzerRunControl::analyzeNextFile() @@ -166,7 +173,11 @@ void ClangStaticAnalyzerRunControl::analyzeNextFile() if (m_filesToProcess.isEmpty()) { if (m_runners.size() == 0) { - appendMessage(tr("Clang Static Analyzer finished.") + QLatin1Char('\n'), + appendMessage(tr("Clang Static Analyzer finished: " + "Processed %1 files successfully, %2 failed.") + .arg(m_filesAnalyzed) + .arg(m_filesNotAnalyzed) + + QLatin1Char('\n'), Utils::NormalMessageFormat); m_progress.reportFinished(); emit finished(); @@ -182,6 +193,8 @@ void ClangStaticAnalyzerRunControl::analyzeNextFile() m_runners.insert(runner); qCDebug(LOG) << "analyzeNextFile:" << filePath; QTC_ASSERT(runner->run(filePath, options), return); + appendMessage(tr("Analyzing \"%1\".").arg(filePath) + QLatin1Char('\n'), + Utils::StdOutFormat); } ClangStaticAnalyzerRunner *ClangStaticAnalyzerRunControl::createRunner() @@ -201,21 +214,36 @@ ClangStaticAnalyzerRunner *ClangStaticAnalyzerRunControl::createRunner() void ClangStaticAnalyzerRunControl::onRunnerFinishedWithSuccess(const QString &logFilePath) { qCDebug(LOG) << "onRunnerFinishedWithSuccess:" << logFilePath; - handleFinished(); QString errorMessage; const QList diagnostics = LogFileReader::read(logFilePath, &errorMessage); - QTC_CHECK(errorMessage.isEmpty()); - if (!errorMessage.isEmpty()) + if (!errorMessage.isEmpty()) { qCDebug(LOG) << "onRunnerFinishedWithSuccess: Error reading log file:" << errorMessage; - if (!diagnostics.isEmpty()) - emit newDiagnosticsAvailable(diagnostics); + const QString filePath = qobject_cast(sender())->filePath(); + appendMessage(tr("Failed to analyze \"%1\": %2").arg(filePath, errorMessage) + + QLatin1Char('\n') + , Utils::StdErrFormat); + } else { + ++m_filesAnalyzed; + if (!diagnostics.isEmpty()) + emit newDiagnosticsAvailable(diagnostics); + } + + handleFinished(); } void ClangStaticAnalyzerRunControl::onRunnerFinishedWithFailure(const QString &errorMessage, const QString &errorDetails) { qCDebug(LOG) << "onRunnerFinishedWithFailure:" << errorMessage << errorDetails; + + ++m_filesNotAnalyzed; + const QString filePath = qobject_cast(sender())->filePath(); + appendMessage(tr("Failed to analyze \"%1\": %2").arg(filePath, errorMessage) + + QLatin1Char('\n') + , Utils::StdErrFormat); + appendMessage(errorDetails, Utils::StdErrFormat); + handleFinished(); } diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h index 661594bf112..03397517178 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h @@ -76,6 +76,8 @@ private: QList m_filesToProcess; QSet m_runners; int m_initialFilesToProcessSize; + int m_filesAnalyzed; + int m_filesNotAnalyzed; }; } // namespace Internal diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.cpp index ed8efb93f84..1d4e5b527af 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.cpp @@ -99,6 +99,7 @@ bool ClangStaticAnalyzerRunner::run(const QString &filePath, const QStringList & QTC_CHECK(!compilerOptions.contains(QLatin1String("-o"))); QTC_CHECK(!compilerOptions.contains(filePath)); + m_filePath = filePath; m_processOutput.clear(); m_logFile = createLogFile(filePath); @@ -112,6 +113,11 @@ bool ClangStaticAnalyzerRunner::run(const QString &filePath, const QStringList & return true; } +QString ClangStaticAnalyzerRunner::filePath() const +{ + return m_filePath; +} + void ClangStaticAnalyzerRunner::onProcessStarted() { emit started(); @@ -161,8 +167,8 @@ QString ClangStaticAnalyzerRunner::createLogFile(const QString &filePath) const QString ClangStaticAnalyzerRunner::processCommandlineAndOutput() const { return QObject::tr("Command line: \"%1\"\n" - "Process Error: \"%2\"\n" - "Output:\n\"%3\"") + "Process Error: %2\n" + "Output:\n%3") .arg(m_commandLine, QString::number(m_process.error()), QString::fromLocal8Bit(m_processOutput)); diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.h b/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.h index b535ec10778..461f694e2e7 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.h @@ -45,6 +45,8 @@ public: // (2) -o output-file bool run(const QString &filePath, const QStringList &compilerOptions = QStringList()); + QString filePath() const; + signals: void started(); void finishedWithSuccess(const QString &logFilePath); @@ -62,6 +64,7 @@ private: private: QString m_clangExecutable; QString m_clangLogFileDir; + QString m_filePath; QString m_logFile; QString m_commandLine; QProcess m_process; From d61117e814d6f79064b239a7f6fee3afae043255 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Fri, 31 Oct 2014 10:37:11 +0100 Subject: [PATCH 022/111] Tool: Clear model already before building the project Change-Id: I507056c9a5ee950bd95541a9e3042e9af23c0731 Reviewed-by: Nikolai Kosjar --- .../clangstaticanalyzer/clangstaticanalyzertool.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp index 143043d73fe..bc7b60d7e6f 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp @@ -144,15 +144,18 @@ void ClangStaticAnalyzerTool::startTool(StartMode mode) QTC_ASSERT(mode == Analyzer::StartLocal, return); AnalyzerManager::showMode(); - if (Project *pro = SessionManager::startupProject()) - ProjectExplorerPlugin::instance()->runProject(pro, runMode()); + + m_diagnosticModel->clear(); + setBusyCursor(true); + Project *pro = SessionManager::startupProject(); + QTC_ASSERT(pro, return); + ProjectExplorerPlugin::instance()->runProject(pro, runMode()); } void ClangStaticAnalyzerTool::onEngineIsStarting() { QTC_ASSERT(m_diagnosticModel, return); - m_diagnosticModel->clear(); - setBusyCursor(true); + } void ClangStaticAnalyzerTool::onNewDiagnosticsAvailable(const QList &diagnostics) From 1acf562612e0cf155e59572e3c919728ca0ea13e Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Fri, 31 Oct 2014 13:54:49 +0100 Subject: [PATCH 023/111] Runner: Use Utils::SynchronousProcess::stopProcess Change-Id: I77b0b039dae230c80a02f1692985c517bdd52023 Reviewed-by: Nikolai Kosjar --- .../clangstaticanalyzer/clangstaticanalyzerrunner.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.cpp index 1d4e5b527af..5c469a07a22 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.cpp @@ -20,6 +20,8 @@ #include "clangstaticanalyzerconstants.h" +#include + #include #include #include @@ -83,14 +85,7 @@ ClangStaticAnalyzerRunner::ClangStaticAnalyzerRunner(const QString &clangExecuta ClangStaticAnalyzerRunner::~ClangStaticAnalyzerRunner() { - const QProcess::ProcessState processState = m_process.state(); - if (processState == QProcess::Starting || processState == QProcess::Running) { - m_process.terminate(); - if (!m_process.waitForFinished(500)) { - m_process.kill(); - m_process.waitForFinished(); - } - } + Utils::SynchronousProcess::stopProcess(m_process); } bool ClangStaticAnalyzerRunner::run(const QString &filePath, const QStringList &compilerOptions) From aa98ee27559dc79ac874755f190e2cbe9d817dfe Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Fri, 31 Oct 2014 15:55:32 +0100 Subject: [PATCH 024/111] Tool: Warn on run in Release mode Change-Id: I3443ccc8daf37a1b10b43df3736fcf24c7ae2fea Reviewed-by: Nikolai Kosjar --- .../clangstaticanalyzertool.cpp | 49 +++++++++++++++++-- 1 file changed, 45 insertions(+), 4 deletions(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp index bc7b60d7e6f..c2b663074ef 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp @@ -24,10 +24,14 @@ #include #include +#include +#include #include #include #include +#include +#include #include #include @@ -139,23 +143,60 @@ AnalyzerRunControl *ClangStaticAnalyzerTool::createRunControl( return engine; } +static bool dontStartAfterHintForDebugMode() +{ + const Project *project = SessionManager::startupProject(); + BuildConfiguration::BuildType buildType = BuildConfiguration::Unknown; + if (project) { + if (const Target *target = project->activeTarget()) { + if (const BuildConfiguration *buildConfig = target->activeBuildConfiguration()) + buildType = buildConfig->buildType(); + } + } + + if (buildType == BuildConfiguration::Release) { + const QString wrongMode = ClangStaticAnalyzerTool::tr("Release"); + const QString toolName = ClangStaticAnalyzerTool::tr("Clang Static Analyzer"); + const QString title = ClangStaticAnalyzerTool::tr("Run %1 in %2 Mode?").arg(toolName) + .arg(wrongMode); + const QString message = ClangStaticAnalyzerTool::tr( + "" + "

You are trying to run the tool \"%1\" on an application in %2 mode. The tool is " + "designed to be used in Debug mode since enabled assertions can reduce the number of " + "false positives.

" + "

Do you want to continue and run the tool in %2 mode?

" + "") + .arg(toolName).arg(wrongMode); + if (Utils::CheckableMessageBox::doNotAskAgainQuestion(Core::ICore::mainWindow(), + title, message, Core::ICore::settings(), + QLatin1String("ClangStaticAnalyzerCorrectModeWarning"), + QDialogButtonBox::Yes|QDialogButtonBox::Cancel, + QDialogButtonBox::Cancel, QDialogButtonBox::Yes) != QDialogButtonBox::Yes) + return true; + } + + return false; +} + void ClangStaticAnalyzerTool::startTool(StartMode mode) { QTC_ASSERT(mode == Analyzer::StartLocal, return); AnalyzerManager::showMode(); + if (dontStartAfterHintForDebugMode()) + return; + m_diagnosticModel->clear(); setBusyCursor(true); - Project *pro = SessionManager::startupProject(); - QTC_ASSERT(pro, return); - ProjectExplorerPlugin::instance()->runProject(pro, runMode()); + Project *project = SessionManager::startupProject(); + QTC_ASSERT(project, return); + ProjectExplorerPlugin::instance()->runProject(project, runMode()); } void ClangStaticAnalyzerTool::onEngineIsStarting() { QTC_ASSERT(m_diagnosticModel, return); - } void ClangStaticAnalyzerTool::onNewDiagnosticsAvailable(const QList &diagnostics) From 273f2b8c5df7232751bcf6999f549cf22417c23c Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Thu, 16 Oct 2014 13:14:45 +0200 Subject: [PATCH 025/111] Load the plugin only on Linux / OS X On these platforms clang and/or gcc are available and the QMakeProject and QbsProject can provide "enough" information. Windows/MinGW: Currently mingw 4.8.2 can't be used with clang 3.5. See https://www.mail-archive.com/mingw-w64-public@lists.sourceforge.net/msg09490.html Tests with mingw 4.9 are needed. Windows/MSVC: This needs more investigation. Observations so far: * Does not work at the moment calling clang.exe. * clang-cl.exe does not understand '--analyze'. Passing '-Xclang --analyze' in does not help either. Change-Id: I83afe4a186cba67faf7bd0ad6c1de42790e281b2 Reviewed-by: Eike Ziller --- plugins/clangstaticanalyzer/ClangStaticAnalyzer.json.in | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/clangstaticanalyzer/ClangStaticAnalyzer.json.in b/plugins/clangstaticanalyzer/ClangStaticAnalyzer.json.in index 77cc31b40d6..13c2aa5b82f 100644 --- a/plugins/clangstaticanalyzer/ClangStaticAnalyzer.json.in +++ b/plugins/clangstaticanalyzer/ClangStaticAnalyzer.json.in @@ -3,6 +3,7 @@ \"Version\" : \"$$QTCREATOR_VERSION\", \"CompatVersion\" : \"$$QTCREATOR_COMPAT_VERSION\", \"Experimental\" : true, + \"Platform\" : \"(Linux.*)|(OS X.*)\", \"Vendor\" : \"Digia Plc\", \"Copyright\" : \"(C) 2014 Digia Plc\", \"License\" : [ \"Commercial Usage\", From 36d306c5ba384dfb0e8adf49aa3967b3f8c8cf01 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Fri, 7 Nov 2014 10:19:44 +0100 Subject: [PATCH 026/111] Adapt to qtcreator 3.3 changes / Compile fix Change-Id: I6074f163184b5287b4ba6b791cadbeeb47ae1e4e Reviewed-by: Nikolai Kosjar --- plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp index 7c7e8a15547..7f794983f20 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp @@ -64,7 +64,7 @@ static QList calculateFi typedef ClangStaticAnalyzerRunControl::SourceFileConfiguration SourceFileConfiguration; QTC_ASSERT(project, return QList()); ProjectInfo projectInfo = CppModelManager::instance()->projectInfo(project); - QTC_ASSERT(projectInfo, return QList()); + QTC_ASSERT(projectInfo.isValid(), return QList()); QList files; const QList projectParts = projectInfo.projectParts(); From 22003c8ea05926ae1faa5497e60cacff9fadfbdd Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Thu, 30 Oct 2014 11:57:09 +0100 Subject: [PATCH 027/111] RunControl: Handle also ProjectInfo::CompilerCallData ...if it's available. Change-Id: I41b8ab30e0c87ddd223f115e759bbd2a2c86cc68 Reviewed-by: Nikolai Kosjar --- .../clangstaticanalyzerruncontrol.cpp | 146 ++++++++++++------ .../clangstaticanalyzerruncontrol.h | 16 +- 2 files changed, 107 insertions(+), 55 deletions(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp index 7f794983f20..ba371407955 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp @@ -58,27 +58,103 @@ ClangStaticAnalyzerRunControl::ClangStaticAnalyzerRunControl( { } -static QList calculateFilesToProcess( - Project *project) +// Removes (1) filePath (2) -o +static QStringList tweakedArguments(const QString &filePath, const QStringList &arguments) { - typedef ClangStaticAnalyzerRunControl::SourceFileConfiguration SourceFileConfiguration; - QTC_ASSERT(project, return QList()); - ProjectInfo projectInfo = CppModelManager::instance()->projectInfo(project); - QTC_ASSERT(projectInfo.isValid(), return QList()); + QStringList newArguments; + + bool skip = false; + foreach (const QString &argument, arguments) { + if (skip) { + skip = false; + continue; + } else if (argument == QLatin1String("-o")) { + skip = true; + continue; + } else if (argument == filePath) { + continue; // TODO: Let it in? + } + + newArguments << argument; + } + QTC_CHECK(skip == false); + + return newArguments; +} + +static QStringList argumentsFromProjectPart(const CppTools::ProjectPart::Ptr &projectPart, + CppTools::ProjectFile::Kind fileKind) +{ + QStringList result; + + const bool objcExt = projectPart->languageExtensions & ProjectPart::ObjectiveCExtensions; + result += CppTools::CompilerOptionsBuilder::createLanguageOption(fileKind, objcExt); + result += CppTools::CompilerOptionsBuilder::createOptionsForLanguage( + projectPart->languageVersion, + projectPart->languageExtensions); + result += CppTools::CompilerOptionsBuilder::createDefineOptions(projectPart->toolchainDefines); + result += CppTools::CompilerOptionsBuilder::createDefineOptions(projectPart->projectDefines); + result += CppTools::CompilerOptionsBuilder::createHeaderPathOptions(projectPart->headerPaths); + result += QLatin1String("-fPIC"); // TODO: Remove? + + return result; +} + +static QList unitsToAnalyzeFromCompilerCallData( + const ProjectInfo::CompilerCallData &compilerCallData) +{ + typedef ClangStaticAnalyzerRunControl::AnalyzeUnit AnalyzeUnit; + qCDebug(LOG) << "Taking arguments for analyzing from CompilerCallData."; + + QList unitsToAnalyze; + + QHashIterator > it(compilerCallData); + while (it.hasNext()) { + it.next(); + const QString file = it.key(); + const QList compilerCalls = it.value(); + foreach (const QStringList &options, compilerCalls) { + const QStringList arguments = tweakedArguments(file, options); + unitsToAnalyze << AnalyzeUnit(file, arguments); + } + } + + return unitsToAnalyze; +} + +static QList unitsToAnalyzeFromProjectParts( + const QList projectParts) +{ + typedef ClangStaticAnalyzerRunControl::AnalyzeUnit AnalyzeUnit; + qCDebug(LOG) << "Taking arguments for analyzing from ProjectParts."; + + QList unitsToAnalyze; - QList files; - const QList projectParts = projectInfo.projectParts(); foreach (const ProjectPart::Ptr &projectPart, projectParts) { foreach (const ProjectFile &file, projectPart->files) { if (file.path == CppModelManager::configurationFileName()) continue; QTC_CHECK(file.kind != ProjectFile::Unclassified); - if (ProjectFile::isSource(file.kind)) - files << SourceFileConfiguration(file, projectPart); + if (ProjectFile::isSource(file.kind)) { + const QStringList arguments = argumentsFromProjectPart(projectPart, file.kind); + unitsToAnalyze << AnalyzeUnit(file.path, arguments); + } } } - return files; + return unitsToAnalyze; +} + +static QList unitsToAnalyze(Project *project) +{ + QTC_ASSERT(project, return QList()); + ProjectInfo projectInfo = CppModelManager::instance()->projectInfo(project); + QTC_ASSERT(projectInfo.isValid(), return QList()); + + const ProjectInfo::CompilerCallData compilerCallData = projectInfo.compilerCallData(); + if (!compilerCallData.isEmpty()) + return unitsToAnalyzeFromCompilerCallData(compilerCallData); + return unitsToAnalyzeFromProjectParts(projectInfo.projectParts()); } bool ClangStaticAnalyzerRunControl::startEngine() @@ -120,14 +196,12 @@ bool ClangStaticAnalyzerRunControl::startEngine() m_clangLogFileDir = temporaryDir.path(); // Collect files - const QList filesToProcess = calculateFilesToProcess(project); + const QList filesToProcess = unitsToAnalyze(project); qCDebug(LOG) << "Files to process:"; - foreach (const SourceFileConfiguration &fileConfig, filesToProcess) { - qCDebug(LOG) << fileConfig.file.path + QLatin1String(" [") - + fileConfig.projectPart->projectFile + QLatin1Char(']'); - } - m_filesToProcess = filesToProcess; - m_initialFilesToProcessSize = m_filesToProcess.count(); + foreach (const AnalyzeUnit &fileConfig, filesToProcess) + qCDebug(LOG) << fileConfig.file; + m_unitsToProcess = filesToProcess; + m_initialFilesToProcessSize = m_unitsToProcess.count(); m_filesAnalyzed = 0; m_filesNotAnalyzed = 0; @@ -145,7 +219,7 @@ bool ClangStaticAnalyzerRunControl::startEngine() m_runners.clear(); const int parallelRuns = ClangStaticAnalyzerSettings::instance()->simultaneousProcesses(); QTC_ASSERT(parallelRuns >= 1, emit finished(); return false); - while (m_runners.size() < parallelRuns && !m_filesToProcess.isEmpty()) + while (m_runners.size() < parallelRuns && !m_unitsToProcess.isEmpty()) analyzeNextFile(); return true; } @@ -159,7 +233,7 @@ void ClangStaticAnalyzerRunControl::stopEngine() delete runner; } m_runners.clear(); - m_filesToProcess.clear(); + m_unitsToProcess.clear(); appendMessage(tr("Clang Static Analyzer stopped by user.") + QLatin1Char('\n'), Utils::NormalMessageFormat); m_progress.reportFinished(); @@ -171,7 +245,7 @@ void ClangStaticAnalyzerRunControl::analyzeNextFile() if (m_progress.isFinished()) return; // The previous call already reported that we are finished. - if (m_filesToProcess.isEmpty()) { + if (m_unitsToProcess.isEmpty()) { if (m_runners.size() == 0) { appendMessage(tr("Clang Static Analyzer finished: " "Processed %1 files successfully, %2 failed.") @@ -185,15 +259,14 @@ void ClangStaticAnalyzerRunControl::analyzeNextFile() return; } - const SourceFileConfiguration config = m_filesToProcess.takeFirst(); - const QString filePath = config.file.path; - const QStringList options = config.createClangOptions(); + const AnalyzeUnit unit = m_unitsToProcess.takeFirst(); + qCDebug(LOG) << "analyzeNextFile:" << unit.file; ClangStaticAnalyzerRunner *runner = createRunner(); m_runners.insert(runner); - qCDebug(LOG) << "analyzeNextFile:" << filePath; - QTC_ASSERT(runner->run(filePath, options), return); - appendMessage(tr("Analyzing \"%1\".").arg(filePath) + QLatin1Char('\n'), + QTC_ASSERT(runner->run(unit.file, unit.arguments), return); + + appendMessage(tr("Analyzing \"%1\".").arg(unit.file) + QLatin1Char('\n'), Utils::StdOutFormat); } @@ -264,24 +337,7 @@ void ClangStaticAnalyzerRunControl::onProgressCanceled() void ClangStaticAnalyzerRunControl::updateProgressValue() { - m_progress.setProgressValue(m_initialFilesToProcessSize - m_filesToProcess.size()); -} - -QStringList ClangStaticAnalyzerRunControl::SourceFileConfiguration::createClangOptions() const -{ - QStringList result; - - const bool objcExt = projectPart->languageExtensions & ProjectPart::ObjectiveCExtensions; - result += CppTools::CompilerOptionsBuilder::createLanguageOption(file.kind, objcExt); - result += CppTools::CompilerOptionsBuilder::createOptionsForLanguage( - projectPart->languageVersion, - projectPart->languageExtensions); - result += CppTools::CompilerOptionsBuilder::createDefineOptions(projectPart->toolchainDefines); - result += CppTools::CompilerOptionsBuilder::createDefineOptions(projectPart->projectDefines); - result += CppTools::CompilerOptionsBuilder::createHeaderPathOptions(projectPart->headerPaths); - result += QLatin1String("-fPIC"); // TODO: Remove? - - return result; + m_progress.setProgressValue(m_initialFilesToProcessSize - m_unitsToProcess.size()); } } // namespace Internal diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h index 03397517178..8de898c23a0 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h @@ -36,16 +36,12 @@ class ClangStaticAnalyzerRunControl : public Analyzer::AnalyzerRunControl Q_OBJECT public: - struct SourceFileConfiguration { - SourceFileConfiguration(const CppTools::ProjectFile &projectFile, - const CppTools::ProjectPart::Ptr &projectPart) - : file(projectFile) - , projectPart(projectPart) {} + struct AnalyzeUnit { + AnalyzeUnit(const QString &file, const QStringList &options) + : file(file), arguments(options) {} - QStringList createClangOptions() const; - - CppTools::ProjectFile file; - CppTools::ProjectPart::Ptr projectPart; + QString file; + QStringList arguments; // without file itself and "-o somePath" }; public: @@ -73,7 +69,7 @@ private: QString m_clangExecutable; QString m_clangLogFileDir; QFutureInterface m_progress; - QList m_filesToProcess; + QList m_unitsToProcess; QSet m_runners; int m_initialFilesToProcessSize; int m_filesAnalyzed; From 2f3666a3f05bfe5e71241b55ce72e913d547f2a4 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Wed, 5 Nov 2014 13:28:44 +0100 Subject: [PATCH 028/111] Ensure that project configuration did not change Otherwise we might try to analyze invalid or vanished files. Change-Id: I387dfb127618f2db21a538b07e1c152dbd026ca6 Reviewed-by: Nikolai Kosjar --- .../clangstaticanalyzerplugin.cpp | 5 ++- .../clangstaticanalyzerruncontrol.cpp | 23 +++++------- .../clangstaticanalyzerruncontrol.h | 5 ++- .../clangstaticanalyzerruncontrolfactory.cpp | 35 +++++++++++++++++-- .../clangstaticanalyzerruncontrolfactory.h | 8 ++++- .../clangstaticanalyzertool.cpp | 23 ++++++++++-- .../clangstaticanalyzertool.h | 5 +++ 7 files changed, 81 insertions(+), 23 deletions(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp index 0a321d64e88..e635305b97d 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp @@ -121,10 +121,9 @@ bool ClangStaticAnalyzerPlugin::initializeEnterpriseFeatures(const QStringList & Q_UNUSED(arguments); Q_UNUSED(errorString); - addAutoReleasedObject(new ClangStaticAnalyzerOptionsPage); - addAutoReleasedObject(new ClangStaticAnalyzerRunControlFactory); - m_analyzerTool = new ClangStaticAnalyzerTool(this); + addAutoReleasedObject(new ClangStaticAnalyzerRunControlFactory(m_analyzerTool)); + addAutoReleasedObject(new ClangStaticAnalyzerOptionsPage); const QString toolTip = tr("Clang Static Analyzer uses the analyzer from the clang project " "to find bugs."); diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp index ba371407955..17a63f3a200 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp @@ -49,9 +49,11 @@ namespace ClangStaticAnalyzer { namespace Internal { ClangStaticAnalyzerRunControl::ClangStaticAnalyzerRunControl( - const Analyzer::AnalyzerStartParameters &startParams, - ProjectExplorer::RunConfiguration *runConfiguration) + const Analyzer::AnalyzerStartParameters &startParams, + ProjectExplorer::RunConfiguration *runConfiguration, + const ProjectInfo &projectInfo) : AnalyzerRunControl(startParams, runConfiguration) + , m_projectInfo(projectInfo) , m_initialFilesToProcessSize(0) , m_filesAnalyzed(0) , m_filesNotAnalyzed(0) @@ -145,10 +147,9 @@ static QList unitsToAnalyzeFromProje return unitsToAnalyze; } -static QList unitsToAnalyze(Project *project) +static QList unitsToAnalyze( + const CppTools::ProjectInfo &projectInfo) { - QTC_ASSERT(project, return QList()); - ProjectInfo projectInfo = CppModelManager::instance()->projectInfo(project); QTC_ASSERT(projectInfo.isValid(), return QList()); const ProjectInfo::CompilerCallData compilerCallData = projectInfo.compilerCallData(); @@ -161,14 +162,8 @@ bool ClangStaticAnalyzerRunControl::startEngine() { emit starting(this); - RunConfiguration *runConfig = runConfiguration(); - QTC_ASSERT(runConfig, emit finished(); return false); - Target *target = runConfig->target(); - QTC_ASSERT(target, emit finished(); return false); - Project *project = target->project(); - QTC_ASSERT(project, emit finished(); return false); - - const QString projectFile = project->projectFilePath().toString(); + QTC_ASSERT(m_projectInfo.isValid(), emit finished(); return false); + const QString projectFile = m_projectInfo.project()->projectFilePath().toString(); appendMessage(tr("Running Clang Static Analyzer on %1").arg(projectFile) + QLatin1Char('\n'), Utils::NormalMessageFormat); @@ -196,7 +191,7 @@ bool ClangStaticAnalyzerRunControl::startEngine() m_clangLogFileDir = temporaryDir.path(); // Collect files - const QList filesToProcess = unitsToAnalyze(project); + const QList filesToProcess = unitsToAnalyze(m_projectInfo); qCDebug(LOG) << "Files to process:"; foreach (const AnalyzeUnit &fileConfig, filesToProcess) qCDebug(LOG) << fileConfig.file; diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h index 8de898c23a0..cc56f107f63 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h @@ -46,7 +46,8 @@ public: public: explicit ClangStaticAnalyzerRunControl(const Analyzer::AnalyzerStartParameters &startParams, - ProjectExplorer::RunConfiguration *runConfiguration); + ProjectExplorer::RunConfiguration *runConfiguration, + const CppTools::ProjectInfo &projectInfo); bool startEngine(); void stopEngine(); @@ -66,6 +67,8 @@ private: void updateProgressValue(); private: + const CppTools::ProjectInfo m_projectInfo; + QString m_clangExecutable; QString m_clangLogFileDir; QFutureInterface m_progress; diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp index a8896b45654..df683464db8 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp @@ -22,21 +22,31 @@ #include #include +#include +#include + #include #include #include +#include #include #include +#include + using namespace Analyzer; using namespace ProjectExplorer; namespace ClangStaticAnalyzer { namespace Internal { -ClangStaticAnalyzerRunControlFactory::ClangStaticAnalyzerRunControlFactory(QObject *parent) +ClangStaticAnalyzerRunControlFactory::ClangStaticAnalyzerRunControlFactory( + ClangStaticAnalyzerTool *tool, + QObject *parent) : IRunControlFactory(parent) + , m_tool(tool) { + QTC_CHECK(m_tool); } bool ClangStaticAnalyzerRunControlFactory::canRun(RunConfiguration *runConfiguration, @@ -58,9 +68,30 @@ RunControl *ClangStaticAnalyzerRunControlFactory::create(RunConfiguration *runCo RunMode runMode, QString *errorMessage) { - Q_UNUSED(errorMessage); Q_UNUSED(runMode); + using namespace CppTools; + const ProjectInfo projectInfoAtAnalyzerStart = m_tool->projectInfo(); + QTC_ASSERT(projectInfoAtAnalyzerStart.isValid(), return 0); + + Project *project = SessionManager::startupProject(); + QTC_ASSERT(project, return 0); + const ProjectInfo projectInfoNow = CppModelManager::instance()->projectInfo(project); + + if (projectInfoNow.configurationOrFilesChanged(projectInfoAtAnalyzerStart)) { + // If it's more than a release/debug build configuration change, e.g. + // a version control checkout, files might be not valid C++ anymore + // or even gone, so better stop here. + + m_tool->resetCursorAndProjectInfo(); + if (errorMessage) { + *errorMessage = tr( + "The project configuration changed since the start of the Clang Static Analyzer. " + "Please re-run with current configuration."); + } + return 0; + } + AnalyzerStartParameters sp; sp.runMode = runMode; sp.startMode = StartLocal; diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.h b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.h index ec3b2d8c9c0..a3256919727 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.h @@ -19,6 +19,8 @@ #ifndef CLANGSTATICANALYZERRUNCONTROLFACTORY_H #define CLANGSTATICANALYZERRUNCONTROLFACTORY_H +#include "clangstaticanalyzertool.h" + #include namespace ClangStaticAnalyzer { @@ -29,7 +31,8 @@ class ClangStaticAnalyzerRunControlFactory : public ProjectExplorer::IRunControl Q_OBJECT public: - explicit ClangStaticAnalyzerRunControlFactory(QObject *parent = 0); + explicit ClangStaticAnalyzerRunControlFactory(ClangStaticAnalyzerTool *tool, + QObject *parent = 0); bool canRun(ProjectExplorer::RunConfiguration *runConfiguration, ProjectExplorer::RunMode runMode) const; @@ -37,6 +40,9 @@ public: ProjectExplorer::RunControl *create(ProjectExplorer::RunConfiguration *runConfiguration, ProjectExplorer::RunMode runMode, QString *errorMessage); + +private: + ClangStaticAnalyzerTool *m_tool; }; } // namespace Internal diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp index c2b663074ef..591e8da4cef 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -133,7 +134,11 @@ AnalyzerRunControl *ClangStaticAnalyzerTool::createRunControl( const AnalyzerStartParameters &sp, ProjectExplorer::RunConfiguration *runConfiguration) { - ClangStaticAnalyzerRunControl *engine = new ClangStaticAnalyzerRunControl(sp, runConfiguration); + QTC_ASSERT(runConfiguration, return 0); + QTC_ASSERT(m_projectInfo.isValid(), return 0); + + ClangStaticAnalyzerRunControl *engine = new ClangStaticAnalyzerRunControl(sp, runConfiguration, + m_projectInfo); connect(engine, &ClangStaticAnalyzerRunControl::starting, this, &ClangStaticAnalyzerTool::onEngineIsStarting); connect(engine, &ClangStaticAnalyzerRunControl::newDiagnosticsAvailable, @@ -192,6 +197,18 @@ void ClangStaticAnalyzerTool::startTool(StartMode mode) Project *project = SessionManager::startupProject(); QTC_ASSERT(project, return); ProjectExplorerPlugin::instance()->runProject(project, runMode()); + m_projectInfo = CppTools::CppModelManager::instance()->projectInfo(project); +} + +CppTools::ProjectInfo ClangStaticAnalyzerTool::projectInfo() const +{ + return m_projectInfo; +} + +void ClangStaticAnalyzerTool::resetCursorAndProjectInfo() +{ + setBusyCursor(false); + m_projectInfo = CppTools::ProjectInfo(); } void ClangStaticAnalyzerTool::onEngineIsStarting() @@ -210,10 +227,12 @@ void ClangStaticAnalyzerTool::onEngineFinished() QTC_ASSERT(m_goBack, return); QTC_ASSERT(m_goNext, return); QTC_ASSERT(m_diagnosticModel, return); + + resetCursorAndProjectInfo(); + const int issuesFound = m_diagnosticModel->rowCount(); m_goBack->setEnabled(issuesFound > 1); m_goNext->setEnabled(issuesFound > 1); - setBusyCursor(false); AnalyzerManager::showStatusMessage(issuesFound > 0 ? AnalyzerManager::tr("Clang Static Analyzer finished, %n issues were found.", 0, issuesFound) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzertool.h b/plugins/clangstaticanalyzer/clangstaticanalyzertool.h index 2cb1393a7a8..f049740d895 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzertool.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzertool.h @@ -20,6 +20,7 @@ #define CLANGSTATICANALYZERTOOL_H #include +#include namespace Analyzer { class DetailedErrorView; } @@ -36,6 +37,8 @@ class ClangStaticAnalyzerTool : public Analyzer::IAnalyzerTool public: explicit ClangStaticAnalyzerTool(QObject *parent = 0); + CppTools::ProjectInfo projectInfo() const; + void resetCursorAndProjectInfo(); private: QWidget *createWidgets(); @@ -50,6 +53,8 @@ private: void setBusyCursor(bool busy); private: + CppTools::ProjectInfo m_projectInfo; + ClangStaticAnalyzerDiagnosticModel *m_diagnosticModel; Analyzer::DetailedErrorView *m_diagnosticView; From b6a50a1a4c46b6b935a2b56c0f7362f324f2f35f Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Fri, 7 Nov 2014 11:32:40 +0100 Subject: [PATCH 029/111] Use updated ProjectInfo ...that actually make us use the ProjectInfo with updated CompilerCallData. Change-Id: Ieee298b3db64159f3faa02231921275e4466bcb5 Reviewed-by: Nikolai Kosjar --- .../clangstaticanalyzerruncontrolfactory.cpp | 10 +++---- .../clangstaticanalyzertool.cpp | 30 +++++++++++++------ .../clangstaticanalyzertool.h | 6 ++-- 3 files changed, 29 insertions(+), 17 deletions(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp index df683464db8..94f7f271639 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp @@ -71,19 +71,19 @@ RunControl *ClangStaticAnalyzerRunControlFactory::create(RunConfiguration *runCo Q_UNUSED(runMode); using namespace CppTools; - const ProjectInfo projectInfoAtAnalyzerStart = m_tool->projectInfo(); - QTC_ASSERT(projectInfoAtAnalyzerStart.isValid(), return 0); + const ProjectInfo projectInfoBeforeBuild = m_tool->projectInfoBeforeBuild(); + QTC_ASSERT(projectInfoBeforeBuild.isValid(), return 0); Project *project = SessionManager::startupProject(); QTC_ASSERT(project, return 0); - const ProjectInfo projectInfoNow = CppModelManager::instance()->projectInfo(project); + const ProjectInfo projectInfoAfterBuild = CppModelManager::instance()->projectInfo(project); - if (projectInfoNow.configurationOrFilesChanged(projectInfoAtAnalyzerStart)) { + if (projectInfoAfterBuild.configurationOrFilesChanged(projectInfoBeforeBuild)) { // If it's more than a release/debug build configuration change, e.g. // a version control checkout, files might be not valid C++ anymore // or even gone, so better stop here. - m_tool->resetCursorAndProjectInfo(); + m_tool->resetCursorAndProjectInfoBeforeBuild(); if (errorMessage) { *errorMessage = tr( "The project configuration changed since the start of the Clang Static Analyzer. " diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp index 591e8da4cef..5042267776d 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp @@ -135,10 +135,21 @@ AnalyzerRunControl *ClangStaticAnalyzerTool::createRunControl( ProjectExplorer::RunConfiguration *runConfiguration) { QTC_ASSERT(runConfiguration, return 0); - QTC_ASSERT(m_projectInfo.isValid(), return 0); + QTC_ASSERT(m_projectInfoBeforeBuild.isValid(), return 0); - ClangStaticAnalyzerRunControl *engine = new ClangStaticAnalyzerRunControl(sp, runConfiguration, - m_projectInfo); + // Some projects provides CompilerCallData once a build is finished, + // so pass on the updated Project Info unless no configuration change + // (defines/includes/files) happened. + Project *project = SessionManager::startupProject(); + QTC_ASSERT(project, return 0); + const CppTools::ProjectInfo projectInfoAfterBuild + = CppTools::CppModelManager::instance()->projectInfo(project); + QTC_ASSERT(!projectInfoAfterBuild.configurationOrFilesChanged(m_projectInfoBeforeBuild), + return 0); + m_projectInfoBeforeBuild = CppTools::ProjectInfo(); + + ClangStaticAnalyzerRunControl *engine + = new ClangStaticAnalyzerRunControl(sp, runConfiguration, projectInfoAfterBuild); connect(engine, &ClangStaticAnalyzerRunControl::starting, this, &ClangStaticAnalyzerTool::onEngineIsStarting); connect(engine, &ClangStaticAnalyzerRunControl::newDiagnosticsAvailable, @@ -196,19 +207,20 @@ void ClangStaticAnalyzerTool::startTool(StartMode mode) setBusyCursor(true); Project *project = SessionManager::startupProject(); QTC_ASSERT(project, return); + m_projectInfoBeforeBuild = CppTools::CppModelManager::instance()->projectInfo(project); + QTC_ASSERT(m_projectInfoBeforeBuild.isValid(), return); ProjectExplorerPlugin::instance()->runProject(project, runMode()); - m_projectInfo = CppTools::CppModelManager::instance()->projectInfo(project); } -CppTools::ProjectInfo ClangStaticAnalyzerTool::projectInfo() const +CppTools::ProjectInfo ClangStaticAnalyzerTool::projectInfoBeforeBuild() const { - return m_projectInfo; + return m_projectInfoBeforeBuild; } -void ClangStaticAnalyzerTool::resetCursorAndProjectInfo() +void ClangStaticAnalyzerTool::resetCursorAndProjectInfoBeforeBuild() { setBusyCursor(false); - m_projectInfo = CppTools::ProjectInfo(); + m_projectInfoBeforeBuild = CppTools::ProjectInfo(); } void ClangStaticAnalyzerTool::onEngineIsStarting() @@ -228,7 +240,7 @@ void ClangStaticAnalyzerTool::onEngineFinished() QTC_ASSERT(m_goNext, return); QTC_ASSERT(m_diagnosticModel, return); - resetCursorAndProjectInfo(); + resetCursorAndProjectInfoBeforeBuild(); const int issuesFound = m_diagnosticModel->rowCount(); m_goBack->setEnabled(issuesFound > 1); diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzertool.h b/plugins/clangstaticanalyzer/clangstaticanalyzertool.h index f049740d895..8f3bb1f1965 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzertool.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzertool.h @@ -37,8 +37,8 @@ class ClangStaticAnalyzerTool : public Analyzer::IAnalyzerTool public: explicit ClangStaticAnalyzerTool(QObject *parent = 0); - CppTools::ProjectInfo projectInfo() const; - void resetCursorAndProjectInfo(); + CppTools::ProjectInfo projectInfoBeforeBuild() const; + void resetCursorAndProjectInfoBeforeBuild(); private: QWidget *createWidgets(); @@ -53,7 +53,7 @@ private: void setBusyCursor(bool busy); private: - CppTools::ProjectInfo m_projectInfo; + CppTools::ProjectInfo m_projectInfoBeforeBuild; ClangStaticAnalyzerDiagnosticModel *m_diagnosticModel; Analyzer::DetailedErrorView *m_diagnosticView; From 124311227de43b253852e8099475fd53e748c514 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Fri, 7 Nov 2014 12:15:13 +0100 Subject: [PATCH 030/111] Sort files to process Change-Id: Iac23e40c3154bf143b91d0262418f90907758276 Reviewed-by: Nikolai Kosjar --- .../clangstaticanalyzerruncontrol.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp index 17a63f3a200..b92150cc351 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp @@ -37,6 +37,8 @@ #include #include +#include + #include #include @@ -191,11 +193,15 @@ bool ClangStaticAnalyzerRunControl::startEngine() m_clangLogFileDir = temporaryDir.path(); // Collect files - const QList filesToProcess = unitsToAnalyze(m_projectInfo); + QList unitsToProcess = unitsToAnalyze(m_projectInfo); + Utils::sort(unitsToProcess, [](const AnalyzeUnit &a1, const AnalyzeUnit &a2) -> bool { + return a1.file < a2.file; + }); + qCDebug(LOG) << "Files to process:"; - foreach (const AnalyzeUnit &fileConfig, filesToProcess) + foreach (const AnalyzeUnit &fileConfig, unitsToProcess) qCDebug(LOG) << fileConfig.file; - m_unitsToProcess = filesToProcess; + m_unitsToProcess = unitsToProcess; m_initialFilesToProcessSize = m_unitsToProcess.count(); m_filesAnalyzed = 0; m_filesNotAnalyzed = 0; From e06c9ec09b9d882e2d0f791280f103f69aec6a09 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Mon, 3 Nov 2014 14:52:23 +0100 Subject: [PATCH 031/111] RunControl: Skip sub projects not selected for building Change-Id: I38e5a4f829484a7970fa4b6b06f00ec4cc92e8d0 Reviewed-by: Nikolai Kosjar --- plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp index b92150cc351..f9b3506102c 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp @@ -135,6 +135,9 @@ static QList unitsToAnalyzeFromProje QList unitsToAnalyze; foreach (const ProjectPart::Ptr &projectPart, projectParts) { + if (!projectPart->selectedForBuilding) + continue; + foreach (const ProjectFile &file, projectPart->files) { if (file.path == CppModelManager::configurationFileName()) continue; From 33fd656641b36474f1f143d79bfbb6e17a45889a Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Fri, 14 Nov 2014 14:59:27 +0100 Subject: [PATCH 032/111] Check for valid Diagnostic Change-Id: Icfce44a373d56f008027330f9b1a2d446f4d2adb Reviewed-by: Nikolai Kosjar --- .../clangstaticanalyzer/clangstaticanalyzerdiagnostic.cpp | 5 +++++ plugins/clangstaticanalyzer/clangstaticanalyzerdiagnostic.h | 2 ++ .../clangstaticanalyzerdiagnosticview.cpp | 3 +++ 3 files changed, 10 insertions(+) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnostic.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnostic.cpp index e9152ffa47e..09d810dfc93 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnostic.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnostic.cpp @@ -46,5 +46,10 @@ bool ExplainingStep::isValid() const return location.isValid() && !ranges.isEmpty() && !message.isEmpty(); } +bool Diagnostic::isValid() const +{ + return !description.isEmpty(); +} + } // namespace Internal } // namespace ClangStaticAnalyzer diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnostic.h b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnostic.h index 3348cfa416d..75df6218a9f 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnostic.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnostic.h @@ -56,6 +56,8 @@ public: class Diagnostic { public: + bool isValid() const; + QString description; QString category; QString type; diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.cpp index fd9e216ed76..6d00968c867 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.cpp @@ -168,6 +168,7 @@ DetailedErrorDelegate::SummaryLineInfo ClangStaticAnalyzerDiagnosticDelegate::su const QModelIndex &index) const { const Diagnostic diagnostic = index.data(Qt::UserRole).value(); + QTC_ASSERT(diagnostic.isValid(), return SummaryLineInfo()); DetailedErrorDelegate::SummaryLineInfo info; info.errorText = diagnostic.description; @@ -188,6 +189,8 @@ QWidget *ClangStaticAnalyzerDiagnosticDelegate::createDetailsWidget(const QFont QVBoxLayout *layout = new QVBoxLayout; const Diagnostic diagnostic = index.data(Qt::UserRole).value(); + if (!diagnostic.isValid()) + return widget; // Add summary label QLabel *summaryLineLabel = createSummaryLabel(diagnostic); From 37b8e7252e13a3b74c7e94a908f5818e60127c89 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Mon, 17 Nov 2014 14:08:07 +0100 Subject: [PATCH 033/111] Add qbs project file. Change-Id: I675c1f95d7a22dca4a6cfdc8bec3f815d2576884 Reviewed-by: Nikolai Kosjar --- .../clangstaticanalyzer.qbs | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 plugins/clangstaticanalyzer/clangstaticanalyzer.qbs diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzer.qbs b/plugins/clangstaticanalyzer/clangstaticanalyzer.qbs new file mode 100644 index 00000000000..6c2612a69c1 --- /dev/null +++ b/plugins/clangstaticanalyzer/clangstaticanalyzer.qbs @@ -0,0 +1,47 @@ +import qbs + +QtcPlugin { + 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" } + + Depends { name: "Qt.widgets" } + Depends { name: "Qt.network" } // TODO: See above + + files: [ + "clangstaticanalyzerconfigwidget.cpp", + "clangstaticanalyzerconfigwidget.h", + "clangstaticanalyzerconfigwidget.ui", + "clangstaticanalyzerconstants.h", + "clangstaticanalyzerdiagnostic.cpp", + "clangstaticanalyzerdiagnostic.h", + "clangstaticanalyzerdiagnosticmodel.cpp", + "clangstaticanalyzerdiagnosticmodel.h", + "clangstaticanalyzerdiagnosticview.cpp", + "clangstaticanalyzerdiagnosticview.h", + "clangstaticanalyzerlogfilereader.cpp", + "clangstaticanalyzerlogfilereader.h", + "clangstaticanalyzerplugin.cpp", + "clangstaticanalyzerplugin.h", + "clangstaticanalyzerruncontrol.cpp", + "clangstaticanalyzerruncontrol.h", + "clangstaticanalyzerruncontrolfactory.cpp", + "clangstaticanalyzerruncontrolfactory.h", + "clangstaticanalyzerrunner.cpp", + "clangstaticanalyzerrunner.h", + "clangstaticanalyzersettings.cpp", + "clangstaticanalyzersettings.h", + "clangstaticanalyzertool.cpp", + "clangstaticanalyzertool.h", + "clangstaticanalyzerutils.cpp", + "clangstaticanalyzerutils.h", + "clangstaticanalyzer_global.h", + ] +} From 293dcae8c71ae6ff2a6880149d2cbc507dea44ea Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Tue, 18 Nov 2014 16:23:34 +0100 Subject: [PATCH 034/111] Add missing variable initializations. Change-Id: Ib3573ee41915fe750c8615755ee1d4355cb0137d Reviewed-by: Nikolai Kosjar --- .../clangstaticanalyzer/clangstaticanalyzerlogfilereader.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerlogfilereader.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerlogfilereader.cpp index 22bbb4cb73f..f5c4b438d32 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerlogfilereader.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerlogfilereader.cpp @@ -253,7 +253,7 @@ ExplainingStep ClangStaticAnalyzerLogFileReader::readPathDict() } } - bool depthOk; + bool depthOk = false; while (m_xml.readNextStartElement()) { if (m_xml.name() == QLatin1String("key")) { @@ -291,7 +291,7 @@ Location ClangStaticAnalyzerLogFileReader::readLocationDict(bool elementIsRead) int line = 0; int column = 0; int fileIndex = 0; - bool lineOk, columnOk, fileIndexOk; + bool lineOk = false, columnOk = false, fileIndexOk = false; // Collect values while (m_xml.readNextStartElement()) { From 802a7d653ca98115b10f873fbc578bafb99590ae Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Fri, 14 Nov 2014 11:17:01 +0100 Subject: [PATCH 035/111] Tool: Use "No" button in mode check dialog ...instead of "Cancel". Task-number: QCE-20 Change-Id: Ibef52dc17cb3aee73e1f42eb1c64e4f9d5a9f990 Reviewed-by: Robert Loehning --- plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp index 5042267776d..4da16b98f33 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp @@ -185,9 +185,7 @@ static bool dontStartAfterHintForDebugMode() .arg(toolName).arg(wrongMode); if (Utils::CheckableMessageBox::doNotAskAgainQuestion(Core::ICore::mainWindow(), title, message, Core::ICore::settings(), - QLatin1String("ClangStaticAnalyzerCorrectModeWarning"), - QDialogButtonBox::Yes|QDialogButtonBox::Cancel, - QDialogButtonBox::Cancel, QDialogButtonBox::Yes) != QDialogButtonBox::Yes) + QLatin1String("ClangStaticAnalyzerCorrectModeWarning")) != QDialogButtonBox::Yes) return true; } From 30b77eb0325669fa39331b1aef261c94c22a4c73 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Fri, 14 Nov 2014 13:39:59 +0100 Subject: [PATCH 036/111] DiagnosticView: Add copy action to context menu Task-number: QCE-22 Change-Id: I22a71bd99689e4eaece3b2595b28e0d434a52453 Reviewed-by: Riitta-Leena Miettinen Reviewed-by: Nikolai Kosjar --- .../clangstaticanalyzerdiagnosticview.cpp | 99 ++++++++++++++++--- .../clangstaticanalyzerdiagnosticview.h | 13 +++ .../clangstaticanalyzertool.cpp | 3 +- 3 files changed, 98 insertions(+), 17 deletions(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.cpp index 6d00968c867..0c0a872de3c 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.cpp @@ -21,12 +21,19 @@ #include "clangstaticanalyzerlogfilereader.h" #include "clangstaticanalyzerutils.h" +#include + #include +#include +#include +#include +#include #include #include #include #include +#include #include using namespace Analyzer; @@ -90,29 +97,32 @@ QLabel *createExplainingStepLabel(const QFont &font, bool useAlternateRowPalette } QString createLocationString(const ClangStaticAnalyzer::Internal::Location &location, - bool withMarkup) + bool withMarkup, bool withAbsolutePath) { const QString filePath = location.filePath; - const QString fileName = QFileInfo(filePath).fileName(); const QString lineNumber = QString::number(location.line); const QString columnNumber = QString::number(location.column - 1); - const QString fileNameAndLine = fileName + QLatin1Char(':') + lineNumber; + const QString fileAndLine = (withAbsolutePath ? filePath : QFileInfo(filePath).fileName()) + + QLatin1Char(':') + lineNumber; if (withMarkup) { return QLatin1String("in ") - + fileNameAndLine + + fileAndLine + QLatin1String(""); } else { - return QLatin1String("in ") + fileNameAndLine; + return QLatin1String("in ") + fileAndLine; } } -QString createExplainingStepNumberString(int number) +QString createExplainingStepNumberString(int number, bool withMarkup) { const int fieldWidth = 2; - return QString::fromLatin1("%1:").arg(number, fieldWidth); + const QString result = QString::fromLatin1("%1:").arg(number, fieldWidth); + return withMarkup + ? QLatin1String("") + result + QLatin1String("") + : result; } QString createExplainingStepToolTipString(const ClangStaticAnalyzer::Internal::ExplainingStep &step) @@ -154,6 +164,17 @@ QString createExplainingStepToolTipString(const ClangStaticAnalyzer::Internal::E return html; } +QString createExplainingStepString( + const ClangStaticAnalyzer::Internal::ExplainingStep &explainingStep, + int number, bool withMarkup, bool withAbsolutePath) +{ + return createExplainingStepNumberString(number, withMarkup) + + QLatin1Char(' ') + + explainingStep.extendedMessage + + QLatin1Char(' ') + + createLocationString(explainingStep.location, withMarkup, withAbsolutePath); +} + } // anonymous namespace namespace ClangStaticAnalyzer { @@ -172,13 +193,36 @@ DetailedErrorDelegate::SummaryLineInfo ClangStaticAnalyzerDiagnosticDelegate::su DetailedErrorDelegate::SummaryLineInfo info; info.errorText = diagnostic.description; - info.errorLocation = createLocationString(diagnostic.location, /*withMarkup=*/ false); + info.errorLocation = createLocationString(diagnostic.location, + /*withMarkup=*/ false, + /*withAbsolutePath=*/ false); return info; } void ClangStaticAnalyzerDiagnosticDelegate::copy() { - qDebug() << Q_FUNC_INFO; + QTC_ASSERT(m_detailsIndex.isValid(), return); + + const Diagnostic diagnostic = m_detailsIndex.data(Qt::UserRole).value(); + QTC_ASSERT(diagnostic.isValid(), return); + + // Create summary + QString clipboardText = diagnostic.category + QLatin1String(": ") + diagnostic.type; + if (diagnostic.type != diagnostic.description) + clipboardText += QLatin1String(": ") + diagnostic.description; + clipboardText += QLatin1Char('\n'); + + // Create explaining steps + int explainingStepNumber = 1; + foreach (const ExplainingStep &explainingStep, diagnostic.explainingSteps) { + clipboardText += createExplainingStepString(explainingStep, + explainingStepNumber++, + /*withMarkup=*/ false, + /*withAbsolutePath=*/ true) + QLatin1Char('\n'); + } + + clipboardText.chop(1); // Remove \n + QApplication::clipboard()->setText(clipboardText); } QWidget *ClangStaticAnalyzerDiagnosticDelegate::createDetailsWidget(const QFont &font, @@ -201,12 +245,10 @@ QWidget *ClangStaticAnalyzerDiagnosticDelegate::createDetailsWidget(const QFont // Add labels for explaining steps int explainingStepNumber = 1; foreach (const ExplainingStep &explainingStep, diagnostic.explainingSteps) { - const QString text = createExplainingStepNumberString(explainingStepNumber++) - + QLatin1Char(' ') - + explainingStep.extendedMessage - + QLatin1Char(' ') - + createLocationString(explainingStep.location, /*withMarkup=*/ true); - + const QString text = createExplainingStepString(explainingStep, + explainingStepNumber++, + /*withMarkup=*/ true, + /*withAbsolutePath=*/ false); QLabel *label = createExplainingStepLabel(font, explainingStepNumber % 2 == 0); label->setParent(widget); label->setText(text); @@ -222,5 +264,32 @@ QWidget *ClangStaticAnalyzerDiagnosticDelegate::createDetailsWidget(const QFont return widget; } +ClangStaticAnalyzerDiagnosticView::ClangStaticAnalyzerDiagnosticView(QWidget *parent) + : Analyzer::DetailedErrorView(parent) +{ + ClangStaticAnalyzerDiagnosticDelegate *delegate + = new ClangStaticAnalyzerDiagnosticDelegate(this); + setItemDelegate(delegate); + + m_copyAction = new QAction(this); + m_copyAction->setText(tr("Copy")); + m_copyAction->setIcon(QIcon(QLatin1String(Core::Constants::ICON_COPY))); + m_copyAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_C)); + m_copyAction->setShortcutContext(Qt::WidgetWithChildrenShortcut); + connect(m_copyAction, &QAction::triggered, + delegate, &ClangStaticAnalyzerDiagnosticDelegate::copy); + addAction(m_copyAction); +} + +void ClangStaticAnalyzerDiagnosticView::contextMenuEvent(QContextMenuEvent *e) +{ + if (selectionModel()->selectedRows().isEmpty()) + return; + + QMenu menu; + menu.addAction(m_copyAction); + menu.exec(e->globalPos()); +} + } // namespace Internal } // namespace ClangStaticAnalyzer diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.h b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.h index 551aff3e723..5830a05a504 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.h @@ -24,6 +24,19 @@ namespace ClangStaticAnalyzer { namespace Internal { +class ClangStaticAnalyzerDiagnosticView : public Analyzer::DetailedErrorView +{ + Q_OBJECT + +public: + ClangStaticAnalyzerDiagnosticView(QWidget *parent = 0); + +private: + void contextMenuEvent(QContextMenuEvent *e); + + QAction *m_copyAction; +}; + class ClangStaticAnalyzerDiagnosticDelegate : public Analyzer::DetailedErrorDelegate { public: diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp index 4da16b98f33..ffec5af1a73 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp @@ -70,8 +70,7 @@ QWidget *ClangStaticAnalyzerTool::createWidgets() // // Diagnostic View // - m_diagnosticView = new DetailedErrorView; - m_diagnosticView->setItemDelegate(new ClangStaticAnalyzerDiagnosticDelegate(m_diagnosticView)); + m_diagnosticView = new ClangStaticAnalyzerDiagnosticView; m_diagnosticView->setObjectName(QLatin1String("ClangStaticAnalyzerIssuesView")); m_diagnosticView->setFrameStyle(QFrame::NoFrame); m_diagnosticView->setAttribute(Qt::WA_MacShowFocusRect, false); From 25d521003919c047d33f3a264a3dd3a34d9918df Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Fri, 14 Nov 2014 16:32:36 +0100 Subject: [PATCH 037/111] Use QString::toHtmlEscaped() for GUI text Otherwise diagnostics mentioning the '<<' operator might be interpreted strangely. Task-number: QCE-21 Change-Id: Ifc55335a6639020c143edd5f8b02158f8c8ab651 Reviewed-by: Nikolai Kosjar --- .../clangstaticanalyzerdiagnosticmodel.cpp | 7 ++++--- .../clangstaticanalyzerdiagnosticview.cpp | 12 ++++++++---- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.cpp index 2318c50c05b..2b217653316 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.cpp @@ -58,19 +58,20 @@ static QString createDiagnosticToolTipString(const Diagnostic &diagnostic) if (!diagnostic.category.isEmpty()) { lines << qMakePair( QCoreApplication::translate("ClangStaticAnalyzer::Diagnostic", "Category:"), - diagnostic.category); + diagnostic.category.toHtmlEscaped()); } if (!diagnostic.type.isEmpty()) { lines << qMakePair( QCoreApplication::translate("ClangStaticAnalyzer::Diagnostic", "Type:"), - diagnostic.type); + diagnostic.type.toHtmlEscaped()); } if (!diagnostic.issueContext.isEmpty() && !diagnostic.issueContextKind.isEmpty()) { lines << qMakePair( QCoreApplication::translate("ClangStaticAnalyzer::Diagnostic", "Context:"), - diagnostic.issueContextKind + QLatin1Char(' ') + diagnostic.issueContext); + diagnostic.issueContextKind.toHtmlEscaped() + QLatin1Char(' ') + + diagnostic.issueContext.toHtmlEscaped()); } lines << qMakePair( diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.cpp index 0c0a872de3c..84c619d5d70 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.cpp @@ -63,7 +63,9 @@ QString createSummaryText(const ClangStaticAnalyzer::Internal::Diagnostic &diagn const QString location = fileName + QLatin1Char(' ') + QString::number(diagnostic.location.line); return QString::fromLatin1("%1  %2") - .arg(diagnostic.description, location, linkStyle); + .arg(diagnostic.description.toHtmlEscaped(), + location, + linkStyle); } QLabel *createSummaryLabel(const ClangStaticAnalyzer::Internal::Diagnostic &diagnostic) @@ -136,12 +138,12 @@ QString createExplainingStepToolTipString(const ClangStaticAnalyzer::Internal::E if (!step.message.isEmpty()) { lines << qMakePair( QCoreApplication::translate("ClangStaticAnalyzer::ExplainingStep", "Message:"), - step.message); + step.message.toHtmlEscaped()); } if (!step.extendedMessage.isEmpty()) { lines << qMakePair( QCoreApplication::translate("ClangStaticAnalyzer::ExplainingStep", "Extended Message:"), - step.extendedMessage); + step.extendedMessage.toHtmlEscaped()); } lines << qMakePair( @@ -170,7 +172,9 @@ QString createExplainingStepString( { return createExplainingStepNumberString(number, withMarkup) + QLatin1Char(' ') - + explainingStep.extendedMessage + + (withMarkup + ? explainingStep.extendedMessage.toHtmlEscaped() + : explainingStep.extendedMessage) + QLatin1Char(' ') + createLocationString(explainingStep.location, withMarkup, withAbsolutePath); } From 4bdd4c263ec53b7a2c8773912285ddb8d970da2e Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Tue, 25 Nov 2014 12:14:17 +0100 Subject: [PATCH 038/111] DiagnosticDelegate: Fix leaking QVBoxLayout Change-Id: I523c2c13b2b7f2b2eebc00781b6a2e18a74f8c17 Reviewed-by: Nikolai Kosjar --- .../clangstaticanalyzer/clangstaticanalyzerdiagnosticview.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.cpp index 84c619d5d70..616cf9f3697 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.cpp @@ -234,12 +234,13 @@ QWidget *ClangStaticAnalyzerDiagnosticDelegate::createDetailsWidget(const QFont QWidget *parent) const { QWidget *widget = new QWidget(parent); - QVBoxLayout *layout = new QVBoxLayout; const Diagnostic diagnostic = index.data(Qt::UserRole).value(); if (!diagnostic.isValid()) return widget; + QVBoxLayout *layout = new QVBoxLayout; + // Add summary label QLabel *summaryLineLabel = createSummaryLabel(diagnostic); connect(summaryLineLabel, &QLabel::linkActivated, From c98db856f9958460acbe20b1e3804f15d4a29132 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Thu, 15 Jan 2015 10:32:57 +0100 Subject: [PATCH 039/111] Update License Change-Id: I0a127e78046369f7b55b3ace7b08a13a3f5319e5 Reviewed-by: Nikolai Kosjar --- plugins/clangstaticanalyzer/ClangStaticAnalyzer.json.in | 8 ++++---- plugins/clangstaticanalyzer/clangstaticanalyzer_global.h | 8 ++++---- .../clangstaticanalyzerconfigwidget.cpp | 8 ++++---- .../clangstaticanalyzer/clangstaticanalyzerconfigwidget.h | 8 ++++---- .../clangstaticanalyzer/clangstaticanalyzerconstants.h | 8 ++++---- .../clangstaticanalyzer/clangstaticanalyzerdiagnostic.cpp | 8 ++++---- .../clangstaticanalyzer/clangstaticanalyzerdiagnostic.h | 8 ++++---- .../clangstaticanalyzerdiagnosticmodel.cpp | 8 ++++---- .../clangstaticanalyzerdiagnosticmodel.h | 8 ++++---- .../clangstaticanalyzerdiagnosticview.cpp | 8 ++++---- .../clangstaticanalyzerdiagnosticview.h | 8 ++++---- .../clangstaticanalyzerlogfilereader.cpp | 8 ++++---- .../clangstaticanalyzerlogfilereader.h | 8 ++++---- plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp | 8 ++++---- plugins/clangstaticanalyzer/clangstaticanalyzerplugin.h | 8 ++++---- .../clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp | 8 ++++---- .../clangstaticanalyzer/clangstaticanalyzerruncontrol.h | 8 ++++---- .../clangstaticanalyzerruncontrolfactory.cpp | 8 ++++---- .../clangstaticanalyzerruncontrolfactory.h | 8 ++++---- plugins/clangstaticanalyzer/clangstaticanalyzerrunner.cpp | 8 ++++---- plugins/clangstaticanalyzer/clangstaticanalyzerrunner.h | 8 ++++---- .../clangstaticanalyzer/clangstaticanalyzersettings.cpp | 8 ++++---- plugins/clangstaticanalyzer/clangstaticanalyzersettings.h | 8 ++++---- plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp | 8 ++++---- plugins/clangstaticanalyzer/clangstaticanalyzertool.h | 8 ++++---- plugins/clangstaticanalyzer/clangstaticanalyzerutils.cpp | 8 ++++---- plugins/clangstaticanalyzer/clangstaticanalyzerutils.h | 8 ++++---- .../tst_clangstaticanalyzerlogfilereader.cpp | 8 ++++---- .../tst_clangstaticanalyzerrunner.cpp | 8 ++++---- 29 files changed, 116 insertions(+), 116 deletions(-) diff --git a/plugins/clangstaticanalyzer/ClangStaticAnalyzer.json.in b/plugins/clangstaticanalyzer/ClangStaticAnalyzer.json.in index 13c2aa5b82f..a98cbbfa2c7 100644 --- a/plugins/clangstaticanalyzer/ClangStaticAnalyzer.json.in +++ b/plugins/clangstaticanalyzer/ClangStaticAnalyzer.json.in @@ -4,14 +4,14 @@ \"CompatVersion\" : \"$$QTCREATOR_COMPAT_VERSION\", \"Experimental\" : true, \"Platform\" : \"(Linux.*)|(OS X.*)\", - \"Vendor\" : \"Digia Plc\", - \"Copyright\" : \"(C) 2014 Digia Plc\", + \"Vendor\" : \"The Qt Company Ltd\", + \"Copyright\" : \"(C) 2015 The Qt Company Ltd\", \"License\" : [ \"Commercial Usage\", \"\", - \"Licensees holding valid Qt Commercial licenses may use this plugin in accordance with the Qt Commercial License Agreement provided with the Software or, alternatively, in accordance with the terms contained in a written agreement between you and Digia.\" + \"Licensees holding valid Qt Commercial licenses may use this plugin in accordance with the Qt Commercial License Agreement provided with the Software or, alternatively, in accordance with the terms contained in a written agreement between you and The Qt Company.\" ], \"Category\" : \"Code Analyzer\", \"Description\" : \"ClangStaticAnalyzer Plugin.\", - \"Url\" : \"http://qt.digia.com\", + \"Url\" : \"http://www.qt.io\", $$dependencyList } diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzer_global.h b/plugins/clangstaticanalyzer/clangstaticanalyzer_global.h index a3fc0a8b852..bc96f936e0c 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzer_global.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzer_global.h @@ -1,18 +1,18 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc +** Copyright (C) 2015 The Qt Company Ltd ** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com +** 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. ** ** Licensees holding valid Qt Enterprise licenses may use this file in ** accordance with the Qt Enterprise License Agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. +** a written agreement between you and The Qt Company. ** ** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com +** contact form at http://www.qt.io/contact-us ** ****************************************************************************/ diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.cpp index c0ae86af94a..d6ff0fa5b84 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.cpp @@ -1,18 +1,18 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc +** Copyright (C) 2015 The Qt Company Ltd ** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com +** 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. ** ** Licensees holding valid Qt Enterprise licenses may use this file in ** accordance with the Qt Enterprise License Agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. +** a written agreement between you and The Qt Company. ** ** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com +** contact form at http://www.qt.io/contact-us ** ****************************************************************************/ diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.h b/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.h index 939766622af..11c6018fefb 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.h @@ -1,18 +1,18 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc +** Copyright (C) 2015 The Qt Company Ltd ** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com +** 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. ** ** Licensees holding valid Qt Enterprise licenses may use this file in ** accordance with the Qt Enterprise License Agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. +** a written agreement between you and The Qt Company. ** ** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com +** contact form at http://www.qt.io/contact-us ** ****************************************************************************/ diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerconstants.h b/plugins/clangstaticanalyzer/clangstaticanalyzerconstants.h index 85a05087a61..04ed79b998d 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerconstants.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerconstants.h @@ -1,18 +1,18 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc +** Copyright (C) 2015 The Qt Company Ltd ** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com +** 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. ** ** Licensees holding valid Qt Enterprise licenses may use this file in ** accordance with the Qt Enterprise License Agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. +** a written agreement between you and The Qt Company. ** ** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com +** contact form at http://www.qt.io/contact-us ** ****************************************************************************/ diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnostic.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnostic.cpp index 09d810dfc93..a20ed6caa8f 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnostic.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnostic.cpp @@ -1,18 +1,18 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc +** Copyright (C) 2015 The Qt Company Ltd ** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com +** 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. ** ** Licensees holding valid Qt Enterprise licenses may use this file in ** accordance with the Qt Enterprise License Agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. +** a written agreement between you and The Qt Company. ** ** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com +** contact form at http://www.qt.io/contact-us ** ****************************************************************************/ diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnostic.h b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnostic.h index 75df6218a9f..dfb2f449625 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnostic.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnostic.h @@ -1,18 +1,18 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc +** Copyright (C) 2015 The Qt Company Ltd ** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com +** 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. ** ** Licensees holding valid Qt Enterprise licenses may use this file in ** accordance with the Qt Enterprise License Agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. +** a written agreement between you and The Qt Company. ** ** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com +** contact form at http://www.qt.io/contact-us ** ****************************************************************************/ diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.cpp index 2b217653316..5f1d21fb9f8 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.cpp @@ -1,18 +1,18 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc +** Copyright (C) 2015 The Qt Company Ltd ** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com +** 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. ** ** Licensees holding valid Qt Enterprise licenses may use this file in ** accordance with the Qt Enterprise License Agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. +** a written agreement between you and The Qt Company. ** ** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com +** contact form at http://www.qt.io/contact-us ** ****************************************************************************/ diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.h b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.h index beccf89a846..1085f3ef4c9 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.h @@ -1,18 +1,18 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc +** Copyright (C) 2015 The Qt Company Ltd ** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com +** 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. ** ** Licensees holding valid Qt Enterprise licenses may use this file in ** accordance with the Qt Enterprise License Agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. +** a written agreement between you and The Qt Company. ** ** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com +** contact form at http://www.qt.io/contact-us ** ****************************************************************************/ diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.cpp index 616cf9f3697..a29c59bb752 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.cpp @@ -1,18 +1,18 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc +** Copyright (C) 2015 The Qt Company Ltd ** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com +** 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. ** ** Licensees holding valid Qt Enterprise licenses may use this file in ** accordance with the Qt Enterprise License Agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. +** a written agreement between you and The Qt Company. ** ** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com +** contact form at http://www.qt.io/contact-us ** ****************************************************************************/ diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.h b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.h index 5830a05a504..a8e6397d00a 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.h @@ -1,18 +1,18 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc +** Copyright (C) 2015 The Qt Company Ltd ** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com +** 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. ** ** Licensees holding valid Qt Enterprise licenses may use this file in ** accordance with the Qt Enterprise License Agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. +** a written agreement between you and The Qt Company. ** ** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com +** contact form at http://www.qt.io/contact-us ** ****************************************************************************/ diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerlogfilereader.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerlogfilereader.cpp index f5c4b438d32..eb905439694 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerlogfilereader.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerlogfilereader.cpp @@ -1,18 +1,18 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc +** Copyright (C) 2015 The Qt Company Ltd ** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com +** 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. ** ** Licensees holding valid Qt Enterprise licenses may use this file in ** accordance with the Qt Enterprise License Agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. +** a written agreement between you and The Qt Company. ** ** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com +** contact form at http://www.qt.io/contact-us ** ****************************************************************************/ diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerlogfilereader.h b/plugins/clangstaticanalyzer/clangstaticanalyzerlogfilereader.h index fe8f5075ff0..f2febffd77f 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerlogfilereader.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerlogfilereader.h @@ -1,18 +1,18 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc +** Copyright (C) 2015 The Qt Company Ltd ** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com +** 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. ** ** Licensees holding valid Qt Enterprise licenses may use this file in ** accordance with the Qt Enterprise License Agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. +** a written agreement between you and The Qt Company. ** ** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com +** contact form at http://www.qt.io/contact-us ** ****************************************************************************/ diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp index e635305b97d..d88ebbbc9b8 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp @@ -1,18 +1,18 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc +** Copyright (C) 2015 The Qt Company Ltd ** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com +** 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. ** ** Licensees holding valid Qt Enterprise licenses may use this file in ** accordance with the Qt Enterprise License Agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. +** a written agreement between you and The Qt Company. ** ** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com +** contact form at http://www.qt.io/contact-us ** ****************************************************************************/ diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.h b/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.h index d96611a16f2..2008681d140 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.h @@ -1,18 +1,18 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc +** Copyright (C) 2015 The Qt Company Ltd ** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com +** 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. ** ** Licensees holding valid Qt Enterprise licenses may use this file in ** accordance with the Qt Enterprise License Agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. +** a written agreement between you and The Qt Company. ** ** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com +** contact form at http://www.qt.io/contact-us ** ****************************************************************************/ diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp index f9b3506102c..bd54a674b95 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp @@ -1,18 +1,18 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc +** Copyright (C) 2015 The Qt Company Ltd ** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com +** 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. ** ** Licensees holding valid Qt Enterprise licenses may use this file in ** accordance with the Qt Enterprise License Agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. +** a written agreement between you and The Qt Company. ** ** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com +** contact form at http://www.qt.io/contact-us ** ****************************************************************************/ diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h index cc56f107f63..09ad14e8a8b 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h @@ -1,18 +1,18 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc +** Copyright (C) 2015 The Qt Company Ltd ** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com +** 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. ** ** Licensees holding valid Qt Enterprise licenses may use this file in ** accordance with the Qt Enterprise License Agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. +** a written agreement between you and The Qt Company. ** ** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com +** contact form at http://www.qt.io/contact-us ** ****************************************************************************/ diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp index 94f7f271639..49bb8c6c4a9 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp @@ -1,18 +1,18 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc +** Copyright (C) 2015 The Qt Company Ltd ** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com +** 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. ** ** Licensees holding valid Qt Enterprise licenses may use this file in ** accordance with the Qt Enterprise License Agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. +** a written agreement between you and The Qt Company. ** ** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com +** contact form at http://www.qt.io/contact-us ** ****************************************************************************/ diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.h b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.h index a3256919727..3d06a5e80fb 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.h @@ -1,18 +1,18 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc +** Copyright (C) 2015 The Qt Company Ltd ** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com +** 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. ** ** Licensees holding valid Qt Enterprise licenses may use this file in ** accordance with the Qt Enterprise License Agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. +** a written agreement between you and The Qt Company. ** ** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com +** contact form at http://www.qt.io/contact-us ** ****************************************************************************/ diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.cpp index 5c469a07a22..10b0d882992 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.cpp @@ -1,18 +1,18 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc +** Copyright (C) 2015 The Qt Company Ltd ** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com +** 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. ** ** Licensees holding valid Qt Enterprise licenses may use this file in ** accordance with the Qt Enterprise License Agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. +** a written agreement between you and The Qt Company. ** ** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com +** contact form at http://www.qt.io/contact-us ** ****************************************************************************/ diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.h b/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.h index 461f694e2e7..703e7b153cf 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.h @@ -1,18 +1,18 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc +** Copyright (C) 2015 The Qt Company Ltd ** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com +** 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. ** ** Licensees holding valid Qt Enterprise licenses may use this file in ** accordance with the Qt Enterprise License Agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. +** a written agreement between you and The Qt Company. ** ** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com +** contact form at http://www.qt.io/contact-us ** ****************************************************************************/ diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzersettings.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzersettings.cpp index a6445b16305..774bf4941be 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzersettings.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzersettings.cpp @@ -1,18 +1,18 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc +** Copyright (C) 2015 The Qt Company Ltd ** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com +** 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. ** ** Licensees holding valid Qt Enterprise licenses may use this file in ** accordance with the Qt Enterprise License Agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. +** a written agreement between you and The Qt Company. ** ** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com +** contact form at http://www.qt.io/contact-us ** ****************************************************************************/ diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzersettings.h b/plugins/clangstaticanalyzer/clangstaticanalyzersettings.h index bca154c561e..71c4c218642 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzersettings.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzersettings.h @@ -1,18 +1,18 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc +** Copyright (C) 2015 The Qt Company Ltd ** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com +** 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. ** ** Licensees holding valid Qt Enterprise licenses may use this file in ** accordance with the Qt Enterprise License Agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. +** a written agreement between you and The Qt Company. ** ** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com +** contact form at http://www.qt.io/contact-us ** ****************************************************************************/ diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp index ffec5af1a73..01afdaa6395 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp @@ -1,18 +1,18 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc +** Copyright (C) 2015 The Qt Company Ltd ** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com +** 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. ** ** Licensees holding valid Qt Enterprise licenses may use this file in ** accordance with the Qt Enterprise License Agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. +** a written agreement between you and The Qt Company. ** ** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com +** contact form at http://www.qt.io/contact-us ** ****************************************************************************/ diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzertool.h b/plugins/clangstaticanalyzer/clangstaticanalyzertool.h index 8f3bb1f1965..8b6ce38ef83 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzertool.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzertool.h @@ -1,18 +1,18 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc +** Copyright (C) 2015 The Qt Company Ltd ** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com +** 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. ** ** Licensees holding valid Qt Enterprise licenses may use this file in ** accordance with the Qt Enterprise License Agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. +** a written agreement between you and The Qt Company. ** ** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com +** contact form at http://www.qt.io/contact-us ** ****************************************************************************/ diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerutils.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerutils.cpp index 6beff9e1928..df5263886a4 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerutils.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerutils.cpp @@ -1,18 +1,18 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc +** Copyright (C) 2015 The Qt Company Ltd ** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com +** 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. ** ** Licensees holding valid Qt Enterprise licenses may use this file in ** accordance with the Qt Enterprise License Agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. +** a written agreement between you and The Qt Company. ** ** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com +** contact form at http://www.qt.io/contact-us ** ****************************************************************************/ diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerutils.h b/plugins/clangstaticanalyzer/clangstaticanalyzerutils.h index 8c634700228..529601646f0 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerutils.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerutils.h @@ -1,18 +1,18 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc +** Copyright (C) 2015 The Qt Company Ltd ** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com +** 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. ** ** Licensees holding valid Qt Enterprise licenses may use this file in ** accordance with the Qt Enterprise License Agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. +** a written agreement between you and The Qt Company. ** ** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com +** contact form at http://www.qt.io/contact-us ** ****************************************************************************/ diff --git a/plugins/clangstaticanalyzer/tests/clangstaticanalyzerlogfilereader/tst_clangstaticanalyzerlogfilereader.cpp b/plugins/clangstaticanalyzer/tests/clangstaticanalyzerlogfilereader/tst_clangstaticanalyzerlogfilereader.cpp index 76dd0cf8625..89547adcaa9 100644 --- a/plugins/clangstaticanalyzer/tests/clangstaticanalyzerlogfilereader/tst_clangstaticanalyzerlogfilereader.cpp +++ b/plugins/clangstaticanalyzer/tests/clangstaticanalyzerlogfilereader/tst_clangstaticanalyzerlogfilereader.cpp @@ -1,18 +1,18 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc +** Copyright (C) 2015 The Qt Company Ltd ** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com +** 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. ** ** Licensees holding valid Qt Enterprise licenses may use this file in ** accordance with the Qt Enterprise License Agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. +** a written agreement between you and The Qt Company. ** ** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com +** contact form at http://www.qt.io/contact-us ** ****************************************************************************/ diff --git a/plugins/clangstaticanalyzer/tests/clangstaticanalyzerrunner/tst_clangstaticanalyzerrunner.cpp b/plugins/clangstaticanalyzer/tests/clangstaticanalyzerrunner/tst_clangstaticanalyzerrunner.cpp index c3a51062c8f..428213717f8 100644 --- a/plugins/clangstaticanalyzer/tests/clangstaticanalyzerrunner/tst_clangstaticanalyzerrunner.cpp +++ b/plugins/clangstaticanalyzer/tests/clangstaticanalyzerrunner/tst_clangstaticanalyzerrunner.cpp @@ -1,18 +1,18 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc +** Copyright (C) 2015 The Qt Company Ltd ** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com +** 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. ** ** Licensees holding valid Qt Enterprise licenses may use this file in ** accordance with the Qt Enterprise License Agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. +** a written agreement between you and The Qt Company. ** ** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com +** contact form at http://www.qt.io/contact-us ** ****************************************************************************/ From 0d60463c67c0df7d60bb93c0dbef0b099d3295e3 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Fri, 16 Jan 2015 10:34:21 +0100 Subject: [PATCH 040/111] Turn QTC_ASSERT into normal check. It is not an error if no toolchain is present in the kit. It just means the same as the toolchain not being gcc or clang. Change-Id: I193fd196ab830321dade1c3d32080b81a93cf645 Reviewed-by: Nikolai Kosjar --- .../clangstaticanalyzerruncontrolfactory.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp index 94f7f271639..301496fac71 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp @@ -60,8 +60,8 @@ bool ClangStaticAnalyzerRunControlFactory::canRun(RunConfiguration *runConfigura Kit *kit = target->kit(); QTC_ASSERT(kit, return false); ToolChain *toolChain = ToolChainKitInformation::toolChain(kit); - QTC_ASSERT(toolChain, return false); - return toolChain->type() == QLatin1String("clang") || toolChain->type() == QLatin1String("gcc"); + return toolChain && (toolChain->type() == QLatin1String("clang") + || toolChain->type() == QLatin1String("gcc")); } RunControl *ClangStaticAnalyzerRunControlFactory::create(RunConfiguration *runConfiguration, From 570e62b1683f3c879b58a9a3a737bd516b09f032 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Wed, 28 Jan 2015 17:04:03 +0100 Subject: [PATCH 041/111] RunControl: Reset future interface before in startEngine() This fixes an infinite loop for the following use case: 1. Menu: Analyze > Clang Static Analzyer 2. When finished, click "Re-run this run-configuration" in the application output pane m_progress was left in the isFinished() state and the next run to startEngine() called analyzeNextFile() which returned immediately. Change-Id: I8acf4f03dfc1d7f81034610828f6fb707655bd52 Sanity-Review: Sanity Bot Reviewed-by: Christian Kandeler --- plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp index f9b3506102c..75757bc916e 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp @@ -211,6 +211,7 @@ bool ClangStaticAnalyzerRunControl::startEngine() // Set up progress information using namespace Core; + m_progress = QFutureInterface(); FutureProgress *futureProgress = ProgressManager::addTask(m_progress.future(), tr("Analyzing"), "ClangStaticAnalyzer"); futureProgress->setKeepOnFinish(FutureProgress::HideOnFinish); From 6aad65375b265bced5758cd147b89fe26ca5edff Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Fri, 23 Jan 2015 17:51:50 +0100 Subject: [PATCH 042/111] Add qbs project files for autotests. Change-Id: I7fefef8059e11fc7d08168c147e0dc8c6be7d466 Reviewed-by: Nikolai Kosjar --- .../tests/clangstaticanalyzerautotest.qbs | 10 +++++++++ .../clangstaticanalyzerlogfilereader.qbs | 21 +++++++++++++++++++ .../clangstaticanalyzerrunner.qbs | 19 +++++++++++++++++ plugins/clangstaticanalyzer/tests/tests.qbs | 8 +++++++ 4 files changed, 58 insertions(+) create mode 100644 plugins/clangstaticanalyzer/tests/clangstaticanalyzerautotest.qbs create mode 100644 plugins/clangstaticanalyzer/tests/clangstaticanalyzerlogfilereader/clangstaticanalyzerlogfilereader.qbs create mode 100644 plugins/clangstaticanalyzer/tests/clangstaticanalyzerrunner/clangstaticanalyzerrunner.qbs create mode 100644 plugins/clangstaticanalyzer/tests/tests.qbs diff --git a/plugins/clangstaticanalyzer/tests/clangstaticanalyzerautotest.qbs b/plugins/clangstaticanalyzer/tests/clangstaticanalyzerautotest.qbs new file mode 100644 index 00000000000..ab51ab2e6fe --- /dev/null +++ b/plugins/clangstaticanalyzer/tests/clangstaticanalyzerautotest.qbs @@ -0,0 +1,10 @@ +import qbs + +QtcAutotest { + Depends { name: "Qt.widgets" } + Depends { name: "Utils" } + + property path pluginDir: "../../" + cpp.defines: base.concat('SRCDIR="' + sourceDirectory + '"') + cpp.includePaths: base.concat(pluginDir + "/..") +} diff --git a/plugins/clangstaticanalyzer/tests/clangstaticanalyzerlogfilereader/clangstaticanalyzerlogfilereader.qbs b/plugins/clangstaticanalyzer/tests/clangstaticanalyzerlogfilereader/clangstaticanalyzerlogfilereader.qbs new file mode 100644 index 00000000000..a1ac819f5f6 --- /dev/null +++ b/plugins/clangstaticanalyzer/tests/clangstaticanalyzerlogfilereader/clangstaticanalyzerlogfilereader.qbs @@ -0,0 +1,21 @@ +import qbs +import "../clangstaticanalyzerautotest.qbs" as ClangStaticAnalyzerAutotest + +ClangStaticAnalyzerAutotest { + name: "ClangStaticAnalyzerLogFileReader Autotest" + + Group { + name: "sources from plugin" + prefix: pluginDir + '/' + files: [ + "clangstaticanalyzerdiagnostic.cpp", + "clangstaticanalyzerdiagnostic.h", + "clangstaticanalyzerlogfilereader.cpp", + "clangstaticanalyzerlogfilereader.h", + ] + } + + files: [ + "tst_clangstaticanalyzerlogfilereader.cpp" + ] +} diff --git a/plugins/clangstaticanalyzer/tests/clangstaticanalyzerrunner/clangstaticanalyzerrunner.qbs b/plugins/clangstaticanalyzer/tests/clangstaticanalyzerrunner/clangstaticanalyzerrunner.qbs new file mode 100644 index 00000000000..6b0f9da3f37 --- /dev/null +++ b/plugins/clangstaticanalyzer/tests/clangstaticanalyzerrunner/clangstaticanalyzerrunner.qbs @@ -0,0 +1,19 @@ +import qbs +import "../clangstaticanalyzerautotest.qbs" as ClangStaticAnalyzerAutotest + +ClangStaticAnalyzerAutotest { + name: "ClangStaticAnalyzerRunner Autotest" + + Group { + name: "sources from plugin" + prefix: pluginDir + '/' + files: [ + "clangstaticanalyzerrunner.cpp", + "clangstaticanalyzerrunner.h", + ] + } + + files: [ + "tst_clangstaticanalyzerrunner.cpp", + ] +} diff --git a/plugins/clangstaticanalyzer/tests/tests.qbs b/plugins/clangstaticanalyzer/tests/tests.qbs new file mode 100644 index 00000000000..a6dc94d66cf --- /dev/null +++ b/plugins/clangstaticanalyzer/tests/tests.qbs @@ -0,0 +1,8 @@ +import qbs + +Project { + references: [ + "clangstaticanalyzerlogfilereader", + "clangstaticanalyzerrunner", + ] +} From 0aa20dd26d641dcaeb19efc1028e408910032e93 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Fri, 23 Jan 2015 15:25:45 +0100 Subject: [PATCH 043/111] Add support for MSVC. Via clang-cl, which supports the --analyze option now. Change-Id: Idbefe048eaa80e8c5bdb2244cb30c26ba7c71ef5 Reviewed-by: Nikolai Kosjar --- .../ClangStaticAnalyzer.json.in | 1 - .../clangstaticanalyzerruncontrol.cpp | 49 ++++++++++++------- .../clangstaticanalyzerruncontrol.h | 2 + .../clangstaticanalyzerruncontrolfactory.cpp | 3 +- .../clangstaticanalyzerrunner.cpp | 15 +++++- .../clangstaticanalyzerrunner.h | 1 + .../clangstaticanalyzerutils.cpp | 7 ++- .../clangstaticanalyzerutils.h | 2 +- 8 files changed, 56 insertions(+), 24 deletions(-) diff --git a/plugins/clangstaticanalyzer/ClangStaticAnalyzer.json.in b/plugins/clangstaticanalyzer/ClangStaticAnalyzer.json.in index 13c2aa5b82f..77cc31b40d6 100644 --- a/plugins/clangstaticanalyzer/ClangStaticAnalyzer.json.in +++ b/plugins/clangstaticanalyzer/ClangStaticAnalyzer.json.in @@ -3,7 +3,6 @@ \"Version\" : \"$$QTCREATOR_VERSION\", \"CompatVersion\" : \"$$QTCREATOR_COMPAT_VERSION\", \"Experimental\" : true, - \"Platform\" : \"(Linux.*)|(OS X.*)\", \"Vendor\" : \"Digia Plc\", \"Copyright\" : \"(C) 2014 Digia Plc\", \"License\" : [ \"Commercial Usage\", diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp index 75757bc916e..e027d249074 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp @@ -34,6 +34,7 @@ #include #include +#include #include #include @@ -56,6 +57,8 @@ ClangStaticAnalyzerRunControl::ClangStaticAnalyzerRunControl( const ProjectInfo &projectInfo) : AnalyzerRunControl(startParams, runConfiguration) , m_projectInfo(projectInfo) + , m_toolchainType(ProjectExplorer::ToolChainKitInformation + ::toolChain(runConfiguration->target()->kit())->type()) , m_initialFilesToProcessSize(0) , m_filesAnalyzed(0) , m_filesNotAnalyzed(0) @@ -75,7 +78,7 @@ static QStringList tweakedArguments(const QString &filePath, const QStringList & } else if (argument == QLatin1String("-o")) { skip = true; continue; - } else if (argument == filePath) { + } else if (QDir::fromNativeSeparators(argument) == filePath) { continue; // TODO: Let it in? } @@ -87,19 +90,30 @@ static QStringList tweakedArguments(const QString &filePath, const QStringList & } static QStringList argumentsFromProjectPart(const CppTools::ProjectPart::Ptr &projectPart, - CppTools::ProjectFile::Kind fileKind) + CppTools::ProjectFile::Kind fileKind, + const QString &toolchainType) { QStringList result; const bool objcExt = projectPart->languageExtensions & ProjectPart::ObjectiveCExtensions; - result += CppTools::CompilerOptionsBuilder::createLanguageOption(fileKind, objcExt); + result += CppTools::CompilerOptionsBuilder::createLanguageOption(fileKind, objcExt, + toolchainType); result += CppTools::CompilerOptionsBuilder::createOptionsForLanguage( projectPart->languageVersion, - projectPart->languageExtensions); - result += CppTools::CompilerOptionsBuilder::createDefineOptions(projectPart->toolchainDefines); - result += CppTools::CompilerOptionsBuilder::createDefineOptions(projectPart->projectDefines); - result += CppTools::CompilerOptionsBuilder::createHeaderPathOptions(projectPart->headerPaths); - result += QLatin1String("-fPIC"); // TODO: Remove? + 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? return result; } @@ -127,7 +141,7 @@ static QList unitsToAnalyzeFromCompi } static QList unitsToAnalyzeFromProjectParts( - const QList projectParts) + const QList projectParts, const QString &toolchainType) { typedef ClangStaticAnalyzerRunControl::AnalyzeUnit AnalyzeUnit; qCDebug(LOG) << "Taking arguments for analyzing from ProjectParts."; @@ -143,7 +157,8 @@ static QList unitsToAnalyzeFromProje continue; QTC_CHECK(file.kind != ProjectFile::Unclassified); if (ProjectFile::isSource(file.kind)) { - const QStringList arguments = argumentsFromProjectPart(projectPart, file.kind); + const QStringList arguments + = argumentsFromProjectPart(projectPart, file.kind, toolchainType); unitsToAnalyze << AnalyzeUnit(file.path, arguments); } } @@ -152,15 +167,14 @@ static QList unitsToAnalyzeFromProje return unitsToAnalyze; } -static QList unitsToAnalyze( - const CppTools::ProjectInfo &projectInfo) +QList ClangStaticAnalyzerRunControl::unitsToAnalyze() { - QTC_ASSERT(projectInfo.isValid(), return QList()); + QTC_ASSERT(m_projectInfo.isValid(), return QList()); - const ProjectInfo::CompilerCallData compilerCallData = projectInfo.compilerCallData(); + const ProjectInfo::CompilerCallData compilerCallData = m_projectInfo.compilerCallData(); if (!compilerCallData.isEmpty()) return unitsToAnalyzeFromCompilerCallData(compilerCallData); - return unitsToAnalyzeFromProjectParts(projectInfo.projectParts()); + return unitsToAnalyzeFromProjectParts(m_projectInfo.projectParts(), m_toolchainType); } bool ClangStaticAnalyzerRunControl::startEngine() @@ -174,7 +188,8 @@ bool ClangStaticAnalyzerRunControl::startEngine() // Check clang executable bool isValidClangExecutable; - const QString executable = clangExecutableFromSettings(&isValidClangExecutable); + const QString executable + = clangExecutableFromSettings(m_toolchainType, &isValidClangExecutable); if (!isValidClangExecutable) { emit appendMessage(tr("Clang Static Analyzer: Invalid executable \"%1\", stop.") .arg(executable) + QLatin1Char('\n'), @@ -196,7 +211,7 @@ bool ClangStaticAnalyzerRunControl::startEngine() m_clangLogFileDir = temporaryDir.path(); // Collect files - QList unitsToProcess = unitsToAnalyze(m_projectInfo); + QList unitsToProcess = unitsToAnalyze(); Utils::sort(unitsToProcess, [](const AnalyzeUnit &a1, const AnalyzeUnit &a2) -> bool { return a1.file < a2.file; }); diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h index cc56f107f63..b47b6c8babb 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h @@ -56,6 +56,7 @@ signals: void newDiagnosticsAvailable(const QList &diagnostics); private: + QList unitsToAnalyze(); void analyzeNextFile(); ClangStaticAnalyzerRunner *createRunner(); @@ -68,6 +69,7 @@ private: private: const CppTools::ProjectInfo m_projectInfo; + const QString m_toolchainType; QString m_clangExecutable; QString m_clangLogFileDir; diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp index 301496fac71..bf6f5d43da4 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp @@ -61,7 +61,8 @@ bool ClangStaticAnalyzerRunControlFactory::canRun(RunConfiguration *runConfigura QTC_ASSERT(kit, return false); ToolChain *toolChain = ToolChainKitInformation::toolChain(kit); return toolChain && (toolChain->type() == QLatin1String("clang") - || toolChain->type() == QLatin1String("gcc")); + || toolChain->type() == QLatin1String("gcc") + || toolChain->type() == QLatin1String("msvc")); } RunControl *ClangStaticAnalyzerRunControlFactory::create(RunConfiguration *runConfiguration, diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.cpp index 5c469a07a22..d2cc637cc24 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.cpp @@ -50,7 +50,7 @@ static QStringList constructCommandLineArguments(const QString &filePath, << logFile ; arguments += options; - arguments << filePath; + arguments << QDir::toNativeSeparators(filePath); return arguments; } @@ -73,6 +73,7 @@ ClangStaticAnalyzerRunner::ClangStaticAnalyzerRunner(const QString &clangExecuta QTC_CHECK(!m_clangLogFileDir.isEmpty()); m_process.setProcessChannelMode(QProcess::MergedChannels); + m_process.setWorkingDirectory(m_clangLogFileDir); // Current clang-cl puts log file into working dir. connect(&m_process, &QProcess::started, this, &ClangStaticAnalyzerRunner::onProcessStarted); connect(&m_process, static_cast(&QProcess::finished), @@ -122,7 +123,7 @@ void ClangStaticAnalyzerRunner::onProcessFinished(int exitCode, QProcess::ExitSt { if (exitStatus == QProcess::NormalExit) { if (exitCode == 0) - emit finishedWithSuccess(m_logFile); + emit finishedWithSuccess(actualLogFile()); else emit finishedWithFailure(finishedWithBadExitCode(exitCode), processCommandlineAndOutput()); } else { // == QProcess::CrashExit @@ -169,5 +170,15 @@ QString ClangStaticAnalyzerRunner::processCommandlineAndOutput() const QString::fromLocal8Bit(m_processOutput)); } +QString ClangStaticAnalyzerRunner::actualLogFile() const +{ + if (QFileInfo(m_logFile).size() == 0) { + // Current clang-cl ignores -o, always putting the log file into the working directory. + return m_clangLogFileDir + QLatin1Char('/') + QFileInfo(m_filePath).completeBaseName() + + QLatin1String(".plist"); + } + return m_logFile; +} + } // namespace Internal } // namespace ClangStaticAnalyzer diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.h b/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.h index 461f694e2e7..b175ef8b3fa 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.h @@ -60,6 +60,7 @@ private: QString createLogFile(const QString &filePath) const; QString processCommandlineAndOutput() const; + QString actualLogFile() const; private: QString m_clangExecutable; diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerutils.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerutils.cpp index 6beff9e1928..e349ebe8c57 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerutils.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerutils.cpp @@ -37,9 +37,12 @@ static bool isFileExecutable(const QString &executablePath) namespace ClangStaticAnalyzer { namespace Internal { -QString clangExecutableFromSettings(bool *isValid) +QString clangExecutableFromSettings(const QString &toolchainType, bool *isValid) { - return clangExecutable(ClangStaticAnalyzerSettings::instance()->clangExecutable(), isValid); + QString exeFromSettings = ClangStaticAnalyzerSettings::instance()->clangExecutable(); + if (toolchainType == QLatin1String("msvc")) + exeFromSettings.replace(QLatin1String("clang.exe"), QLatin1String("clang-cl.exe")); + return clangExecutable(exeFromSettings, isValid); } QString clangExecutable(const QString &fileNameOrPath, bool *isValid) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerutils.h b/plugins/clangstaticanalyzer/clangstaticanalyzerutils.h index 8c634700228..0c7a49b18d3 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerutils.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerutils.h @@ -33,7 +33,7 @@ namespace Internal { class Location; QString clangExecutable(const QString &fileNameOrPath, bool *isValid); -QString clangExecutableFromSettings(bool *isValid); +QString clangExecutableFromSettings(const QString &toolchainType, bool *isValid); QString createFullLocationString(const ClangStaticAnalyzer::Internal::Location &location); From 43d6c7672a303e26905ba014b54f730e218418bf Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Fri, 24 Oct 2014 11:27:45 +0200 Subject: [PATCH 044/111] Build tests by default (*.pro) Change-Id: I8f4f5d81ea9e137b386e619512f093b6c972d92a Reviewed-by: Christian Kandeler --- clangstaticanalyzer.pro | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/clangstaticanalyzer.pro b/clangstaticanalyzer.pro index 5a433f2bd4e..96b1bc27003 100644 --- a/clangstaticanalyzer.pro +++ b/clangstaticanalyzer.pro @@ -1,6 +1,8 @@ TEMPLATE = subdirs CONFIG += ordered -SUBDIRS += plugins/clangstaticanalyzer +SUBDIRS += \ + plugins/clangstaticanalyzer \ + plugins/clangstaticanalyzer/tests QMAKE_EXTRA_TARGETS = docs install_docs # dummy targets for consistency From c632be5c924bbef9619e79af645edadca88e0b94 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Fri, 30 Jan 2015 14:47:47 +0100 Subject: [PATCH 045/111] Enable run control for mingw toolchains. This is supported now. Change-Id: If56be39138f8cb6c10e486e4a48e35964bdc0a94 Reviewed-by: Nikolai Kosjar --- .../clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp index bf6f5d43da4..10cd9193404 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp @@ -62,6 +62,7 @@ bool ClangStaticAnalyzerRunControlFactory::canRun(RunConfiguration *runConfigura ToolChain *toolChain = ToolChainKitInformation::toolChain(kit); return toolChain && (toolChain->type() == QLatin1String("clang") || toolChain->type() == QLatin1String("gcc") + || toolChain->type() == QLatin1String("mingw") || toolChain->type() == QLatin1String("msvc")); } From 2946364ce6ad760f732d1042e3206a0fe0a456d6 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Wed, 4 Feb 2015 15:19:30 +0100 Subject: [PATCH 046/111] Add unit tests. These test the complete workflow as the user experiences it when clicking "Start". Intended usage: (1) Run sdktool to set up a kit with the toolchain you want to test against (using a temporary directory). The tests assume exactly one Kit to be present. (2) Start Creator with a matching settings path and "-load ClangStaticAnalyzer -test ClangStaticAnalyzer". (3) Repeat until all toolchains have been tested. The initial implementation tests one trivial source file with both qbs and qmake. Change-Id: I810f23e2990a789a4dd9f1dd16335fbcf5c5f39f Reviewed-by: Nikolai Kosjar --- .../clangstaticanalyzer.pro | 6 + .../clangstaticanalyzer.qbs | 11 ++ .../clangstaticanalyzerdiagnosticmodel.h | 1 + .../clangstaticanalyzerplugin.cpp | 13 +++ .../clangstaticanalyzerplugin.h | 2 + .../clangstaticanalyzertool.cpp | 9 ++ .../clangstaticanalyzertool.h | 8 ++ .../clangstaticanalyzerunittests.cpp | 104 ++++++++++++++++++ .../clangstaticanalyzerunittests.h | 53 +++++++++ .../clangstaticanalyzerunittests.qrc | 7 ++ .../unit-tests/simple/main.cpp | 5 + .../unit-tests/simple/simple.pro | 3 + .../unit-tests/simple/simple.qbs | 5 + 13 files changed, 227 insertions(+) create mode 100644 plugins/clangstaticanalyzer/clangstaticanalyzerunittests.cpp create mode 100644 plugins/clangstaticanalyzer/clangstaticanalyzerunittests.h create mode 100644 plugins/clangstaticanalyzer/clangstaticanalyzerunittests.qrc create mode 100644 plugins/clangstaticanalyzer/unit-tests/simple/main.cpp create mode 100644 plugins/clangstaticanalyzer/unit-tests/simple/simple.pro create mode 100644 plugins/clangstaticanalyzer/unit-tests/simple/simple.qbs diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzer.pro b/plugins/clangstaticanalyzer/clangstaticanalyzer.pro index 5c7e91c599f..df939e9f36c 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzer.pro +++ b/plugins/clangstaticanalyzer/clangstaticanalyzer.pro @@ -37,5 +37,11 @@ HEADERS += \ FORMS += \ clangstaticanalyzerconfigwidget.ui +equals(TEST, 1) { + HEADERS += clangstaticanalyzerunittests.h + SOURCES += clangstaticanalyzerunittests.cpp + RESOURCES += clangstaticanalyzerunittests.qrc +} + DISTFILES += \ tests/tests.pri diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzer.qbs b/plugins/clangstaticanalyzer/clangstaticanalyzer.qbs index 6c2612a69c1..78c7decc5df 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzer.qbs +++ b/plugins/clangstaticanalyzer/clangstaticanalyzer.qbs @@ -44,4 +44,15 @@ QtcPlugin { "clangstaticanalyzerutils.h", "clangstaticanalyzer_global.h", ] + + Group { + name: "Unit tests" + condition: project.testsEnabled + files: [ + "clangstaticanalyzerunittests.cpp", + "clangstaticanalyzerunittests.h", + "clangstaticanalyzerunittests.qrc", + "unit-tests/**/*", + ] + } } diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.h b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.h index beccf89a846..d3af8149826 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.h @@ -34,6 +34,7 @@ public: ClangStaticAnalyzerDiagnosticModel(QObject *parent = 0); void addDiagnostics(const QList &diagnostics); + QList diagnostics() const { return m_diagnostics; } void clear(); // QAbstractListModel interface diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp index e635305b97d..943d7ac7e5d 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp @@ -22,6 +22,10 @@ #include "clangstaticanalyzerruncontrolfactory.h" #include "clangstaticanalyzertool.h" +#ifdef WITH_TESTS +#include "clangstaticanalyzerunittests.h" +#endif + #include #include #include @@ -156,5 +160,14 @@ ExtensionSystem::IPlugin::ShutdownFlag ClangStaticAnalyzerPlugin::aboutToShutdow return SynchronousShutdown; } +QList ClangStaticAnalyzerPlugin::createTestObjects() const +{ + QList tests; +#ifdef WITH_TESTS + tests << new ClangStaticAnalyzerUnitTests(m_analyzerTool); +#endif + return tests; +} + } // namespace Internal } // namespace ClangStaticAnalyzerPlugin diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.h b/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.h index d96611a16f2..c0a6a247fb6 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.h @@ -42,6 +42,8 @@ public: ShutdownFlag aboutToShutdown(); private: + QList createTestObjects() const override; + ClangStaticAnalyzerTool *m_analyzerTool; }; diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp index ffec5af1a73..93579781a07 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp @@ -54,6 +54,7 @@ ClangStaticAnalyzerTool::ClangStaticAnalyzerTool(QObject *parent) , m_diagnosticView(0) , m_goBack(0) , m_goNext(0) + , m_running(false) { setObjectName(QLatin1String("ClangStaticAnalyzerTool")); setRunMode(ProjectExplorer::ClangStaticAnalyzerMode); @@ -206,6 +207,7 @@ void ClangStaticAnalyzerTool::startTool(StartMode mode) QTC_ASSERT(project, return); m_projectInfoBeforeBuild = CppTools::CppModelManager::instance()->projectInfo(project); QTC_ASSERT(m_projectInfoBeforeBuild.isValid(), return); + m_running = true; ProjectExplorerPlugin::instance()->runProject(project, runMode()); } @@ -220,6 +222,11 @@ void ClangStaticAnalyzerTool::resetCursorAndProjectInfoBeforeBuild() m_projectInfoBeforeBuild = CppTools::ProjectInfo(); } +QList ClangStaticAnalyzerTool::diagnostics() const +{ + return m_diagnosticModel->diagnostics(); +} + void ClangStaticAnalyzerTool::onEngineIsStarting() { QTC_ASSERT(m_diagnosticModel, return); @@ -246,6 +253,8 @@ void ClangStaticAnalyzerTool::onEngineFinished() AnalyzerManager::showStatusMessage(issuesFound > 0 ? AnalyzerManager::tr("Clang Static Analyzer finished, %n issues were found.", 0, issuesFound) : AnalyzerManager::tr("Clang Static Analyzer finished, no issues were found.")); + m_running = false; + emit finished(); } void ClangStaticAnalyzerTool::setBusyCursor(bool busy) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzertool.h b/plugins/clangstaticanalyzer/clangstaticanalyzertool.h index 8f3bb1f1965..4b61ae0fdaa 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzertool.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzertool.h @@ -40,6 +40,13 @@ public: CppTools::ProjectInfo projectInfoBeforeBuild() const; void resetCursorAndProjectInfoBeforeBuild(); + // For testing. + bool isRunning() const { return m_running; } + QList diagnostics() const; + +signals: + void finished(); // For testing. + private: QWidget *createWidgets(); Analyzer::AnalyzerRunControl *createRunControl(const Analyzer::AnalyzerStartParameters &sp, @@ -60,6 +67,7 @@ private: QAction *m_goBack; QAction *m_goNext; + bool m_running; }; } // namespace Internal diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.cpp new file mode 100644 index 00000000000..82c5ac1b292 --- /dev/null +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.cpp @@ -0,0 +1,104 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc +** 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. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** +****************************************************************************/ + +#include "clangstaticanalyzerunittests.h" + +#include "clangstaticanalyzerdiagnostic.h" +#include "clangstaticanalyzertool.h" +#include "clangstaticanalyzerutils.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +using namespace Analyzer; +using namespace ProjectExplorer; +using namespace Utils; + +namespace ClangStaticAnalyzer { +namespace Internal { + +ClangStaticAnalyzerUnitTests::ClangStaticAnalyzerUnitTests(ClangStaticAnalyzerTool *analyzerTool, + QObject *parent) + : QObject(parent) + , m_analyzerTool(analyzerTool) + , m_tmpDir(0) +{ +} + +void ClangStaticAnalyzerUnitTests::initTestCase() +{ + const QList allKits = KitManager::kits(); + if (allKits.count() != 1) + QSKIP("This test requires exactly one kit to be present"); + const ToolChain * const toolchain = ToolChainKitInformation::toolChain(allKits.first()); + if (!toolchain) + QSKIP("This test requires that there is a kit with a toolchain."); + bool hasClangExecutable; + clangExecutableFromSettings(toolchain->type(), &hasClangExecutable); + if (!hasClangExecutable) + QSKIP("No clang suitable for analyzing found"); + + m_tmpDir = new CppTools::Tests::TemporaryCopiedDir(QLatin1String(":/unit-tests")); +} + +void ClangStaticAnalyzerUnitTests::cleanupTestCase() +{ + delete m_tmpDir; +} + +void ClangStaticAnalyzerUnitTests::testProject() +{ + QFETCH(QString, projectFilePath); + QFETCH(int, expectedDiagCount); + + CppTools::Tests::ProjectOpenerAndCloser projectManager; + const CppTools::ProjectInfo projectInfo = projectManager.open(projectFilePath, true); + QVERIFY(projectInfo.isValid()); + AnalyzerManager::selectTool(m_analyzerTool, Analyzer::StartLocal); + AnalyzerManager::startTool(); + if (m_analyzerTool->isRunning()) { + QSignalSpy waiter(m_analyzerTool, SIGNAL(finished())); + QVERIFY(waiter.wait(30000)); + } + QCOMPARE(m_analyzerTool->diagnostics().count(), expectedDiagCount); +} + +void ClangStaticAnalyzerUnitTests::testProject_data() +{ + QTest::addColumn("projectFilePath"); + QTest::addColumn("expectedDiagCount"); + QTest::newRow("qbs project") + << QString(m_tmpDir->path() + QLatin1String("/simple/simple.qbs")) << 1; + QTest::newRow("qbs project") + << QString(m_tmpDir->path() + QLatin1String("/simple/simple.pro")) << 1; +} + +} // namespace Internal +} // namespace ClangStaticAnalyzerPlugin diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.h b/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.h new file mode 100644 index 00000000000..bbf9cc88f6f --- /dev/null +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.h @@ -0,0 +1,53 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc +** 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. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. +** +** If you have questions regarding the use of this file, please use +** contact form at http://qt.digia.com +** +****************************************************************************/ + +#ifndef CLANGSTATICANALYZERUNITTESTS_H +#define CLANGSTATICANALYZERUNITTESTS_H + +#include +#include + +namespace CppTools { namespace Tests { class TemporaryCopiedDir; } } + +namespace ClangStaticAnalyzer { +namespace Internal { +class ClangStaticAnalyzerTool; + +class ClangStaticAnalyzerUnitTests : public QObject +{ + Q_OBJECT + +public: + ClangStaticAnalyzerUnitTests(ClangStaticAnalyzerTool *analyzerTool, QObject *parent = 0); + +private slots: + void initTestCase(); + void cleanupTestCase(); + void testProject(); + void testProject_data(); + +private: + ClangStaticAnalyzerTool * const m_analyzerTool; + CppTools::Tests::TemporaryCopiedDir *m_tmpDir; +}; + +} // namespace Internal +} // namespace ClangStaticAnalyzerPlugin + +#endif // Include guard + diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.qrc b/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.qrc new file mode 100644 index 00000000000..0de4936d20e --- /dev/null +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.qrc @@ -0,0 +1,7 @@ + + + unit-tests/simple/main.cpp + unit-tests/simple/simple.qbs + unit-tests/simple/simple.pro + + diff --git a/plugins/clangstaticanalyzer/unit-tests/simple/main.cpp b/plugins/clangstaticanalyzer/unit-tests/simple/main.cpp new file mode 100644 index 00000000000..af917a3a332 --- /dev/null +++ b/plugins/clangstaticanalyzer/unit-tests/simple/main.cpp @@ -0,0 +1,5 @@ +int main() +{ + int *i = 0; + *i = 42; +} diff --git a/plugins/clangstaticanalyzer/unit-tests/simple/simple.pro b/plugins/clangstaticanalyzer/unit-tests/simple/simple.pro new file mode 100644 index 00000000000..fb560c2af61 --- /dev/null +++ b/plugins/clangstaticanalyzer/unit-tests/simple/simple.pro @@ -0,0 +1,3 @@ +CONFIG -= QT + +SOURCES = main.cpp diff --git a/plugins/clangstaticanalyzer/unit-tests/simple/simple.qbs b/plugins/clangstaticanalyzer/unit-tests/simple/simple.qbs new file mode 100644 index 00000000000..f6ae698a0cb --- /dev/null +++ b/plugins/clangstaticanalyzer/unit-tests/simple/simple.qbs @@ -0,0 +1,5 @@ +import qbs + +CppApplication { + files: ["main.cpp"] +} From 19476fb70e009aed5a345eb716203b81011a0fc7 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Wed, 11 Feb 2015 16:17:53 +0100 Subject: [PATCH 047/111] Adapt to API change in mainline Creator. Change-Id: If1028fcf28373d99394d081c98e5cbc46aca81c5 Reviewed-by: Nikolai Kosjar --- .../clangstaticanalyzerdiagnosticview.cpp | 78 +++++++------------ .../clangstaticanalyzerdiagnosticview.h | 7 +- 2 files changed, 27 insertions(+), 58 deletions(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.cpp index 616cf9f3697..646bd9380b2 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.cpp @@ -21,19 +21,12 @@ #include "clangstaticanalyzerlogfilereader.h" #include "clangstaticanalyzerutils.h" -#include - #include -#include -#include -#include -#include #include #include #include #include -#include #include using namespace Analyzer; @@ -203,32 +196,6 @@ DetailedErrorDelegate::SummaryLineInfo ClangStaticAnalyzerDiagnosticDelegate::su return info; } -void ClangStaticAnalyzerDiagnosticDelegate::copy() -{ - QTC_ASSERT(m_detailsIndex.isValid(), return); - - const Diagnostic diagnostic = m_detailsIndex.data(Qt::UserRole).value(); - QTC_ASSERT(diagnostic.isValid(), return); - - // Create summary - QString clipboardText = diagnostic.category + QLatin1String(": ") + diagnostic.type; - if (diagnostic.type != diagnostic.description) - clipboardText += QLatin1String(": ") + diagnostic.description; - clipboardText += QLatin1Char('\n'); - - // Create explaining steps - int explainingStepNumber = 1; - foreach (const ExplainingStep &explainingStep, diagnostic.explainingSteps) { - clipboardText += createExplainingStepString(explainingStep, - explainingStepNumber++, - /*withMarkup=*/ false, - /*withAbsolutePath=*/ true) + QLatin1Char('\n'); - } - - clipboardText.chop(1); // Remove \n - QApplication::clipboard()->setText(clipboardText); -} - QWidget *ClangStaticAnalyzerDiagnosticDelegate::createDetailsWidget(const QFont &font, const QModelIndex &index, QWidget *parent) const @@ -269,31 +236,38 @@ QWidget *ClangStaticAnalyzerDiagnosticDelegate::createDetailsWidget(const QFont return widget; } +QString ClangStaticAnalyzerDiagnosticDelegate::textualRepresentation() const +{ + QTC_ASSERT(m_detailsIndex.isValid(), return QString()); + + const Diagnostic diagnostic = m_detailsIndex.data(Qt::UserRole).value(); + QTC_ASSERT(diagnostic.isValid(), return QString()); + + // Create summary + QString clipboardText = diagnostic.category + QLatin1String(": ") + diagnostic.type; + if (diagnostic.type != diagnostic.description) + clipboardText += QLatin1String(": ") + diagnostic.description; + clipboardText += QLatin1Char('\n'); + + // Create explaining steps + int explainingStepNumber = 1; + foreach (const ExplainingStep &explainingStep, diagnostic.explainingSteps) { + clipboardText += createExplainingStepString(explainingStep, + explainingStepNumber++, + /*withMarkup=*/ false, + /*withAbsolutePath=*/ true) + QLatin1Char('\n'); + } + + clipboardText.chop(1); // Remove \n + return clipboardText; +} + ClangStaticAnalyzerDiagnosticView::ClangStaticAnalyzerDiagnosticView(QWidget *parent) : Analyzer::DetailedErrorView(parent) { ClangStaticAnalyzerDiagnosticDelegate *delegate = new ClangStaticAnalyzerDiagnosticDelegate(this); setItemDelegate(delegate); - - m_copyAction = new QAction(this); - m_copyAction->setText(tr("Copy")); - m_copyAction->setIcon(QIcon(QLatin1String(Core::Constants::ICON_COPY))); - m_copyAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_C)); - m_copyAction->setShortcutContext(Qt::WidgetWithChildrenShortcut); - connect(m_copyAction, &QAction::triggered, - delegate, &ClangStaticAnalyzerDiagnosticDelegate::copy); - addAction(m_copyAction); -} - -void ClangStaticAnalyzerDiagnosticView::contextMenuEvent(QContextMenuEvent *e) -{ - if (selectionModel()->selectedRows().isEmpty()) - return; - - QMenu menu; - menu.addAction(m_copyAction); - menu.exec(e->globalPos()); } } // namespace Internal diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.h b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.h index 5830a05a504..70dd1a8e151 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.h @@ -30,11 +30,6 @@ class ClangStaticAnalyzerDiagnosticView : public Analyzer::DetailedErrorView public: ClangStaticAnalyzerDiagnosticView(QWidget *parent = 0); - -private: - void contextMenuEvent(QContextMenuEvent *e); - - QAction *m_copyAction; }; class ClangStaticAnalyzerDiagnosticDelegate : public Analyzer::DetailedErrorDelegate @@ -43,11 +38,11 @@ public: ClangStaticAnalyzerDiagnosticDelegate(QListView *parent); SummaryLineInfo summaryInfo(const QModelIndex &index) const; - void copy(); private: QWidget *createDetailsWidget(const QFont &font, const QModelIndex &index, QWidget *parent) const; + QString textualRepresentation() const Q_DECL_OVERRIDE; }; } // namespace Internal From 0ece47de90734a041a6c5524129661e62f53b211 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Fri, 13 Feb 2015 11:01:30 +0100 Subject: [PATCH 048/111] Remove overide declarations. Not ready yet. Change-Id: I800e75c526ff8609849526c3317a6d0a1658176b Reviewed-by: Eike Ziller --- plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.h | 2 +- plugins/clangstaticanalyzer/clangstaticanalyzerplugin.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.h b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.h index 2097b0da06c..ed6acae4f3b 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.h @@ -42,7 +42,7 @@ public: private: QWidget *createDetailsWidget(const QFont &font, const QModelIndex &index, QWidget *parent) const; - QString textualRepresentation() const Q_DECL_OVERRIDE; + QString textualRepresentation() const; }; } // namespace Internal diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.h b/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.h index 8ab54ae43c6..474934e0ee1 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.h @@ -42,7 +42,7 @@ public: ShutdownFlag aboutToShutdown(); private: - QList createTestObjects() const override; + QList createTestObjects() const; ClangStaticAnalyzerTool *m_analyzerTool; }; From 93685b97efe97616802f7483ebe1e37c8e8a653f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Wed, 18 Feb 2015 16:05:46 +0100 Subject: [PATCH 049/111] Compile fix after recent Analyzer core changes Change-Id: I100e75c526ff8609849526c3317a6d0a1658176b Reviewed-by: Christian Stenger Reviewed-by: Nikolai Kosjar --- .../clangstaticanalyzerplugin.cpp | 17 ++++++++++++++--- .../clangstaticanalyzertool.cpp | 9 ++++----- .../clangstaticanalyzertool.h | 12 +++++++----- .../clangstaticanalyzerunittests.cpp | 2 +- 4 files changed, 26 insertions(+), 14 deletions(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp index 1c09b0039e5..55adb34d6db 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp @@ -125,16 +125,27 @@ bool ClangStaticAnalyzerPlugin::initializeEnterpriseFeatures(const QStringList & Q_UNUSED(arguments); Q_UNUSED(errorString); - m_analyzerTool = new ClangStaticAnalyzerTool(this); + auto tool = m_analyzerTool = new ClangStaticAnalyzerTool(this); addAutoReleasedObject(new ClangStaticAnalyzerRunControlFactory(m_analyzerTool)); addAutoReleasedObject(new ClangStaticAnalyzerOptionsPage); + auto toolStarter = [tool](StartMode mode) { return tool->startTool(mode); }; + auto widgetCreator = [tool] { return tool->createWidgets(); }; + auto runControlCreator = [tool](const AnalyzerStartParameters &sp, + ProjectExplorer::RunConfiguration *runConfiguration) { + return tool->createRunControl(sp, runConfiguration); + }; + const QString toolTip = tr("Clang Static Analyzer uses the analyzer from the clang project " "to find bugs."); AnalyzerAction *action = new AnalyzerAction(this); - action->setId("ClangStaticAnalyzer"); - action->setTool(m_analyzerTool); + action->setRunMode(ProjectExplorer::ClangStaticAnalyzerMode); + action->setToolId(ClangStaticAnalyzerToolId); + action->setActionId("ClangStaticAnalyzer"); + action->setWidgetCreator(widgetCreator); + action->setRunControlCreator(runControlCreator); + action->setToolStarter(toolStarter); action->setText(tr("Clang Static Analyzer")); action->setToolTip(toolTip); action->setMenuGroup(Constants::G_ANALYZER_TOOLS); diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp index 4fbc2aa5b55..c0e10fed3e9 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp @@ -49,7 +49,7 @@ namespace ClangStaticAnalyzer { namespace Internal { ClangStaticAnalyzerTool::ClangStaticAnalyzerTool(QObject *parent) - : IAnalyzerTool(parent) + : QObject(parent) , m_diagnosticModel(0) , m_diagnosticView(0) , m_goBack(0) @@ -57,8 +57,6 @@ ClangStaticAnalyzerTool::ClangStaticAnalyzerTool(QObject *parent) , m_running(false) { setObjectName(QLatin1String("ClangStaticAnalyzerTool")); - setRunMode(ProjectExplorer::ClangStaticAnalyzerMode); - setToolMode(AnyMode); } QWidget *ClangStaticAnalyzerTool::createWidgets() @@ -85,7 +83,8 @@ QWidget *ClangStaticAnalyzerTool::createWidgets() m_diagnosticView->setObjectName(QLatin1String("ClangStaticAnalyzerIssuesView")); m_diagnosticView->setWindowTitle(tr("Clang Static Analyzer Issues")); - QDockWidget *issuesDock = AnalyzerManager::createDockWidget(this, m_diagnosticView); + QDockWidget *issuesDock = AnalyzerManager::createDockWidget(ClangStaticAnalyzerToolId, + m_diagnosticView); issuesDock->show(); Utils::FancyMainWindow *mw = AnalyzerManager::mainWindow(); mw->splitDockWidget(mw->toolBarDockWidget(), issuesDock, Qt::Vertical); @@ -208,7 +207,7 @@ void ClangStaticAnalyzerTool::startTool(StartMode mode) m_projectInfoBeforeBuild = CppTools::CppModelManager::instance()->projectInfo(project); QTC_ASSERT(m_projectInfoBeforeBuild.isValid(), return); m_running = true; - ProjectExplorerPlugin::instance()->runProject(project, runMode()); + ProjectExplorerPlugin::runProject(project, ProjectExplorer::ClangStaticAnalyzerMode); } CppTools::ProjectInfo ClangStaticAnalyzerTool::projectInfoBeforeBuild() const diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzertool.h b/plugins/clangstaticanalyzer/clangstaticanalyzertool.h index 24c39e3b398..ba4f57020d0 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzertool.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzertool.h @@ -31,7 +31,9 @@ class ClangStaticAnalyzerDiagnosticModel; class ClangStaticAnalyzerDiagnosticView; class Diagnostic; -class ClangStaticAnalyzerTool : public Analyzer::IAnalyzerTool +const char ClangStaticAnalyzerToolId[] = "ClangStaticAnalyzer"; + +class ClangStaticAnalyzerTool : public QObject { Q_OBJECT @@ -44,15 +46,15 @@ public: bool isRunning() const { return m_running; } QList diagnostics() const; -signals: - void finished(); // For testing. - -private: QWidget *createWidgets(); Analyzer::AnalyzerRunControl *createRunControl(const Analyzer::AnalyzerStartParameters &sp, ProjectExplorer::RunConfiguration *runConfiguration); void startTool(Analyzer::StartMode mode); +signals: + void finished(); // For testing. + +private: void onEngineIsStarting(); void onNewDiagnosticsAvailable(const QList &diagnostics); void onEngineFinished(); diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.cpp index 82c5ac1b292..318ff956378 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.cpp @@ -81,7 +81,7 @@ void ClangStaticAnalyzerUnitTests::testProject() CppTools::Tests::ProjectOpenerAndCloser projectManager; const CppTools::ProjectInfo projectInfo = projectManager.open(projectFilePath, true); QVERIFY(projectInfo.isValid()); - AnalyzerManager::selectTool(m_analyzerTool, Analyzer::StartLocal); + AnalyzerManager::selectTool(ClangStaticAnalyzerToolId, Analyzer::StartLocal); AnalyzerManager::startTool(); if (m_analyzerTool->isRunning()) { QSignalSpy waiter(m_analyzerTool, SIGNAL(finished())); From 4495ab283c8713d4f6fcfd36e8296f4c3867f1cb Mon Sep 17 00:00:00 2001 From: Daniel Teske Date: Thu, 19 Feb 2015 14:48:39 +0100 Subject: [PATCH 050/111] Fix compile after Analyzer changes Change-Id: I3870488ff2052465508c23d429dcb2d25a249857 Reviewed-by: Andre Poenitz --- plugins/clangstaticanalyzer/clangstaticanalyzerunittests.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.cpp index 318ff956378..d73cf78e42f 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.cpp @@ -81,7 +81,7 @@ void ClangStaticAnalyzerUnitTests::testProject() CppTools::Tests::ProjectOpenerAndCloser projectManager; const CppTools::ProjectInfo projectInfo = projectManager.open(projectFilePath, true); QVERIFY(projectInfo.isValid()); - AnalyzerManager::selectTool(ClangStaticAnalyzerToolId, Analyzer::StartLocal); + AnalyzerManager::selectTool(ClangStaticAnalyzerToolId); AnalyzerManager::startTool(); if (m_analyzerTool->isRunning()) { QSignalSpy waiter(m_analyzerTool, SIGNAL(finished())); From 6ac1dc95fd092c6be409d9fb6874b53558a43a79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Fri, 20 Feb 2015 10:05:44 +0100 Subject: [PATCH 051/111] Adjust to Analyzer core changes Change-Id: I2985b1be505f9aa43f2a8615a8dfcafaeb991e21 Reviewed-by: Christian Stenger --- plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp | 3 +-- plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp | 4 +--- plugins/clangstaticanalyzer/clangstaticanalyzertool.h | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp index 55adb34d6db..52673def09f 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp @@ -129,7 +129,6 @@ bool ClangStaticAnalyzerPlugin::initializeEnterpriseFeatures(const QStringList & addAutoReleasedObject(new ClangStaticAnalyzerRunControlFactory(m_analyzerTool)); addAutoReleasedObject(new ClangStaticAnalyzerOptionsPage); - auto toolStarter = [tool](StartMode mode) { return tool->startTool(mode); }; auto widgetCreator = [tool] { return tool->createWidgets(); }; auto runControlCreator = [tool](const AnalyzerStartParameters &sp, ProjectExplorer::RunConfiguration *runConfiguration) { @@ -145,7 +144,7 @@ bool ClangStaticAnalyzerPlugin::initializeEnterpriseFeatures(const QStringList & action->setActionId("ClangStaticAnalyzer"); action->setWidgetCreator(widgetCreator); action->setRunControlCreator(runControlCreator); - action->setToolStarter(toolStarter); + action->setToolStarter([tool] { tool->startTool(); }); action->setText(tr("Clang Static Analyzer")); action->setToolTip(toolTip); action->setMenuGroup(Constants::G_ANALYZER_TOOLS); diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp index c0e10fed3e9..23d9b96cc47 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp @@ -191,10 +191,8 @@ static bool dontStartAfterHintForDebugMode() return false; } -void ClangStaticAnalyzerTool::startTool(StartMode mode) +void ClangStaticAnalyzerTool::startTool() { - QTC_ASSERT(mode == Analyzer::StartLocal, return); - AnalyzerManager::showMode(); if (dontStartAfterHintForDebugMode()) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzertool.h b/plugins/clangstaticanalyzer/clangstaticanalyzertool.h index ba4f57020d0..fa402a608ec 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzertool.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzertool.h @@ -49,7 +49,7 @@ public: QWidget *createWidgets(); Analyzer::AnalyzerRunControl *createRunControl(const Analyzer::AnalyzerStartParameters &sp, ProjectExplorer::RunConfiguration *runConfiguration); - void startTool(Analyzer::StartMode mode); + void startTool(); signals: void finished(); // For testing. From c87737d97fd76b177b18bd7d0f1f2c4abe31f34f Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Thu, 12 Feb 2015 12:36:46 +0100 Subject: [PATCH 052/111] UnitTest: Fix typo Change-Id: I2272740c7db66aaab77b05c53b14e182ccc8b919 Reviewed-by: Nikolai Kosjar --- plugins/clangstaticanalyzer/clangstaticanalyzerunittests.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.cpp index 82c5ac1b292..401359cc6c2 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.cpp @@ -96,7 +96,7 @@ void ClangStaticAnalyzerUnitTests::testProject_data() QTest::addColumn("expectedDiagCount"); QTest::newRow("qbs project") << QString(m_tmpDir->path() + QLatin1String("/simple/simple.qbs")) << 1; - QTest::newRow("qbs project") + QTest::newRow("qmake project") << QString(m_tmpDir->path() + QLatin1String("/simple/simple.pro")) << 1; } From 7c9c7b297a896d0b1ef82b2b23e0ed789539fdfc Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Thu, 26 Feb 2015 14:04:59 +0100 Subject: [PATCH 053/111] Don't fade out analyzer summary. There is no reason why the status of the analyzer run should disappear after a few seconds. Change-Id: I16c21f05a03ac31f489312fbe56373a531ecc5d5 Reviewed-by: Nikolai Kosjar --- plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp index 23d9b96cc47..6f9fb44955a 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp @@ -247,7 +247,7 @@ void ClangStaticAnalyzerTool::onEngineFinished() m_goBack->setEnabled(issuesFound > 1); m_goNext->setEnabled(issuesFound > 1); - AnalyzerManager::showStatusMessage(issuesFound > 0 + AnalyzerManager::showPermanentStatusMessage(issuesFound > 0 ? AnalyzerManager::tr("Clang Static Analyzer finished, %n issues were found.", 0, issuesFound) : AnalyzerManager::tr("Clang Static Analyzer finished, no issues were found.")); m_running = false; From bba6f927e90f32e7051d5f8e0e1dfa5ae4413ff2 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Thu, 26 Feb 2015 15:14:29 +0100 Subject: [PATCH 054/111] Don't attempt to analyze using icecc masquerading as clang. Also warn the user in the settings page against this. Change-Id: I4dbae953aa85f8dbdc9baa8dd0fda8ff0da45b76 Reviewed-by: Nikolai Kosjar --- .../clangstaticanalyzer.pro | 2 + .../clangstaticanalyzer.qbs | 2 + .../clangstaticanalyzerconfigwidget.cpp | 4 -- .../clangstaticanalyzerconfigwidget.ui | 6 +-- .../clangstaticanalyzerpathchooser.cpp | 40 +++++++++++++++++++ .../clangstaticanalyzerpathchooser.h | 40 +++++++++++++++++++ .../clangstaticanalyzerutils.cpp | 18 ++++++++- .../clangstaticanalyzerutils.h | 4 +- 8 files changed, 106 insertions(+), 10 deletions(-) create mode 100644 plugins/clangstaticanalyzer/clangstaticanalyzerpathchooser.cpp create mode 100644 plugins/clangstaticanalyzer/clangstaticanalyzerpathchooser.h diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzer.pro b/plugins/clangstaticanalyzer/clangstaticanalyzer.pro index df939e9f36c..38ddda3e641 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzer.pro +++ b/plugins/clangstaticanalyzer/clangstaticanalyzer.pro @@ -10,6 +10,7 @@ SOURCES += \ clangstaticanalyzerdiagnosticmodel.cpp \ clangstaticanalyzerdiagnosticview.cpp \ clangstaticanalyzerlogfilereader.cpp \ + clangstaticanalyzerpathchooser.cpp \ clangstaticanalyzerplugin.cpp \ clangstaticanalyzerruncontrol.cpp \ clangstaticanalyzerruncontrolfactory.cpp \ @@ -26,6 +27,7 @@ HEADERS += \ clangstaticanalyzerdiagnosticview.h \ clangstaticanalyzer_global.h \ clangstaticanalyzerlogfilereader.h \ + clangstaticanalyzerpathchooser.h \ clangstaticanalyzerplugin.h \ clangstaticanalyzerruncontrolfactory.h \ clangstaticanalyzerruncontrol.h \ diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzer.qbs b/plugins/clangstaticanalyzer/clangstaticanalyzer.qbs index 78c7decc5df..9113cc94c30 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzer.qbs +++ b/plugins/clangstaticanalyzer/clangstaticanalyzer.qbs @@ -28,6 +28,8 @@ QtcPlugin { "clangstaticanalyzerdiagnosticview.h", "clangstaticanalyzerlogfilereader.cpp", "clangstaticanalyzerlogfilereader.h", + "clangstaticanalyzerpathchooser.cpp", + "clangstaticanalyzerpathchooser.h", "clangstaticanalyzerplugin.cpp", "clangstaticanalyzerplugin.h", "clangstaticanalyzerruncontrol.cpp", diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.cpp index d6ff0fa5b84..6b8b0f0cee2 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.cpp @@ -33,10 +33,6 @@ ClangStaticAnalyzerConfigWidget::ClangStaticAnalyzerConfigWidget( { m_ui->setupUi(this); - m_ui->clangExecutableChooser->setExpectedKind(Utils::PathChooser::ExistingCommand); - m_ui->clangExecutableChooser->setHistoryCompleter( - QLatin1String("ClangStaticAnalyzer.ClangCommand.History")); - m_ui->clangExecutableChooser->setPromptDialogTitle(tr("Clang Command")); m_ui->clangExecutableChooser->setPath(settings->clangExecutable()); connect(m_ui->clangExecutableChooser, &Utils::PathChooser::changed, m_settings, &ClangStaticAnalyzerSettings::setClangExecutable); diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.ui b/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.ui index 800733a3317..8997f3a7d11 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.ui +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.ui @@ -30,7 +30,7 @@ - + @@ -88,9 +88,9 @@ - Utils::PathChooser + ClangStaticAnalyzer::Internal::PathChooser QWidget -
utils/pathchooser.h
+
clangstaticanalyzer/clangstaticanalyzerpathchooser.h
1
diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerpathchooser.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerpathchooser.cpp new file mode 100644 index 00000000000..b5711bfeab4 --- /dev/null +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerpathchooser.cpp @@ -0,0 +1,40 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd +** 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. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. +** +** If you have questions regarding the use of this file, please use +** contact form at http://www.qt.io/contact-us +** +****************************************************************************/ +#include "clangstaticanalyzerpathchooser.h" + +#include "clangstaticanalyzerutils.h" + +namespace ClangStaticAnalyzer { +namespace Internal { + +PathChooser::PathChooser(QWidget *parent) : Utils::PathChooser(parent) +{ + setExpectedKind(Utils::PathChooser::ExistingCommand); + setHistoryCompleter(QLatin1String("ClangStaticAnalyzer.ClangCommand.History")); + setPromptDialogTitle(tr("Clang Command")); +} + +bool PathChooser::validatePath(const QString &path, QString *errorMessage) +{ + if (!Utils::PathChooser::validatePath(path, errorMessage)) + return false; + return isClangExecutableUsable(fileName().toString(), errorMessage); +} + +} // namespace Internal +} // namespace ClangStaticAnalyzer diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerpathchooser.h b/plugins/clangstaticanalyzer/clangstaticanalyzerpathchooser.h new file mode 100644 index 00000000000..b4bc3c59476 --- /dev/null +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerpathchooser.h @@ -0,0 +1,40 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd +** 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. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. +** +** If you have questions regarding the use of this file, please use +** contact form at http://www.qt.io/contact-us +** +****************************************************************************/ +#ifndef QTC_CLANGSTATICANALYZER_PATHCHOOSER_H +#define QTC_CLANGSTATICANALYZER_PATHCHOOSER_H + +#include + +namespace ClangStaticAnalyzer { +namespace Internal { + +class PathChooser : public Utils::PathChooser +{ + Q_OBJECT + +public: + PathChooser(QWidget *parent = 0); + +private: + bool validatePath(const QString &path, QString *errorMessage = 0); +}; + +} // namespace Internal +} // namespace ClangStaticAnalyzer + +#endif // Include guard. diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerutils.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerutils.cpp index 06401eb2870..3860f929a6e 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerutils.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerutils.cpp @@ -23,6 +23,7 @@ #include +#include #include static bool isFileExecutable(const QString &executablePath) @@ -63,7 +64,7 @@ QString clangExecutable(const QString &fileNameOrPath, bool *isValid) executable = executableFromPath; } - *isValid = isFileExecutable(executable); + *isValid = isFileExecutable(executable) && isClangExecutableUsable(executable); return executable; } @@ -74,5 +75,20 @@ QString createFullLocationString(const ClangStaticAnalyzer::Internal::Location & return filePath + QLatin1Char(':') + lineNumber; } +bool isClangExecutableUsable(const QString &filePath, QString *errorMessage) +{ + const QFileInfo fi(filePath); + if (fi.isSymLink() && fi.symLinkTarget().contains(QLatin1String("icecc"))) { + if (errorMessage) { + *errorMessage = QCoreApplication::translate("ClangStaticAnalyzer", + "The chosen file \"%1\" seems to point to an icecc binary not suitable " + "for analyzing.\nPlease set a real clang executable.") + .arg(filePath); + } + return false; + } + return true; +} + } // namespace Internal } // namespace ClangStaticAnalyzer diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerutils.h b/plugins/clangstaticanalyzer/clangstaticanalyzerutils.h index e85d25f2868..ca06c4874e5 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerutils.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerutils.h @@ -25,13 +25,13 @@ QT_BEGIN_NAMESPACE class QString; QT_END_NAMESPACE - - namespace ClangStaticAnalyzer { namespace Internal { class Location; +bool isClangExecutableUsable(const QString &filePath, QString *errorMessage = 0); + QString clangExecutable(const QString &fileNameOrPath, bool *isValid); QString clangExecutableFromSettings(const QString &toolchainType, bool *isValid); From a13818f5cd3e8e60954dc75483834965926553fc Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Thu, 26 Feb 2015 16:33:10 +0100 Subject: [PATCH 055/111] Clear status message on start Change-Id: I82e94f0426796473b35dd2a534a4fd7c5aab2667 Reviewed-by: Christian Kandeler --- plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp index 6f9fb44955a..260aae865a9 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp @@ -198,6 +198,7 @@ void ClangStaticAnalyzerTool::startTool() if (dontStartAfterHintForDebugMode()) return; + AnalyzerManager::showPermanentStatusMessage(QString()); m_diagnosticModel->clear(); setBusyCursor(true); Project *project = SessionManager::startupProject(); From 6e796591f445aa0f193b280b9c89fcf82fa2236d Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Thu, 19 Feb 2015 18:08:38 +0100 Subject: [PATCH 056/111] Allow users to suppress diagnostics. This patch deals with what is likely the most common use case: Filtering specific messages at a particular location. The current granularity is essentially per-file (and per-function, where possible), which seems more useful than taking line numbers into account, as that would not be robust with regards to code changes elsewhere in the file. We can fine-tune this if the need arises. Change-Id: I4e9b2671fa199339cc3b995953d072b840cd3205 Reviewed-by: Nikolai Kosjar --- .../clangstaticanalyzer.pro | 9 +- .../clangstaticanalyzer.qbs | 7 + .../clangstaticanalyzerdiagnosticmodel.cpp | 71 ++++++++ .../clangstaticanalyzerdiagnosticmodel.h | 27 +++ .../clangstaticanalyzerdiagnosticview.cpp | 47 ++++- .../clangstaticanalyzerdiagnosticview.h | 9 + .../clangstaticanalyzerplugin.cpp | 8 + .../clangstaticanalyzerprojectsettings.cpp | 137 +++++++++++++++ .../clangstaticanalyzerprojectsettings.h | 87 ++++++++++ ...ngstaticanalyzerprojectsettingsmanager.cpp | 50 ++++++ ...langstaticanalyzerprojectsettingsmanager.h | 47 +++++ ...angstaticanalyzerprojectsettingswidget.cpp | 160 ++++++++++++++++++ ...clangstaticanalyzerprojectsettingswidget.h | 52 ++++++ ...langstaticanalyzerprojectsettingswidget.ui | 87 ++++++++++ .../clangstaticanalyzertool.cpp | 18 +- .../clangstaticanalyzertool.h | 2 + 16 files changed, 808 insertions(+), 10 deletions(-) create mode 100644 plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettings.cpp create mode 100644 plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettings.h create mode 100644 plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingsmanager.cpp create mode 100644 plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingsmanager.h create mode 100644 plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingswidget.cpp create mode 100644 plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingswidget.h create mode 100644 plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingswidget.ui diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzer.pro b/plugins/clangstaticanalyzer/clangstaticanalyzer.pro index 38ddda3e641..67eb90ad415 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzer.pro +++ b/plugins/clangstaticanalyzer/clangstaticanalyzer.pro @@ -12,6 +12,9 @@ SOURCES += \ clangstaticanalyzerlogfilereader.cpp \ clangstaticanalyzerpathchooser.cpp \ clangstaticanalyzerplugin.cpp \ + clangstaticanalyzerprojectsettings.cpp \ + clangstaticanalyzerprojectsettingsmanager.cpp \ + clangstaticanalyzerprojectsettingswidget.cpp \ clangstaticanalyzerruncontrol.cpp \ clangstaticanalyzerruncontrolfactory.cpp \ clangstaticanalyzerrunner.cpp \ @@ -29,6 +32,9 @@ HEADERS += \ clangstaticanalyzerlogfilereader.h \ clangstaticanalyzerpathchooser.h \ clangstaticanalyzerplugin.h \ + clangstaticanalyzerprojectsettings.h \ + clangstaticanalyzerprojectsettingsmanager.h \ + clangstaticanalyzerprojectsettingswidget.h \ clangstaticanalyzerruncontrolfactory.h \ clangstaticanalyzerruncontrol.h \ clangstaticanalyzerrunner.h \ @@ -37,7 +43,8 @@ HEADERS += \ clangstaticanalyzerutils.h FORMS += \ - clangstaticanalyzerconfigwidget.ui + clangstaticanalyzerconfigwidget.ui \ + clangstaticanalyzerprojectsettingswidget.ui equals(TEST, 1) { HEADERS += clangstaticanalyzerunittests.h diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzer.qbs b/plugins/clangstaticanalyzer/clangstaticanalyzer.qbs index 9113cc94c30..a97dc9f83c7 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzer.qbs +++ b/plugins/clangstaticanalyzer/clangstaticanalyzer.qbs @@ -32,6 +32,13 @@ QtcPlugin { "clangstaticanalyzerpathchooser.h", "clangstaticanalyzerplugin.cpp", "clangstaticanalyzerplugin.h", + "clangstaticanalyzerprojectsettings.cpp", + "clangstaticanalyzerprojectsettings.h", + "clangstaticanalyzerprojectsettingsmanager.cpp", + "clangstaticanalyzerprojectsettingsmanager.h", + "clangstaticanalyzerprojectsettingswidget.cpp", + "clangstaticanalyzerprojectsettingswidget.h", + "clangstaticanalyzerprojectsettingswidget.ui", "clangstaticanalyzerruncontrol.cpp", "clangstaticanalyzerruncontrol.h", "clangstaticanalyzerruncontrolfactory.cpp", diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.cpp index 5f1d21fb9f8..40f59244425 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.cpp @@ -18,9 +18,15 @@ #include "clangstaticanalyzerdiagnosticmodel.h" +#include "clangstaticanalyzerprojectsettingsmanager.h" #include "clangstaticanalyzerutils.h" +#include +#include +#include + #include +#include namespace ClangStaticAnalyzer { namespace Internal { @@ -118,5 +124,70 @@ QVariant ClangStaticAnalyzerDiagnosticModel::data(const QModelIndex &index, int return QVariant(); } + +ClangStaticAnalyzerDiagnosticFilterModel::ClangStaticAnalyzerDiagnosticFilterModel(QObject *parent) + : QSortFilterProxyModel(parent) +{ + // So that when a user closes and re-opens a project and *then* clicks "Suppress", + // we enter that information into the project settings. + connect(ProjectExplorer::SessionManager::instance(), + &ProjectExplorer::SessionManager::projectAdded, this, + [this](ProjectExplorer::Project *project) { + if (!m_project && project->projectDirectory() == m_lastProjectDirectory) + setProject(project); + }); +} + +void ClangStaticAnalyzerDiagnosticFilterModel::setProject(ProjectExplorer::Project *project) +{ + QTC_ASSERT(project, return); + if (m_project) { + disconnect(ProjectSettingsManager::getSettings(m_project), + &ProjectSettings::suppressedDiagnosticsChanged, this, + &ClangStaticAnalyzerDiagnosticFilterModel::handleSuppressedDiagnosticsChanged); + } + m_project = project; + m_lastProjectDirectory = m_project->projectDirectory(); + connect(ProjectSettingsManager::getSettings(m_project), + &ProjectSettings::suppressedDiagnosticsChanged, + this, &ClangStaticAnalyzerDiagnosticFilterModel::handleSuppressedDiagnosticsChanged); + handleSuppressedDiagnosticsChanged(); +} + +void ClangStaticAnalyzerDiagnosticFilterModel::addSuppressedDiagnostic( + const SuppressedDiagnostic &diag) +{ + QTC_ASSERT(!m_project, return); + m_suppressedDiagnostics << diag; + invalidate(); +} + +bool ClangStaticAnalyzerDiagnosticFilterModel::filterAcceptsRow(int sourceRow, + const QModelIndex &sourceParent) const +{ + Q_UNUSED(sourceParent); + const Diagnostic diag = static_cast(sourceModel()) + ->diagnostics().at(sourceRow); + foreach (const SuppressedDiagnostic &d, m_suppressedDiagnostics) { + if (d.description != diag.description) + continue; + QString filePath = d.filePath.toString(); + QFileInfo fi(filePath); + if (fi.isRelative()) + filePath = m_lastProjectDirectory.toString() + QLatin1Char('/') + filePath; + if (filePath == diag.location.filePath) + return false; + } + return true; +} + +void ClangStaticAnalyzerDiagnosticFilterModel::handleSuppressedDiagnosticsChanged() +{ + QTC_ASSERT(m_project, return); + m_suppressedDiagnostics + = ProjectSettingsManager::getSettings(m_project)->suppressedDiagnostics(); + invalidate(); +} + } // namespace Internal } // namespace ClangStaticAnalyzer diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.h b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.h index 68dcf7ed059..a2dc49c26c3 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.h @@ -20,8 +20,15 @@ #define CLANGSTATICANALYZERDIAGNOSTICMODEL_H #include "clangstaticanalyzerlogfilereader.h" +#include "clangstaticanalyzerprojectsettings.h" + +#include #include +#include +#include + +namespace ProjectExplorer { class Project; } namespace ClangStaticAnalyzer { namespace Internal { @@ -45,6 +52,26 @@ private: QList m_diagnostics; }; +class ClangStaticAnalyzerDiagnosticFilterModel : public QSortFilterProxyModel +{ + Q_OBJECT + +public: + ClangStaticAnalyzerDiagnosticFilterModel(QObject *parent = 0); + + void setProject(ProjectExplorer::Project *project); + void addSuppressedDiagnostic(const SuppressedDiagnostic &diag); + ProjectExplorer::Project *project() const { return m_project; } + +private: + bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const; + void handleSuppressedDiagnosticsChanged(); + + QPointer m_project; + Utils::FileName m_lastProjectDirectory; + SuppressedDiagnosticsList m_suppressedDiagnostics; +}; + } // namespace Internal } // namespace ClangStaticAnalyzer diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.cpp index 54c8ef5a537..f1805f2da20 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.cpp @@ -19,10 +19,15 @@ #include "clangstaticanalyzerdiagnosticview.h" #include "clangstaticanalyzerlogfilereader.h" +#include "clangstaticanalyzerdiagnosticmodel.h" +#include "clangstaticanalyzerprojectsettings.h" +#include "clangstaticanalyzerprojectsettingsmanager.h" #include "clangstaticanalyzerutils.h" +#include #include +#include #include #include #include @@ -196,13 +201,18 @@ DetailedErrorDelegate::SummaryLineInfo ClangStaticAnalyzerDiagnosticDelegate::su return info; } +Diagnostic ClangStaticAnalyzerDiagnosticDelegate::getDiagnostic(const QModelIndex &index) const +{ + return index.data(Qt::UserRole).value(); +} + QWidget *ClangStaticAnalyzerDiagnosticDelegate::createDetailsWidget(const QFont &font, const QModelIndex &index, QWidget *parent) const { QWidget *widget = new QWidget(parent); - const Diagnostic diagnostic = index.data(Qt::UserRole).value(); + const Diagnostic diagnostic = getDiagnostic(index); if (!diagnostic.isValid()) return widget; @@ -240,7 +250,7 @@ QString ClangStaticAnalyzerDiagnosticDelegate::textualRepresentation() const { QTC_ASSERT(m_detailsIndex.isValid(), return QString()); - const Diagnostic diagnostic = m_detailsIndex.data(Qt::UserRole).value(); + const Diagnostic diagnostic = getDiagnostic(m_detailsIndex); QTC_ASSERT(diagnostic.isValid(), return QString()); // Create summary @@ -268,6 +278,39 @@ ClangStaticAnalyzerDiagnosticView::ClangStaticAnalyzerDiagnosticView(QWidget *pa ClangStaticAnalyzerDiagnosticDelegate *delegate = new ClangStaticAnalyzerDiagnosticDelegate(this); setItemDelegate(delegate); + m_suppressAction = new QAction(tr("Suppress this diagnostic"), this); + connect(m_suppressAction, &QAction::triggered, [this](bool) { suppressCurrentDiagnostic(); }); +} + +void ClangStaticAnalyzerDiagnosticView::suppressCurrentDiagnostic() +{ + const QModelIndexList indexes = selectedIndexes(); + QTC_ASSERT(indexes.count() == 1, return); + const Diagnostic diag = static_cast(itemDelegate()) + ->getDiagnostic(indexes.first()); + QTC_ASSERT(diag.isValid(), return); + + // If the original project was closed, we work directly on the filter model, otherwise + // we go via the project settings. + auto * const filterModel = static_cast(model()); + ProjectExplorer::Project * const project = filterModel->project(); + if (project) { + Utils::FileName filePath = Utils::FileName::fromString(diag.location.filePath); + const Utils::FileName relativeFilePath + = filePath.relativeChildPath(project->projectDirectory()); + if (!relativeFilePath.isEmpty()) + filePath = relativeFilePath; + const SuppressedDiagnostic supDiag(filePath, diag.description, diag.issueContextKind, + diag.issueContext, diag.explainingSteps.count()); + ProjectSettingsManager::getSettings(project)->addSuppressedDiagnostic(supDiag); + } else { + filterModel->addSuppressedDiagnostic(SuppressedDiagnostic(diag)); + } +} + +QList ClangStaticAnalyzerDiagnosticView::customActions() const +{ + return QList() << m_suppressAction; } } // namespace Internal diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.h b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.h index ed6acae4f3b..4fbdc7f8668 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.h @@ -23,6 +23,7 @@ namespace ClangStaticAnalyzer { namespace Internal { +class Diagnostic; class ClangStaticAnalyzerDiagnosticView : public Analyzer::DetailedErrorView { @@ -30,6 +31,13 @@ class ClangStaticAnalyzerDiagnosticView : public Analyzer::DetailedErrorView public: ClangStaticAnalyzerDiagnosticView(QWidget *parent = 0); + +private: + void suppressCurrentDiagnostic(); + + QList customActions() const; + + QAction *m_suppressAction; }; class ClangStaticAnalyzerDiagnosticDelegate : public Analyzer::DetailedErrorDelegate @@ -38,6 +46,7 @@ public: ClangStaticAnalyzerDiagnosticDelegate(QListView *parent); SummaryLineInfo summaryInfo(const QModelIndex &index) const; + Diagnostic getDiagnostic(const QModelIndex &index) const; private: QWidget *createDetailsWidget(const QFont &font, const QModelIndex &index, diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp index 52673def09f..dced8b03d6c 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp @@ -19,6 +19,7 @@ #include "clangstaticanalyzerplugin.h" #include "clangstaticanalyzerconfigwidget.h" +#include "clangstaticanalyzerprojectsettingswidget.h" #include "clangstaticanalyzerruncontrolfactory.h" #include "clangstaticanalyzertool.h" @@ -35,6 +36,7 @@ #include #include #include +#include #include @@ -106,6 +108,12 @@ bool ClangStaticAnalyzerPlugin::initialize(const QStringList &arguments, QString // In the initialize method, a plugin can be sure that the plugins it // depends on have initialized their members. + auto panelFactory = new ProjectExplorer::ProjectPanelFactory(); + panelFactory->setPriority(100); + panelFactory->setDisplayName(tr("Clang Static Analyzer Settings")); + panelFactory->setSimpleCreateWidgetFunction(QIcon()); + ProjectExplorer::ProjectPanelFactory::registerFactory(panelFactory); + LicenseChecker::LicenseCheckerPlugin *licenseChecker = ExtensionSystem::PluginManager::getObject(); diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettings.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettings.cpp new file mode 100644 index 00000000000..7ee14816be9 --- /dev/null +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettings.cpp @@ -0,0 +1,137 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd +** 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. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. +** +** If you have questions regarding the use of this file, please use +** contact form at http://www.qt.io/contact-us +** +****************************************************************************/ +#include "clangstaticanalyzerprojectsettings.h" + +#include "clangstaticanalyzerdiagnostic.h" + +#include + +namespace ClangStaticAnalyzer { +namespace Internal { + +static QString suppressedDiagnosticsKey() +{ + return QLatin1String("ClangStaticAnalyzer.SuppressedDiagnostics"); +} + +static QString suppressedDiagnosticFilePathKey() +{ + return QLatin1String("ClangStaticAnalyzer.SuppressedDiagnosticFilePath"); +} + +static QString suppressedDiagnosticMessageKey() +{ + return QLatin1String("ClangStaticAnalyzer.SuppressedDiagnosticMessage"); +} + +static QString suppressedDiagnosticContextKindKey() +{ + return QLatin1String("ClangStaticAnalyzer.SuppressedDiagnosticContextKind"); +} + +static QString suppressedDiagnosticContextKey() +{ + return QLatin1String("ClangStaticAnalyzer.SuppressedDiagnosticContext"); +} + +static QString suppressedDiagnosticUniquifierKey() +{ + return QLatin1String("ClangStaticAnalyzer.SuppressedDiagnosticUniquifier"); +} + +ProjectSettings::ProjectSettings(ProjectExplorer::Project *project) : m_project(project) +{ + load(); + connect(project, &ProjectExplorer::Project::aboutToSaveSettings, this, + &ProjectSettings::store); +} + +void ProjectSettings::addSuppressedDiagnostic(const SuppressedDiagnostic &diag) +{ + QTC_ASSERT(!m_suppressedDiagnostics.contains(diag), return); + m_suppressedDiagnostics << diag; + emit suppressedDiagnosticsChanged(); +} + +void ProjectSettings::removeSuppressedDiagnostic(const SuppressedDiagnostic &diag) +{ + const bool wasPresent = m_suppressedDiagnostics.removeOne(diag); + QTC_ASSERT(wasPresent, return); + emit suppressedDiagnosticsChanged(); +} + +void ProjectSettings::removeAllSuppressedDiagnostics() +{ + m_suppressedDiagnostics.clear(); + emit suppressedDiagnosticsChanged(); +} + +void ProjectSettings::load() +{ + const QVariantList list = m_project->namedSettings(suppressedDiagnosticsKey()).toList(); + foreach (const QVariant &v, list) { + const QVariantMap diag = v.toMap(); + const QString fp = diag.value(suppressedDiagnosticFilePathKey()).toString(); + if (fp.isEmpty()) + continue; + const QString message = diag.value(suppressedDiagnosticMessageKey()).toString(); + if (message.isEmpty()) + continue; + Utils::FileName fullPath = Utils::FileName::fromString(fp); + if (fullPath.toFileInfo().isRelative()) { + fullPath = m_project->projectDirectory(); + fullPath.appendPath(fp); + } + if (!fullPath.exists()) + continue; + const QString contextKind = diag.value(suppressedDiagnosticContextKindKey()).toString(); + const QString context = diag.value(suppressedDiagnosticContextKey()).toString(); + const int uniquifier = diag.value(suppressedDiagnosticUniquifierKey()).toInt(); + m_suppressedDiagnostics << SuppressedDiagnostic(Utils::FileName::fromString(fp), message, + contextKind, context, uniquifier); + } + emit suppressedDiagnosticsChanged(); +} + +void ProjectSettings::store() +{ + QVariantList list; + foreach (const SuppressedDiagnostic &diag, m_suppressedDiagnostics) { + QVariantMap diagMap; + diagMap.insert(suppressedDiagnosticFilePathKey(), diag.filePath.toString()); + diagMap.insert(suppressedDiagnosticMessageKey(), diag.description); + diagMap.insert(suppressedDiagnosticContextKindKey(), diag.contextKind); + diagMap.insert(suppressedDiagnosticContextKey(), diag.context); + diagMap.insert(suppressedDiagnosticUniquifierKey(), diag.uniquifier); + list << diagMap; + } + m_project->setNamedSettings(suppressedDiagnosticsKey(), list); +} + + +SuppressedDiagnostic::SuppressedDiagnostic(const Diagnostic &diag) + : filePath(Utils::FileName::fromString(diag.location.filePath)) + , description(diag.description) + , contextKind(diag.issueContextKind) + , context(diag.issueContext) + , uniquifier(diag.explainingSteps.count()) +{ +} + +} // namespace Internal +} // namespace ClangStaticAnalyzer diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettings.h b/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettings.h new file mode 100644 index 00000000000..2a993de966d --- /dev/null +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettings.h @@ -0,0 +1,87 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd +** 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. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. +** +** If you have questions regarding the use of this file, please use +** contact form at http://www.qt.io/contact-us +** +****************************************************************************/ +#ifndef CLANGSTATICANALYZERPROJECTSETTINGS_H +#define CLANGSTATICANALYZERPROJECTSETTINGS_H + +#include +#include + +#include +#include + +namespace ClangStaticAnalyzer { +namespace Internal { +class Diagnostic; + +class SuppressedDiagnostic +{ +public: + SuppressedDiagnostic(const Utils::FileName &filePath, const QString &description, + const QString &contextKind, const QString &context, int uniquifier) + : filePath(filePath) + , description(description) + , contextKind(contextKind) + , context(context) + , uniquifier(uniquifier) + { + } + + SuppressedDiagnostic(const Diagnostic &diag); + + Utils::FileName filePath; // Relative for files in project, absolute otherwise. + QString description; + QString contextKind; + QString context; + int uniquifier; +}; + +inline bool operator==(const SuppressedDiagnostic &d1, const SuppressedDiagnostic &d2) +{ + return d1.filePath == d2.filePath && d1.description == d2.description + && d1.contextKind == d2.contextKind && d1.context == d2.context + && d1.uniquifier == d2.uniquifier; +} + +typedef QList SuppressedDiagnosticsList; + +class ProjectSettings : public QObject +{ + Q_OBJECT +public: + ProjectSettings(ProjectExplorer::Project *project); + + SuppressedDiagnosticsList suppressedDiagnostics() const { return m_suppressedDiagnostics; } + void addSuppressedDiagnostic(const SuppressedDiagnostic &diag); + void removeSuppressedDiagnostic(const SuppressedDiagnostic &diag); + void removeAllSuppressedDiagnostics(); + +signals: + void suppressedDiagnosticsChanged(); + +private: + void load(); + void store(); + + ProjectExplorer::Project * const m_project; + SuppressedDiagnosticsList m_suppressedDiagnostics; +}; + +} // namespace Internal +} // namespace ClangStaticAnalyzer + +#endif // Include guard. diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingsmanager.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingsmanager.cpp new file mode 100644 index 00000000000..8b1637bba1b --- /dev/null +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingsmanager.cpp @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd +** 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. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. +** +** If you have questions regarding the use of this file, please use +** contact form at http://www.qt.io/contact-us +** +****************************************************************************/ +#include "clangstaticanalyzerprojectsettingsmanager.h" + +#include "clangstaticanalyzerprojectsettings.h" + +#include + +namespace ClangStaticAnalyzer { +namespace Internal { + +ProjectSettingsManager::ProjectSettingsManager() +{ + QObject::connect(ProjectExplorer::SessionManager::instance(), + &ProjectExplorer::SessionManager::aboutToRemoveProject, + &ProjectSettingsManager::handleProjectToBeRemoved); +} + +ProjectSettings *ProjectSettingsManager::getSettings(ProjectExplorer::Project *project) +{ + auto &settings = m_settings[project]; + if (!settings) + settings.reset(new ProjectSettings(project)); + return settings.data(); +} + +void ProjectSettingsManager::handleProjectToBeRemoved(ProjectExplorer::Project *project) +{ + m_settings.remove(project); +} + +ProjectSettingsManager::SettingsMap ProjectSettingsManager::m_settings; + +} // namespace Internal +} // namespace ClangStaticAnalyzer diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingsmanager.h b/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingsmanager.h new file mode 100644 index 00000000000..97f8d79a99f --- /dev/null +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingsmanager.h @@ -0,0 +1,47 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd +** 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. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. +** +** If you have questions regarding the use of this file, please use +** contact form at http://www.qt.io/contact-us +** +****************************************************************************/ +#ifndef CLANGSTATICANALYZERPROJECTSETTINGSMANAGER_H +#define CLANGSTATICANALYZERPROJECTSETTINGSMANAGER_H + +namespace ProjectExplorer { class Project; } + +#include +#include + +namespace ClangStaticAnalyzer { +namespace Internal { +class ProjectSettings; + +class ProjectSettingsManager +{ +public: + ProjectSettingsManager(); + + static ProjectSettings *getSettings(ProjectExplorer::Project *project); + +private: + static void handleProjectToBeRemoved(ProjectExplorer::Project *project); + + typedef QHash> SettingsMap; + static SettingsMap m_settings; +}; + +} // namespace Internal +} // namespace ClangStaticAnalyzer + +#endif // Include guard. diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingswidget.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingswidget.cpp new file mode 100644 index 00000000000..580e6f750d4 --- /dev/null +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingswidget.cpp @@ -0,0 +1,160 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd +** 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. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. +** +** If you have questions regarding the use of this file, please use +** contact form at http://www.qt.io/contact-us +** +****************************************************************************/ +#include "clangstaticanalyzerprojectsettingswidget.h" +#include "ui_clangstaticanalyzerprojectsettingswidget.h" + +#include "clangstaticanalyzerprojectsettings.h" +#include "clangstaticanalyzerprojectsettingsmanager.h" + +#include + +#include + +namespace ClangStaticAnalyzer { +namespace Internal { + +class SuppressedDiagnosticsModel : public QAbstractTableModel +{ + Q_OBJECT +public: + SuppressedDiagnosticsModel(QObject *parent = 0) : QAbstractTableModel(parent) { } + + void setDiagnostics(const SuppressedDiagnosticsList &diagnostics); + SuppressedDiagnostic diagnosticAt(int i) const; + +private: + enum Columns { ColumnFile, ColumnContext, ColumnDescription, ColumnLast = ColumnDescription }; + + int rowCount(const QModelIndex &parent = QModelIndex()) const; + int columnCount(const QModelIndex & = QModelIndex()) const { return ColumnLast + 1; } + QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; + + SuppressedDiagnosticsList m_diagnostics; +}; + +ProjectSettingsWidget::ProjectSettingsWidget(ProjectExplorer::Project *project, QWidget *parent) : + QWidget(parent), + m_ui(new Ui::ProjectSettingsWidget) + , m_projectSettings(ProjectSettingsManager::getSettings(project)) +{ + m_ui->setupUi(this); + auto * const model = new SuppressedDiagnosticsModel(this); + model->setDiagnostics(m_projectSettings->suppressedDiagnostics()); + connect(m_projectSettings, &ProjectSettings::suppressedDiagnosticsChanged, + [model, this] { + model->setDiagnostics(m_projectSettings->suppressedDiagnostics()); + updateButtonStates(); + }); + m_ui->diagnosticsView->setModel(model); + updateButtonStates(); + connect(m_ui->diagnosticsView->selectionModel(), &QItemSelectionModel::selectionChanged, + [this](const QItemSelection &, const QItemSelection &) { + updateButtonStateRemoveSelected(); + }); + connect(m_ui->removeSelectedButton, &QAbstractButton::clicked, + [this](bool) { removeSelected(); }); + connect(m_ui->removeAllButton, &QAbstractButton::clicked, + [this](bool) { m_projectSettings->removeAllSuppressedDiagnostics();}); +} + +ProjectSettingsWidget::~ProjectSettingsWidget() +{ + delete m_ui; +} + +void ProjectSettingsWidget::updateButtonStates() +{ + updateButtonStateRemoveSelected(); + updateButtonStateRemoveAll(); +} + +void ProjectSettingsWidget::updateButtonStateRemoveSelected() +{ + const auto selectedRows = m_ui->diagnosticsView->selectionModel()->selectedRows(); + QTC_ASSERT(selectedRows.count() <= 1, return); + m_ui->removeSelectedButton->setEnabled(!selectedRows.isEmpty()); +} + +void ProjectSettingsWidget::updateButtonStateRemoveAll() +{ + m_ui->removeAllButton->setEnabled(m_ui->diagnosticsView->model()->rowCount() > 0); +} + +void ProjectSettingsWidget::removeSelected() +{ + const auto selectedRows = m_ui->diagnosticsView->selectionModel()->selectedRows(); + QTC_ASSERT(selectedRows.count() == 1, return); + const auto * const model + = static_cast(m_ui->diagnosticsView->model()); + m_projectSettings->removeSuppressedDiagnostic(model->diagnosticAt(selectedRows.first().row())); +} + + +void SuppressedDiagnosticsModel::setDiagnostics(const SuppressedDiagnosticsList &diagnostics) +{ + beginResetModel(); + m_diagnostics = diagnostics; + endResetModel(); +} + +SuppressedDiagnostic SuppressedDiagnosticsModel::diagnosticAt(int i) const +{ + return m_diagnostics.at(i); +} + +int SuppressedDiagnosticsModel::rowCount(const QModelIndex &parent) const +{ + return parent.isValid() ? 0 : m_diagnostics.count(); +} + +QVariant SuppressedDiagnosticsModel::headerData(int section, Qt::Orientation orientation, + int role) const +{ + if (role == Qt::DisplayRole && orientation == Qt::Horizontal) { + if (section == ColumnFile) + return tr("File"); + if (section == ColumnContext) + return tr("Context"); + if (section == ColumnDescription) + return tr("Diagnostic"); + } + return QVariant(); +} + +QVariant SuppressedDiagnosticsModel::data(const QModelIndex &index, int role) const +{ + if (!index.isValid() || role != Qt::DisplayRole || index.row() >= rowCount()) + return QVariant(); + const SuppressedDiagnostic &diag = m_diagnostics.at(index.row()); + if (index.column() == ColumnFile) + return diag.filePath.toUserOutput(); + if (index.column() == ColumnContext) { + if (diag.contextKind == QLatin1String("function") && !diag.context.isEmpty()) + return tr("Function \"%1\"").arg(diag.context); + return QString(); + } + if (index.column() == ColumnDescription) + return diag.description; + return QVariant(); +} + +} // namespace Internal +} // namespace ClangStaticAnalyzer + +#include "clangstaticanalyzerprojectsettingswidget.moc" diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingswidget.h b/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingswidget.h new file mode 100644 index 00000000000..66699197369 --- /dev/null +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingswidget.h @@ -0,0 +1,52 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd +** 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. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. +** +** If you have questions regarding the use of this file, please use +** contact form at http://www.qt.io/contact-us +** +****************************************************************************/ +#ifndef CLANGSTATICANALYZERPROJECTSETTINGSWIDGET_H +#define CLANGSTATICANALYZERPROJECTSETTINGSWIDGET_H + +#include + +namespace ProjectExplorer { class Project; } + +namespace ClangStaticAnalyzer { +namespace Internal { +class ProjectSettings; + +namespace Ui { class ProjectSettingsWidget; } + +class ProjectSettingsWidget : public QWidget +{ + Q_OBJECT + +public: + explicit ProjectSettingsWidget(ProjectExplorer::Project *project, QWidget *parent = 0); + ~ProjectSettingsWidget(); + +private: + void updateButtonStates(); + void updateButtonStateRemoveSelected(); + void updateButtonStateRemoveAll(); + void removeSelected(); + + Ui::ProjectSettingsWidget * const m_ui; + ProjectSettings * const m_projectSettings; +}; + +} // namespace Internal +} // namespace ClangStaticAnalyzer + +#endif // Include guard. diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingswidget.ui b/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingswidget.ui new file mode 100644 index 00000000000..c131bbe0c22 --- /dev/null +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingswidget.ui @@ -0,0 +1,87 @@ + + + ClangStaticAnalyzer::Internal::ProjectSettingsWidget + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + + + + Suppressed Diagnostics: + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + QAbstractItemView::SingleSelection + + + + + + + + + Remove Selected + + + + + + + Remove All + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp index 260aae865a9..645186cc714 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp @@ -51,6 +51,7 @@ namespace Internal { ClangStaticAnalyzerTool::ClangStaticAnalyzerTool(QObject *parent) : QObject(parent) , m_diagnosticModel(0) + , m_diagnosticFilterModel(0) , m_diagnosticView(0) , m_goBack(0) , m_goNext(0) @@ -74,10 +75,9 @@ QWidget *ClangStaticAnalyzerTool::createWidgets() m_diagnosticView->setFrameStyle(QFrame::NoFrame); m_diagnosticView->setAttribute(Qt::WA_MacShowFocusRect, false); m_diagnosticModel = new ClangStaticAnalyzerDiagnosticModel(m_diagnosticView); - // TODO: Make use of the proxy model - QSortFilterProxyModel *proxyModel = new QSortFilterProxyModel(m_diagnosticView); - proxyModel->setSourceModel(m_diagnosticModel); - m_diagnosticView->setModel(proxyModel); + m_diagnosticFilterModel = new ClangStaticAnalyzerDiagnosticFilterModel(m_diagnosticView); + m_diagnosticFilterModel->setSourceModel(m_diagnosticModel); + m_diagnosticView->setModel(m_diagnosticFilterModel); m_diagnosticView->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); m_diagnosticView->setAutoScroll(false); m_diagnosticView->setObjectName(QLatin1String("ClangStaticAnalyzerIssuesView")); @@ -203,6 +203,7 @@ void ClangStaticAnalyzerTool::startTool() setBusyCursor(true); Project *project = SessionManager::startupProject(); QTC_ASSERT(project, return); + m_diagnosticFilterModel->setProject(project); m_projectInfoBeforeBuild = CppTools::CppModelManager::instance()->projectInfo(project); QTC_ASSERT(m_projectInfoBeforeBuild.isValid(), return); m_running = true; @@ -241,15 +242,18 @@ void ClangStaticAnalyzerTool::onEngineFinished() QTC_ASSERT(m_goBack, return); QTC_ASSERT(m_goNext, return); QTC_ASSERT(m_diagnosticModel, return); + QTC_ASSERT(m_diagnosticFilterModel, return); resetCursorAndProjectInfoBeforeBuild(); const int issuesFound = m_diagnosticModel->rowCount(); - m_goBack->setEnabled(issuesFound > 1); - m_goNext->setEnabled(issuesFound > 1); + const int issuesVisible = m_diagnosticFilterModel->rowCount(); + m_goBack->setEnabled(issuesVisible > 1); + m_goNext->setEnabled(issuesVisible > 1); AnalyzerManager::showPermanentStatusMessage(issuesFound > 0 - ? AnalyzerManager::tr("Clang Static Analyzer finished, %n issues were found.", 0, issuesFound) + ? AnalyzerManager::tr("Clang Static Analyzer finished, %n issues were found (%1 suppressed).", + 0, issuesFound).arg(issuesFound - issuesVisible) : AnalyzerManager::tr("Clang Static Analyzer finished, no issues were found.")); m_running = false; emit finished(); diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzertool.h b/plugins/clangstaticanalyzer/clangstaticanalyzertool.h index fa402a608ec..89c8851acc4 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzertool.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzertool.h @@ -27,6 +27,7 @@ namespace Analyzer { class DetailedErrorView; } namespace ClangStaticAnalyzer { namespace Internal { +class ClangStaticAnalyzerDiagnosticFilterModel; class ClangStaticAnalyzerDiagnosticModel; class ClangStaticAnalyzerDiagnosticView; class Diagnostic; @@ -65,6 +66,7 @@ private: CppTools::ProjectInfo m_projectInfoBeforeBuild; ClangStaticAnalyzerDiagnosticModel *m_diagnosticModel; + ClangStaticAnalyzerDiagnosticFilterModel *m_diagnosticFilterModel; Analyzer::DetailedErrorView *m_diagnosticView; QAction *m_goBack; From f12e53e83cb3e1e04bc6eb2ec9e8ad24c28f00d5 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Thu, 26 Feb 2015 16:24:53 +0100 Subject: [PATCH 057/111] Make use of the "issues" pane when errors occur during analyzing. They can otherwise easily get lost in the Application output pane. Policy is as follows: - Failure to analyze a specific file is considered a warning. - If no file could be successfully analyzed, we add an error and pop up the issues pane. This approach is neither too noisy nor too quiet. Change-Id: Ifc577a215006a6a565eee7de5099bd690427f7de Reviewed-by: Nikolai Kosjar --- .../clangstaticanalyzerruncontrol.cpp | 30 +++++++++++++++---- 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp index 15deb7b9cea..e0576299e46 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp @@ -23,6 +23,7 @@ #include "clangstaticanalyzersettings.h" #include "clangstaticanalyzerutils.h" +#include #include #include @@ -37,6 +38,7 @@ #include #include #include +#include #include @@ -51,6 +53,14 @@ static Q_LOGGING_CATEGORY(LOG, "qtc.clangstaticanalyzer.runcontrol") namespace ClangStaticAnalyzer { namespace Internal { +static void logToIssuesPane(Task::TaskType type, const QString &message) +{ + TaskHub::addTask(type, message, Analyzer::Constants::ANALYZERTASK_ID); + if (type == Task::Error) + TaskHub::requestPopup(); +} + + ClangStaticAnalyzerRunControl::ClangStaticAnalyzerRunControl( const Analyzer::AnalyzerStartParameters &startParams, ProjectExplorer::RunConfiguration *runConfiguration, @@ -191,9 +201,10 @@ bool ClangStaticAnalyzerRunControl::startEngine() const QString executable = clangExecutableFromSettings(m_toolchainType, &isValidClangExecutable); if (!isValidClangExecutable) { - emit appendMessage(tr("Clang Static Analyzer: Invalid executable \"%1\", stop.") - .arg(executable) + QLatin1Char('\n'), - Utils::ErrorMessageFormat); + const QString errorMessage = tr("Clang Static Analyzer: Invalid executable \"%1\", stop.") + .arg(executable); + appendMessage(errorMessage + QLatin1Char('\n'), Utils::ErrorMessageFormat); + logToIssuesPane(Task::Error, errorMessage); emit finished(); return false; } @@ -203,8 +214,10 @@ bool ClangStaticAnalyzerRunControl::startEngine() QTemporaryDir temporaryDir(QDir::tempPath() + QLatin1String("/qtc-clangstaticanalyzer-XXXXXX")); temporaryDir.setAutoRemove(false); if (!temporaryDir.isValid()) { - emit appendMessage(tr("Clang Static Analyzer: Failed to create temporary dir, stop.") - + QLatin1Char('\n'), Utils::ErrorMessageFormat); + const QString errorMessage + = tr("Clang Static Analyzer: Failed to create temporary dir, stop."); + appendMessage(errorMessage + QLatin1Char('\n'), Utils::ErrorMessageFormat); + logToIssuesPane(Task::Error, errorMessage); emit finished(); return false; } @@ -273,6 +286,10 @@ void ClangStaticAnalyzerRunControl::analyzeNextFile() .arg(m_filesNotAnalyzed) + QLatin1Char('\n'), Utils::NormalMessageFormat); + if (m_filesAnalyzed == 0 && m_filesNotAnalyzed != 0) { + logToIssuesPane(Task::Error, + tr("Clang Static Analyzer: Failed to analyze any files.")); + } m_progress.reportFinished(); emit finished(); } @@ -336,7 +353,8 @@ void ClangStaticAnalyzerRunControl::onRunnerFinishedWithFailure(const QString &e + QLatin1Char('\n') , Utils::StdErrFormat); appendMessage(errorDetails, Utils::StdErrFormat); - + logToIssuesPane(Task::Warning, errorMessage); + logToIssuesPane(Task::Warning, errorDetails); handleFinished(); } From 6e2f8a83d1c72d12e91ed871899612093f9fd2c7 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Mon, 2 Mar 2015 15:52:44 +0100 Subject: [PATCH 058/111] Remove experimental state Change-Id: I8b66e228dff39db37b66270fec39ca526b6373a0 Reviewed-by: Christian Kandeler --- plugins/clangstaticanalyzer/ClangStaticAnalyzer.json.in | 1 - 1 file changed, 1 deletion(-) diff --git a/plugins/clangstaticanalyzer/ClangStaticAnalyzer.json.in b/plugins/clangstaticanalyzer/ClangStaticAnalyzer.json.in index 081dc1eef65..fc86ed513b3 100644 --- a/plugins/clangstaticanalyzer/ClangStaticAnalyzer.json.in +++ b/plugins/clangstaticanalyzer/ClangStaticAnalyzer.json.in @@ -2,7 +2,6 @@ \"Name\" : \"ClangStaticAnalyzer\", \"Version\" : \"$$QTCREATOR_VERSION\", \"CompatVersion\" : \"$$QTCREATOR_COMPAT_VERSION\", - \"Experimental\" : true, \"Vendor\" : \"The Qt Company Ltd\", \"Copyright\" : \"(C) 2015 The Qt Company Ltd\", \"License\" : [ \"Commercial Usage\", From d2fa3e9902c31db2fc72e20c1641c29cc512013d Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Mon, 2 Mar 2015 15:51:28 +0100 Subject: [PATCH 059/111] Add changes-3.4.0 Change-Id: Idfd70d71a3290f4c3e9968f2882e7a671f8995d8 Reviewed-by: Christian Kandeler Reviewed-by: Riitta-Leena Miettinen --- dist/changes-3.4.0 | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 dist/changes-3.4.0 diff --git a/dist/changes-3.4.0 b/dist/changes-3.4.0 new file mode 100644 index 00000000000..894f4b0fea8 --- /dev/null +++ b/dist/changes-3.4.0 @@ -0,0 +1,7 @@ +Clang Static Analyzer 3.4.0 + +* Removed experimental state +* Added support for MSVC (requires Clang 3.6 or later) +* Added support for MinGW +* Added support for suppressing diagnostics + (added tool button in diagnostics view, and option pane in Projects mode) From 3ba48ca11e16949ff84dd7289084e2f7b3327d5b Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Tue, 3 Mar 2015 11:08:26 +0100 Subject: [PATCH 060/111] Remove now-unneeded PathChooser subclass. Change-Id: Ic7cbe4566159675ae9e776d723ed213c1e7c71ec Reviewed-by: Andre Poenitz --- .../clangstaticanalyzer.pro | 2 - .../clangstaticanalyzer.qbs | 2 - .../clangstaticanalyzerconfigwidget.cpp | 12 +++++- .../clangstaticanalyzerconfigwidget.ui | 6 +-- .../clangstaticanalyzerpathchooser.cpp | 40 ------------------- .../clangstaticanalyzerpathchooser.h | 40 ------------------- 6 files changed, 14 insertions(+), 88 deletions(-) delete mode 100644 plugins/clangstaticanalyzer/clangstaticanalyzerpathchooser.cpp delete mode 100644 plugins/clangstaticanalyzer/clangstaticanalyzerpathchooser.h diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzer.pro b/plugins/clangstaticanalyzer/clangstaticanalyzer.pro index 67eb90ad415..cdffb1f1d1c 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzer.pro +++ b/plugins/clangstaticanalyzer/clangstaticanalyzer.pro @@ -10,7 +10,6 @@ SOURCES += \ clangstaticanalyzerdiagnosticmodel.cpp \ clangstaticanalyzerdiagnosticview.cpp \ clangstaticanalyzerlogfilereader.cpp \ - clangstaticanalyzerpathchooser.cpp \ clangstaticanalyzerplugin.cpp \ clangstaticanalyzerprojectsettings.cpp \ clangstaticanalyzerprojectsettingsmanager.cpp \ @@ -30,7 +29,6 @@ HEADERS += \ clangstaticanalyzerdiagnosticview.h \ clangstaticanalyzer_global.h \ clangstaticanalyzerlogfilereader.h \ - clangstaticanalyzerpathchooser.h \ clangstaticanalyzerplugin.h \ clangstaticanalyzerprojectsettings.h \ clangstaticanalyzerprojectsettingsmanager.h \ diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzer.qbs b/plugins/clangstaticanalyzer/clangstaticanalyzer.qbs index a97dc9f83c7..b430b980daf 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzer.qbs +++ b/plugins/clangstaticanalyzer/clangstaticanalyzer.qbs @@ -28,8 +28,6 @@ QtcPlugin { "clangstaticanalyzerdiagnosticview.h", "clangstaticanalyzerlogfilereader.cpp", "clangstaticanalyzerlogfilereader.h", - "clangstaticanalyzerpathchooser.cpp", - "clangstaticanalyzerpathchooser.h", "clangstaticanalyzerplugin.cpp", "clangstaticanalyzerplugin.h", "clangstaticanalyzerprojectsettings.cpp", diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.cpp index 6b8b0f0cee2..f61a82bd5a1 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.cpp @@ -19,6 +19,8 @@ #include "clangstaticanalyzerconfigwidget.h" #include "ui_clangstaticanalyzerconfigwidget.h" +#include "clangstaticanalyzerutils.h" + #include namespace ClangStaticAnalyzer { @@ -33,7 +35,15 @@ ClangStaticAnalyzerConfigWidget::ClangStaticAnalyzerConfigWidget( { m_ui->setupUi(this); - m_ui->clangExecutableChooser->setPath(settings->clangExecutable()); + Utils::PathChooser * const chooser = m_ui->clangExecutableChooser; + chooser->setExpectedKind(Utils::PathChooser::ExistingCommand); + chooser->setHistoryCompleter(QLatin1String("ClangStaticAnalyzer.ClangCommand.History")); + chooser->setPromptDialogTitle(tr("Clang Command")); + chooser->setPath(settings->clangExecutable()); + const auto validator = [chooser](const QString &, QString *errorMessage) { + return isClangExecutableUsable(chooser->fileName().toString(), errorMessage); + }; + chooser->setAdditionalPathValidator(validator); connect(m_ui->clangExecutableChooser, &Utils::PathChooser::changed, m_settings, &ClangStaticAnalyzerSettings::setClangExecutable); diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.ui b/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.ui index 8997f3a7d11..800733a3317 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.ui +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.ui @@ -30,7 +30,7 @@ - + @@ -88,9 +88,9 @@ - ClangStaticAnalyzer::Internal::PathChooser + Utils::PathChooser QWidget -
clangstaticanalyzer/clangstaticanalyzerpathchooser.h
+
utils/pathchooser.h
1
diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerpathchooser.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerpathchooser.cpp deleted file mode 100644 index b5711bfeab4..00000000000 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerpathchooser.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd -** 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. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. -** -** If you have questions regarding the use of this file, please use -** contact form at http://www.qt.io/contact-us -** -****************************************************************************/ -#include "clangstaticanalyzerpathchooser.h" - -#include "clangstaticanalyzerutils.h" - -namespace ClangStaticAnalyzer { -namespace Internal { - -PathChooser::PathChooser(QWidget *parent) : Utils::PathChooser(parent) -{ - setExpectedKind(Utils::PathChooser::ExistingCommand); - setHistoryCompleter(QLatin1String("ClangStaticAnalyzer.ClangCommand.History")); - setPromptDialogTitle(tr("Clang Command")); -} - -bool PathChooser::validatePath(const QString &path, QString *errorMessage) -{ - if (!Utils::PathChooser::validatePath(path, errorMessage)) - return false; - return isClangExecutableUsable(fileName().toString(), errorMessage); -} - -} // namespace Internal -} // namespace ClangStaticAnalyzer diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerpathchooser.h b/plugins/clangstaticanalyzer/clangstaticanalyzerpathchooser.h deleted file mode 100644 index b4bc3c59476..00000000000 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerpathchooser.h +++ /dev/null @@ -1,40 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd -** 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. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. -** -** If you have questions regarding the use of this file, please use -** contact form at http://www.qt.io/contact-us -** -****************************************************************************/ -#ifndef QTC_CLANGSTATICANALYZER_PATHCHOOSER_H -#define QTC_CLANGSTATICANALYZER_PATHCHOOSER_H - -#include - -namespace ClangStaticAnalyzer { -namespace Internal { - -class PathChooser : public Utils::PathChooser -{ - Q_OBJECT - -public: - PathChooser(QWidget *parent = 0); - -private: - bool validatePath(const QString &path, QString *errorMessage = 0); -}; - -} // namespace Internal -} // namespace ClangStaticAnalyzer - -#endif // Include guard. From 5b1a7f37560d24821e9bea705aaba26f71b604ab Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Wed, 4 Mar 2015 17:33:06 +0100 Subject: [PATCH 061/111] Use new AnalyzerUtils::logToIssuesPane(). Change-Id: I9820a81f67c06b7bb54720772467263bfa9fc8f3 Reviewed-by: Andre Poenitz --- .../clangstaticanalyzerruncontrol.cpp | 22 ++++++------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp index e0576299e46..c99060d13c2 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp @@ -23,8 +23,8 @@ #include "clangstaticanalyzersettings.h" #include "clangstaticanalyzerutils.h" -#include #include +#include #include @@ -53,14 +53,6 @@ static Q_LOGGING_CATEGORY(LOG, "qtc.clangstaticanalyzer.runcontrol") namespace ClangStaticAnalyzer { namespace Internal { -static void logToIssuesPane(Task::TaskType type, const QString &message) -{ - TaskHub::addTask(type, message, Analyzer::Constants::ANALYZERTASK_ID); - if (type == Task::Error) - TaskHub::requestPopup(); -} - - ClangStaticAnalyzerRunControl::ClangStaticAnalyzerRunControl( const Analyzer::AnalyzerStartParameters &startParams, ProjectExplorer::RunConfiguration *runConfiguration, @@ -204,7 +196,7 @@ bool ClangStaticAnalyzerRunControl::startEngine() const QString errorMessage = tr("Clang Static Analyzer: Invalid executable \"%1\", stop.") .arg(executable); appendMessage(errorMessage + QLatin1Char('\n'), Utils::ErrorMessageFormat); - logToIssuesPane(Task::Error, errorMessage); + AnalyzerUtils::logToIssuesPane(Task::Error, errorMessage); emit finished(); return false; } @@ -217,7 +209,7 @@ bool ClangStaticAnalyzerRunControl::startEngine() const QString errorMessage = tr("Clang Static Analyzer: Failed to create temporary dir, stop."); appendMessage(errorMessage + QLatin1Char('\n'), Utils::ErrorMessageFormat); - logToIssuesPane(Task::Error, errorMessage); + AnalyzerUtils::logToIssuesPane(Task::Error, errorMessage); emit finished(); return false; } @@ -287,8 +279,8 @@ void ClangStaticAnalyzerRunControl::analyzeNextFile() + QLatin1Char('\n'), Utils::NormalMessageFormat); if (m_filesAnalyzed == 0 && m_filesNotAnalyzed != 0) { - logToIssuesPane(Task::Error, - tr("Clang Static Analyzer: Failed to analyze any files.")); + AnalyzerUtils::logToIssuesPane(Task::Error, + tr("Clang Static Analyzer: Failed to analyze any files.")); } m_progress.reportFinished(); emit finished(); @@ -353,8 +345,8 @@ void ClangStaticAnalyzerRunControl::onRunnerFinishedWithFailure(const QString &e + QLatin1Char('\n') , Utils::StdErrFormat); appendMessage(errorDetails, Utils::StdErrFormat); - logToIssuesPane(Task::Warning, errorMessage); - logToIssuesPane(Task::Warning, errorDetails); + AnalyzerUtils::logToIssuesPane(Task::Warning, errorMessage); + AnalyzerUtils::logToIssuesPane(Task::Warning, errorDetails); handleFinished(); } From 26abab90ca8cf599421636b2292e801cba9759a1 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Mon, 2 Mar 2015 15:35:10 +0100 Subject: [PATCH 062/111] Show the status message also while running. So users can see how many issues were found before the analyzer has finished, as well as browse them. Change-Id: I82452441168ecb370e7b2aac137961ebb5b8bfc3 Reviewed-by: Nikolai Kosjar --- .../clangstaticanalyzertool.cpp | 53 +++++++++++++------ .../clangstaticanalyzertool.h | 1 + 2 files changed, 38 insertions(+), 16 deletions(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp index 645186cc714..37447c5f664 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp @@ -82,6 +82,17 @@ QWidget *ClangStaticAnalyzerTool::createWidgets() m_diagnosticView->setAutoScroll(false); m_diagnosticView->setObjectName(QLatin1String("ClangStaticAnalyzerIssuesView")); m_diagnosticView->setWindowTitle(tr("Clang Static Analyzer Issues")); + foreach (auto * const model, + QList() << m_diagnosticModel << m_diagnosticFilterModel) { + connect(model, &QAbstractItemModel::rowsInserted, + this, &ClangStaticAnalyzerTool::handleStateUpdate); + connect(model, &QAbstractItemModel::rowsRemoved, + this, &ClangStaticAnalyzerTool::handleStateUpdate); + connect(model, &QAbstractItemModel::modelReset, + this, &ClangStaticAnalyzerTool::handleStateUpdate); + connect(model, &QAbstractItemModel::layoutChanged, // For QSortFilterProxyModel::invalidate() + this, &ClangStaticAnalyzerTool::handleStateUpdate); + } QDockWidget *issuesDock = AnalyzerManager::createDockWidget(ClangStaticAnalyzerToolId, m_diagnosticView); @@ -198,7 +209,6 @@ void ClangStaticAnalyzerTool::startTool() if (dontStartAfterHintForDebugMode()) return; - AnalyzerManager::showPermanentStatusMessage(QString()); m_diagnosticModel->clear(); setBusyCursor(true); Project *project = SessionManager::startupProject(); @@ -207,6 +217,7 @@ void ClangStaticAnalyzerTool::startTool() m_projectInfoBeforeBuild = CppTools::CppModelManager::instance()->projectInfo(project); QTC_ASSERT(m_projectInfoBeforeBuild.isValid(), return); m_running = true; + handleStateUpdate(); ProjectExplorerPlugin::runProject(project, ProjectExplorer::ClangStaticAnalyzerMode); } @@ -239,23 +250,9 @@ void ClangStaticAnalyzerTool::onNewDiagnosticsAvailable(const QList void ClangStaticAnalyzerTool::onEngineFinished() { - QTC_ASSERT(m_goBack, return); - QTC_ASSERT(m_goNext, return); - QTC_ASSERT(m_diagnosticModel, return); - QTC_ASSERT(m_diagnosticFilterModel, return); - resetCursorAndProjectInfoBeforeBuild(); - - const int issuesFound = m_diagnosticModel->rowCount(); - const int issuesVisible = m_diagnosticFilterModel->rowCount(); - m_goBack->setEnabled(issuesVisible > 1); - m_goNext->setEnabled(issuesVisible > 1); - - AnalyzerManager::showPermanentStatusMessage(issuesFound > 0 - ? AnalyzerManager::tr("Clang Static Analyzer finished, %n issues were found (%1 suppressed).", - 0, issuesFound).arg(issuesFound - issuesVisible) - : AnalyzerManager::tr("Clang Static Analyzer finished, no issues were found.")); m_running = false; + handleStateUpdate(); emit finished(); } @@ -266,5 +263,29 @@ void ClangStaticAnalyzerTool::setBusyCursor(bool busy) m_diagnosticView->setCursor(cursor); } +void ClangStaticAnalyzerTool::handleStateUpdate() +{ + QTC_ASSERT(m_goBack, return); + QTC_ASSERT(m_goNext, return); + QTC_ASSERT(m_diagnosticModel, return); + QTC_ASSERT(m_diagnosticFilterModel, return); + + const int issuesFound = m_diagnosticModel->rowCount(); + const int issuesVisible = m_diagnosticFilterModel->rowCount(); + m_goBack->setEnabled(issuesVisible > 1); + m_goNext->setEnabled(issuesVisible > 1); + + QString message = m_running ? tr("Clang Static Analyzer running.") + : tr("Clang Static Analyzer finished."); + message += QLatin1Char(' '); + if (issuesFound == 0) { + message += tr("No issues found."); + } else { + message += tr("%n issues found (%1 suppressed).", 0, issuesFound) + .arg(issuesFound - issuesVisible); + } + AnalyzerManager::showPermanentStatusMessage(message); +} + } // namespace Internal } // namespace ClangStaticAnalyzer diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzertool.h b/plugins/clangstaticanalyzer/clangstaticanalyzertool.h index 89c8851acc4..2f9b18efa7b 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzertool.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzertool.h @@ -61,6 +61,7 @@ private: void onEngineFinished(); void setBusyCursor(bool busy); + void handleStateUpdate(); private: CppTools::ProjectInfo m_projectInfoBeforeBuild; From 10acf6af840153b5b69e9dc32fa9ad671d8f8290 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Tue, 3 Mar 2015 15:09:27 +0100 Subject: [PATCH 063/111] Create a dummy run configuration to create our run control from. The Clang Static Analyzer differs from other analyzers in that it does not run a binary produced by the build process, but looks at source files instead. It is therefore completely unrelated to any run configurations that may or may not exist for the project. This has been ignored so far, with these two main consequences: - When running the analyzer, the name of some random run configuration appears in the application output pane, which makes it look to the user as if the corresponding executable has been run, which it has not. - For projects without run configurations (e.g. libraries), analyzing does not work out of the box, which makes no sense conceptually. So we now create our own run special run configuration (not visible in the UI) and run it directly via runRunConfiguration() instead of using the currently active run configuration via runProject(). This fixes both issues listed above. Change-Id: Icc839816f4a1e6f02a0eb2328c536b44f7304807 Reviewed-by: Nikolai Kosjar --- .../clangstaticanalyzertool.cpp | 35 ++++++++++++++++++- .../clangstaticanalyzertool.h | 5 +++ 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp index 37447c5f664..4e98a28ddd7 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp @@ -48,6 +48,22 @@ using namespace ProjectExplorer; namespace ClangStaticAnalyzer { namespace Internal { +class DummyRunConfiguration : public RunConfiguration +{ + Q_OBJECT + +public: + DummyRunConfiguration(Target *parent) + : RunConfiguration(parent, "ClangStaticAnalyzer.DummyRunConfig") + { + setDefaultDisplayName(tr("Clang Static Analyzer")); + addExtraAspects(); + } + +private: + QWidget *createConfigurationWidget() { return 0; } +}; + ClangStaticAnalyzerTool::ClangStaticAnalyzerTool(QObject *parent) : QObject(parent) , m_diagnosticModel(0) @@ -218,7 +234,22 @@ void ClangStaticAnalyzerTool::startTool() QTC_ASSERT(m_projectInfoBeforeBuild.isValid(), return); m_running = true; handleStateUpdate(); - ProjectExplorerPlugin::runProject(project, ProjectExplorer::ClangStaticAnalyzerMode); + + Target * const target = project->activeTarget(); + QTC_ASSERT(target, return); + DummyRunConfiguration *& rc = m_runConfigs[target]; + if (!rc) { + rc = new DummyRunConfiguration(target); + connect(project, &Project::aboutToRemoveTarget, this, + [this](Target *t) { m_runConfigs.remove(t); }); + const auto onProjectRemoved = [this](Project *p) { + foreach (Target * const t, p->targets()) + m_runConfigs.remove(t); + }; + connect(SessionManager::instance(), &SessionManager::aboutToRemoveProject, this, + onProjectRemoved, Qt::UniqueConnection); + } + ProjectExplorerPlugin::runRunConfiguration(rc, ProjectExplorer::ClangStaticAnalyzerMode); } CppTools::ProjectInfo ClangStaticAnalyzerTool::projectInfoBeforeBuild() const @@ -289,3 +320,5 @@ void ClangStaticAnalyzerTool::handleStateUpdate() } // namespace Internal } // namespace ClangStaticAnalyzer + +#include "clangstaticanalyzertool.moc" diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzertool.h b/plugins/clangstaticanalyzer/clangstaticanalyzertool.h index 2f9b18efa7b..4334884c7e7 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzertool.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzertool.h @@ -22,7 +22,10 @@ #include #include +#include + namespace Analyzer { class DetailedErrorView; } +namespace ProjectExplorer { class Target; } namespace ClangStaticAnalyzer { namespace Internal { @@ -31,6 +34,7 @@ class ClangStaticAnalyzerDiagnosticFilterModel; class ClangStaticAnalyzerDiagnosticModel; class ClangStaticAnalyzerDiagnosticView; class Diagnostic; +class DummyRunConfiguration; const char ClangStaticAnalyzerToolId[] = "ClangStaticAnalyzer"; @@ -72,6 +76,7 @@ private: QAction *m_goBack; QAction *m_goNext; + QHash m_runConfigs; bool m_running; }; From 3c9346a219f5cfea3c94d209f87fa65d73e8579b Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Fri, 10 Apr 2015 10:17:44 +0200 Subject: [PATCH 064/111] De-QObjectify Settings class. Change-Id: I67d6caff28f1196bec16cfef4dda6354700130f0 Reviewed-by: Nikolai Kosjar --- .../clangstaticanalyzer/clangstaticanalyzerconfigwidget.cpp | 4 ++-- plugins/clangstaticanalyzer/clangstaticanalyzersettings.h | 5 +---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.cpp index 6b8b0f0cee2..ced034aa6c4 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.cpp @@ -35,14 +35,14 @@ ClangStaticAnalyzerConfigWidget::ClangStaticAnalyzerConfigWidget( m_ui->clangExecutableChooser->setPath(settings->clangExecutable()); connect(m_ui->clangExecutableChooser, &Utils::PathChooser::changed, - m_settings, &ClangStaticAnalyzerSettings::setClangExecutable); + [settings](const QString &path) { settings->setClangExecutable(path); }); m_ui->simultaneousProccessesSpinBox->setValue(settings->simultaneousProcesses()); m_ui->simultaneousProccessesSpinBox->setMinimum(1); m_ui->simultaneousProccessesSpinBox->setMaximum(QThread::idealThreadCount()); connect(m_ui->simultaneousProccessesSpinBox, static_cast(&QSpinBox::valueChanged), - m_settings, &ClangStaticAnalyzerSettings::setSimultaneousProcesses); + [settings](int count) { settings->setSimultaneousProcesses(count); }); } ClangStaticAnalyzerConfigWidget::~ClangStaticAnalyzerConfigWidget() diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzersettings.h b/plugins/clangstaticanalyzer/clangstaticanalyzersettings.h index 71c4c218642..acd75458895 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzersettings.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzersettings.h @@ -19,16 +19,13 @@ #ifndef CLANGSTATICANALYZERSETTINGS_H #define CLANGSTATICANALYZERSETTINGS_H -#include #include namespace ClangStaticAnalyzer { namespace Internal { -class ClangStaticAnalyzerSettings : public QObject +class ClangStaticAnalyzerSettings { - Q_OBJECT - public: static ClangStaticAnalyzerSettings *instance(); From f8dc9c44184a428133038d3a5cefff366d0bceb0 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Mon, 13 Apr 2015 17:57:53 +0200 Subject: [PATCH 065/111] Fix typo in unit tests Change-Id: I2e44d2174878211e5dfabc39c80488e5a1848943 Reviewed-by: Christian Kandeler --- plugins/clangstaticanalyzer/clangstaticanalyzerunittests.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.cpp index d73cf78e42f..21b086858e3 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.cpp @@ -96,7 +96,7 @@ void ClangStaticAnalyzerUnitTests::testProject_data() QTest::addColumn("expectedDiagCount"); QTest::newRow("qbs project") << QString(m_tmpDir->path() + QLatin1String("/simple/simple.qbs")) << 1; - QTest::newRow("qbs project") + QTest::newRow("qmake project") << QString(m_tmpDir->path() + QLatin1String("/simple/simple.pro")) << 1; } From 6cdf38077edeecf074c02f4c1a2fb93cc44a15a2 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Mon, 13 Apr 2015 16:22:18 +0200 Subject: [PATCH 066/111] Add missing test dependencies Adapting to commit 044eeacde5ee1add8b06a8a53b86fd5c6991d488 Load only tested plugins when invoked with -test in the qtcreator repository. Change-Id: If28c6c79fe412e35726567505080e3723092968d Reviewed-by: Christian Kandeler --- plugins/clangstaticanalyzer/clangstaticanalyzer.qbs | 5 +++++ .../clangstaticanalyzer/clangstaticanalyzer_dependencies.pri | 3 +++ 2 files changed, 8 insertions(+) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzer.qbs b/plugins/clangstaticanalyzer/clangstaticanalyzer.qbs index a97dc9f83c7..ffc3f134099 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzer.qbs +++ b/plugins/clangstaticanalyzer/clangstaticanalyzer.qbs @@ -15,6 +15,11 @@ QtcPlugin { Depends { name: "Qt.widgets" } Depends { name: "Qt.network" } // TODO: See above + pluginTestDepends: [ + "QbsProjectManager", + "QmakeProjectManager", + ] + files: [ "clangstaticanalyzerconfigwidget.cpp", "clangstaticanalyzerconfigwidget.h", diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzer_dependencies.pri b/plugins/clangstaticanalyzer/clangstaticanalyzer_dependencies.pri index 0ca1dbad9b1..f857a18e430 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzer_dependencies.pri +++ b/plugins/clangstaticanalyzer/clangstaticanalyzer_dependencies.pri @@ -6,3 +6,6 @@ QTC_PLUGIN_DEPENDS += \ analyzerbase \ cpptools \ licensechecker +QTC_TEST_DEPENDS += \ + qbsprojectmanager \ + qmakeprojectmanager From c319695a43385908a8db8b7ccef2ba631385a513 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Wed, 15 Apr 2015 15:52:17 +0200 Subject: [PATCH 067/111] Set the architecture explicitly ("-m32"/"-m64) ...so that clang-cl will predefine size_t to the expected value. Task-number: QCE-52 Change-Id: Icd663c50bae2da8d7bd2d38f19528d57d810c2fa Reviewed-by: Christian Kandeler --- .../clangstaticanalyzerruncontrol.cpp | 53 +++++++++++++++---- .../clangstaticanalyzerruncontrol.h | 1 + 2 files changed, 44 insertions(+), 10 deletions(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp index c99060d13c2..1b20ba14c2e 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp @@ -35,8 +35,10 @@ #include #include +#include #include #include +#include #include #include @@ -61,14 +63,32 @@ ClangStaticAnalyzerRunControl::ClangStaticAnalyzerRunControl( , m_projectInfo(projectInfo) , m_toolchainType(ProjectExplorer::ToolChainKitInformation ::toolChain(runConfiguration->target()->kit())->type()) + , m_wordWidth(runConfiguration->abi().wordWidth()) , m_initialFilesToProcessSize(0) , m_filesAnalyzed(0) , m_filesNotAnalyzed(0) { } -// Removes (1) filePath (2) -o -static QStringList tweakedArguments(const QString &filePath, const QStringList &arguments) +static void prependWordWidthArgumentIfNotIncluded(QStringList *arguments, unsigned char wordWidth) +{ + QTC_ASSERT(arguments, return); + + const QString m64Argument = QLatin1String("-m64"); + const QString m32Argument = QLatin1String("-m32"); + + const QString argument = wordWidth == 64 ? m64Argument : m32Argument; + if (!arguments->contains(argument)) + arguments->prepend(argument); + + QTC_CHECK(!arguments->contains(m32Argument) || !arguments->contains(m32Argument)); +} + +// Removes (1) filePath (2) -o . +// Adds -m64/-m32 argument if not already included. +static QStringList tweakedArguments(const QString &filePath, + const QStringList &arguments, + unsigned char wordWidth) { QStringList newArguments; @@ -88,12 +108,15 @@ static QStringList tweakedArguments(const QString &filePath, const QStringList & } QTC_CHECK(skip == false); + prependWordWidthArgumentIfNotIncluded(&newArguments, wordWidth); + return newArguments; } static QStringList argumentsFromProjectPart(const CppTools::ProjectPart::Ptr &projectPart, CppTools::ProjectFile::Kind fileKind, - const QString &toolchainType) + const QString &toolchainType, + unsigned char wordWidth) { QStringList result; @@ -112,16 +135,20 @@ static QStringList argumentsFromProjectPart(const CppTools::ProjectPart::Ptr &pr 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; } static QList unitsToAnalyzeFromCompilerCallData( - const ProjectInfo::CompilerCallData &compilerCallData) + const ProjectInfo::CompilerCallData &compilerCallData, + unsigned char wordWidth) { typedef ClangStaticAnalyzerRunControl::AnalyzeUnit AnalyzeUnit; qCDebug(LOG) << "Taking arguments for analyzing from CompilerCallData."; @@ -134,7 +161,7 @@ static QList unitsToAnalyzeFromCompi const QString file = it.key(); const QList compilerCalls = it.value(); foreach (const QStringList &options, compilerCalls) { - const QStringList arguments = tweakedArguments(file, options); + const QStringList arguments = tweakedArguments(file, options, wordWidth); unitsToAnalyze << AnalyzeUnit(file, arguments); } } @@ -143,7 +170,9 @@ static QList unitsToAnalyzeFromCompi } static QList unitsToAnalyzeFromProjectParts( - const QList projectParts, const QString &toolchainType) + const QList projectParts, + const QString &toolchainType, + unsigned char wordWidth) { typedef ClangStaticAnalyzerRunControl::AnalyzeUnit AnalyzeUnit; qCDebug(LOG) << "Taking arguments for analyzing from ProjectParts."; @@ -159,8 +188,10 @@ static QList unitsToAnalyzeFromProje continue; QTC_CHECK(file.kind != ProjectFile::Unclassified); if (ProjectFile::isSource(file.kind)) { - const QStringList arguments - = argumentsFromProjectPart(projectPart, file.kind, toolchainType); + const QStringList arguments = argumentsFromProjectPart(projectPart, + file.kind, + toolchainType, + wordWidth); unitsToAnalyze << AnalyzeUnit(file.path, arguments); } } @@ -175,8 +206,10 @@ QList ClangStaticAnalyzerRunControl: const ProjectInfo::CompilerCallData compilerCallData = m_projectInfo.compilerCallData(); if (!compilerCallData.isEmpty()) - return unitsToAnalyzeFromCompilerCallData(compilerCallData); - return unitsToAnalyzeFromProjectParts(m_projectInfo.projectParts(), m_toolchainType); + return unitsToAnalyzeFromCompilerCallData(compilerCallData, m_wordWidth); + return unitsToAnalyzeFromProjectParts(m_projectInfo.projectParts(), + m_toolchainType, + m_wordWidth); } bool ClangStaticAnalyzerRunControl::startEngine() diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h index ff746446190..1da8598ffb1 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h @@ -70,6 +70,7 @@ private: private: const CppTools::ProjectInfo m_projectInfo; const QString m_toolchainType; + const unsigned char m_wordWidth; QString m_clangExecutable; QString m_clangLogFileDir; From db4318b700fcdc0070de24058adf641810797cb4 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Wed, 15 Apr 2015 16:23:49 +0200 Subject: [PATCH 068/111] Remove pointless Q_UNUSED() Change-Id: I1379864f979dfca1cfd432ec19ad168fbe91ea52 Reviewed-by: Christian Kandeler --- .../clangstaticanalyzerruncontrolfactory.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp index 03b7355cd62..9e8d69a4df6 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp @@ -70,8 +70,6 @@ RunControl *ClangStaticAnalyzerRunControlFactory::create(RunConfiguration *runCo RunMode runMode, QString *errorMessage) { - Q_UNUSED(runMode); - using namespace CppTools; const ProjectInfo projectInfoBeforeBuild = m_tool->projectInfoBeforeBuild(); QTC_ASSERT(projectInfoBeforeBuild.isValid(), return 0); From 7b7f7c2e677b5066a90c76ff1d3ec02699f1f5ed Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Wed, 15 Apr 2015 18:21:02 +0200 Subject: [PATCH 069/111] Fix QTC_CHECK condition in prependWordWidthArgumentIfNotIncluded() Change-Id: I8a6a10eab18b8eb0eb1570eb13db91d712fb71ec Reviewed-by: Christian Kandeler --- plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp index 1b20ba14c2e..4ef7cacfa94 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp @@ -81,7 +81,7 @@ static void prependWordWidthArgumentIfNotIncluded(QStringList *arguments, unsign if (!arguments->contains(argument)) arguments->prepend(argument); - QTC_CHECK(!arguments->contains(m32Argument) || !arguments->contains(m32Argument)); + QTC_CHECK(!arguments->contains(m32Argument) || !arguments->contains(m64Argument)); } // Removes (1) filePath (2) -o . From 11a7e7168777e4bb90fa18c477bca50499eaa582 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Wed, 15 Apr 2015 18:24:58 +0200 Subject: [PATCH 070/111] Add qt-widgets-app unit test Change-Id: I502075f79d4abf6bd5c0d2080b2f543116499ace Reviewed-by: Christian Kandeler --- .../clangstaticanalyzerunittests.cpp | 10 ++++++-- .../clangstaticanalyzerunittests.qrc | 6 +++++ .../unit-tests/qt-widgets-app/main.cpp | 11 +++++++++ .../unit-tests/qt-widgets-app/mainwindow.cpp | 14 +++++++++++ .../unit-tests/qt-widgets-app/mainwindow.h | 24 +++++++++++++++++++ .../unit-tests/qt-widgets-app/mainwindow.ui | 24 +++++++++++++++++++ .../qt-widgets-app/qt-widgets-app.pro | 8 +++++++ .../qt-widgets-app/qt-widgets-app.qbs | 17 +++++++++++++ 8 files changed, 112 insertions(+), 2 deletions(-) create mode 100644 plugins/clangstaticanalyzer/unit-tests/qt-widgets-app/main.cpp create mode 100644 plugins/clangstaticanalyzer/unit-tests/qt-widgets-app/mainwindow.cpp create mode 100644 plugins/clangstaticanalyzer/unit-tests/qt-widgets-app/mainwindow.h create mode 100644 plugins/clangstaticanalyzer/unit-tests/qt-widgets-app/mainwindow.ui create mode 100644 plugins/clangstaticanalyzer/unit-tests/qt-widgets-app/qt-widgets-app.pro create mode 100644 plugins/clangstaticanalyzer/unit-tests/qt-widgets-app/qt-widgets-app.qbs diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.cpp index 21b086858e3..4eed4205747 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.cpp @@ -94,10 +94,16 @@ void ClangStaticAnalyzerUnitTests::testProject_data() { QTest::addColumn("projectFilePath"); QTest::addColumn("expectedDiagCount"); - QTest::newRow("qbs project") + + QTest::newRow("simple qbs project") << QString(m_tmpDir->path() + QLatin1String("/simple/simple.qbs")) << 1; - QTest::newRow("qmake project") + QTest::newRow("simple qmake project") << QString(m_tmpDir->path() + QLatin1String("/simple/simple.pro")) << 1; + + QTest::newRow("qt-widgets-app qbs project") + << QString(m_tmpDir->path() + QLatin1String("/qt-widgets-app/qt-widgets-app.qbs")) << 0; + QTest::newRow("qt-widgets-app qmake project") + << QString(m_tmpDir->path() + QLatin1String("/qt-widgets-app/qt-widgets-app.pro")) << 0; } } // namespace Internal diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.qrc b/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.qrc index 0de4936d20e..d8a1a8674e8 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.qrc +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.qrc @@ -3,5 +3,11 @@ unit-tests/simple/main.cpp unit-tests/simple/simple.qbs unit-tests/simple/simple.pro + unit-tests/qt-widgets-app/main.cpp + unit-tests/qt-widgets-app/mainwindow.cpp + unit-tests/qt-widgets-app/mainwindow.h + unit-tests/qt-widgets-app/mainwindow.ui + unit-tests/qt-widgets-app/qt-widgets-app.pro + unit-tests/qt-widgets-app/qt-widgets-app.qbs diff --git a/plugins/clangstaticanalyzer/unit-tests/qt-widgets-app/main.cpp b/plugins/clangstaticanalyzer/unit-tests/qt-widgets-app/main.cpp new file mode 100644 index 00000000000..b48f94ec827 --- /dev/null +++ b/plugins/clangstaticanalyzer/unit-tests/qt-widgets-app/main.cpp @@ -0,0 +1,11 @@ +#include "mainwindow.h" +#include + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + MainWindow w; + w.show(); + + return a.exec(); +} diff --git a/plugins/clangstaticanalyzer/unit-tests/qt-widgets-app/mainwindow.cpp b/plugins/clangstaticanalyzer/unit-tests/qt-widgets-app/mainwindow.cpp new file mode 100644 index 00000000000..49d64fce7ce --- /dev/null +++ b/plugins/clangstaticanalyzer/unit-tests/qt-widgets-app/mainwindow.cpp @@ -0,0 +1,14 @@ +#include "mainwindow.h" +#include "ui_mainwindow.h" + +MainWindow::MainWindow(QWidget *parent) : + QMainWindow(parent), + ui(new Ui::MainWindow) +{ + ui->setupUi(this); +} + +MainWindow::~MainWindow() +{ + delete ui; +} diff --git a/plugins/clangstaticanalyzer/unit-tests/qt-widgets-app/mainwindow.h b/plugins/clangstaticanalyzer/unit-tests/qt-widgets-app/mainwindow.h new file mode 100644 index 00000000000..ce76956bad9 --- /dev/null +++ b/plugins/clangstaticanalyzer/unit-tests/qt-widgets-app/mainwindow.h @@ -0,0 +1,24 @@ +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include + +QT_BEGIN_NAMESPACE +namespace Ui { +class MainWindow; +} +QT_END_NAMESPACE + +class MainWindow : public QMainWindow +{ + Q_OBJECT + +public: + explicit MainWindow(QWidget *parent = 0); + ~MainWindow(); + +private: + Ui::MainWindow *ui; +}; + +#endif // MAINWINDOW_H diff --git a/plugins/clangstaticanalyzer/unit-tests/qt-widgets-app/mainwindow.ui b/plugins/clangstaticanalyzer/unit-tests/qt-widgets-app/mainwindow.ui new file mode 100644 index 00000000000..6050363fa71 --- /dev/null +++ b/plugins/clangstaticanalyzer/unit-tests/qt-widgets-app/mainwindow.ui @@ -0,0 +1,24 @@ + + MainWindow + + + + 0 + 0 + 400 + 300 + + + + MainWindow + + + + + + + + + + + diff --git a/plugins/clangstaticanalyzer/unit-tests/qt-widgets-app/qt-widgets-app.pro b/plugins/clangstaticanalyzer/unit-tests/qt-widgets-app/qt-widgets-app.pro new file mode 100644 index 00000000000..d9e1f2590b0 --- /dev/null +++ b/plugins/clangstaticanalyzer/unit-tests/qt-widgets-app/qt-widgets-app.pro @@ -0,0 +1,8 @@ +QT += core gui +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets + +TARGET = qt-widgets-app +TEMPLATE = app +SOURCES += main.cpp mainwindow.cpp +HEADERS += mainwindow.h +FORMS += mainwindow.ui diff --git a/plugins/clangstaticanalyzer/unit-tests/qt-widgets-app/qt-widgets-app.qbs b/plugins/clangstaticanalyzer/unit-tests/qt-widgets-app/qt-widgets-app.qbs new file mode 100644 index 00000000000..e641f9bd54d --- /dev/null +++ b/plugins/clangstaticanalyzer/unit-tests/qt-widgets-app/qt-widgets-app.qbs @@ -0,0 +1,17 @@ +import qbs 1.0 + +QtApplication { + name : "Qt Widgets Application" + + Depends { + name: "Qt" + submodules: [ "widgets" ] + } + + files : [ + "main.cpp", + "mainwindow.cpp", + "mainwindow.h", + "mainwindow.ui" + ] +} From 5a493ae38fa74b27b0f7bfb1f7c7a00bd299b9cf Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Thu, 16 Apr 2015 10:44:31 +0200 Subject: [PATCH 071/111] qbs build: Clear file tags of unit test resources. Otherwise qbs will try to build the cpp files in there. Change-Id: I8afd776c8e03bd5f2aea5ac254e94168c23290c3 Reviewed-by: Nikolai Kosjar --- plugins/clangstaticanalyzer/clangstaticanalyzer.qbs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzer.qbs b/plugins/clangstaticanalyzer/clangstaticanalyzer.qbs index ffc3f134099..098c4186c25 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzer.qbs +++ b/plugins/clangstaticanalyzer/clangstaticanalyzer.qbs @@ -66,7 +66,13 @@ QtcPlugin { "clangstaticanalyzerunittests.cpp", "clangstaticanalyzerunittests.h", "clangstaticanalyzerunittests.qrc", - "unit-tests/**/*", ] } + + Group { + name: "Unit test resources" + prefix: "unit-tests/" + fileTags: [] + files: ["**/*"] + } } From fce0b8510615e599e8c2a24ec26206c2044049e8 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Thu, 16 Apr 2015 12:29:24 +0200 Subject: [PATCH 072/111] Reduce calls to SessionManager:startupProject() Might fix race conditions. Change-Id: I70f7f28c88afe328468332898919b69fc432098b Reviewed-by: Christian Kandeler --- .../clangstaticanalyzerruncontrolfactory.cpp | 6 +++++- .../clangstaticanalyzer/clangstaticanalyzertool.cpp | 12 ++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp index 9e8d69a4df6..34fb3d4b5a6 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp @@ -74,8 +74,12 @@ RunControl *ClangStaticAnalyzerRunControlFactory::create(RunConfiguration *runCo const ProjectInfo projectInfoBeforeBuild = m_tool->projectInfoBeforeBuild(); QTC_ASSERT(projectInfoBeforeBuild.isValid(), return 0); - Project *project = SessionManager::startupProject(); + QTC_ASSERT(runConfiguration, return 0); + Target * const target = runConfiguration->target(); + QTC_ASSERT(target, return 0); + Project * const project = target->project(); QTC_ASSERT(project, return 0); + const ProjectInfo projectInfoAfterBuild = CppModelManager::instance()->projectInfo(project); if (projectInfoAfterBuild.configurationOrFilesChanged(projectInfoBeforeBuild)) { diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp index 4e98a28ddd7..c7a44e46de3 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp @@ -166,7 +166,7 @@ AnalyzerRunControl *ClangStaticAnalyzerTool::createRunControl( // Some projects provides CompilerCallData once a build is finished, // so pass on the updated Project Info unless no configuration change // (defines/includes/files) happened. - Project *project = SessionManager::startupProject(); + Project *project = runConfiguration->target()->project(); QTC_ASSERT(project, return 0); const CppTools::ProjectInfo projectInfoAfterBuild = CppTools::CppModelManager::instance()->projectInfo(project); @@ -185,9 +185,8 @@ AnalyzerRunControl *ClangStaticAnalyzerTool::createRunControl( return engine; } -static bool dontStartAfterHintForDebugMode() +static bool dontStartAfterHintForDebugMode(Project *project) { - const Project *project = SessionManager::startupProject(); BuildConfiguration::BuildType buildType = BuildConfiguration::Unknown; if (project) { if (const Target *target = project->activeTarget()) { @@ -222,13 +221,14 @@ void ClangStaticAnalyzerTool::startTool() { AnalyzerManager::showMode(); - if (dontStartAfterHintForDebugMode()) + Project *project = SessionManager::startupProject(); + QTC_ASSERT(project, return); + + if (dontStartAfterHintForDebugMode(project)) return; m_diagnosticModel->clear(); setBusyCursor(true); - Project *project = SessionManager::startupProject(); - QTC_ASSERT(project, return); m_diagnosticFilterModel->setProject(project); m_projectInfoBeforeBuild = CppTools::CppModelManager::instance()->projectInfo(project); QTC_ASSERT(m_projectInfoBeforeBuild.isValid(), return); From ef79615fe59168b176dcc18f982a0eec9346d2d1 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Thu, 16 Apr 2015 13:16:09 +0200 Subject: [PATCH 073/111] Extract AnalyzeUnit out of ClangStaticAnalyzerRunControl Reduces some noise in the implementation file. Change-Id: I24e81941c1888ba69f6b7f8dcab35956f60ca4e6 Reviewed-by: Christian Kandeler --- .../clangstaticanalyzerruncontrol.cpp | 21 ++++++++---------- .../clangstaticanalyzerruncontrol.h | 22 +++++++++---------- 2 files changed, 20 insertions(+), 23 deletions(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp index 4ef7cacfa94..9eec04f25b8 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp @@ -146,14 +146,13 @@ static QStringList argumentsFromProjectPart(const CppTools::ProjectPart::Ptr &pr return result; } -static QList unitsToAnalyzeFromCompilerCallData( +static AnalyzeUnits unitsToAnalyzeFromCompilerCallData( const ProjectInfo::CompilerCallData &compilerCallData, unsigned char wordWidth) { - typedef ClangStaticAnalyzerRunControl::AnalyzeUnit AnalyzeUnit; qCDebug(LOG) << "Taking arguments for analyzing from CompilerCallData."; - QList unitsToAnalyze; + AnalyzeUnits unitsToAnalyze; QHashIterator > it(compilerCallData); while (it.hasNext()) { @@ -169,15 +168,13 @@ static QList unitsToAnalyzeFromCompi return unitsToAnalyze; } -static QList unitsToAnalyzeFromProjectParts( - const QList projectParts, - const QString &toolchainType, - unsigned char wordWidth) +static AnalyzeUnits unitsToAnalyzeFromProjectParts(const QList projectParts, + const QString &toolchainType, + unsigned char wordWidth) { - typedef ClangStaticAnalyzerRunControl::AnalyzeUnit AnalyzeUnit; qCDebug(LOG) << "Taking arguments for analyzing from ProjectParts."; - QList unitsToAnalyze; + AnalyzeUnits unitsToAnalyze; foreach (const ProjectPart::Ptr &projectPart, projectParts) { if (!projectPart->selectedForBuilding) @@ -200,9 +197,9 @@ static QList unitsToAnalyzeFromProje return unitsToAnalyze; } -QList ClangStaticAnalyzerRunControl::unitsToAnalyze() +AnalyzeUnits ClangStaticAnalyzerRunControl::unitsToAnalyze() { - QTC_ASSERT(m_projectInfo.isValid(), return QList()); + QTC_ASSERT(m_projectInfo.isValid(), return AnalyzeUnits()); const ProjectInfo::CompilerCallData compilerCallData = m_projectInfo.compilerCallData(); if (!compilerCallData.isEmpty()) @@ -249,7 +246,7 @@ bool ClangStaticAnalyzerRunControl::startEngine() m_clangLogFileDir = temporaryDir.path(); // Collect files - QList unitsToProcess = unitsToAnalyze(); + AnalyzeUnits unitsToProcess = unitsToAnalyze(); Utils::sort(unitsToProcess, [](const AnalyzeUnit &a1, const AnalyzeUnit &a2) -> bool { return a1.file < a2.file; }); diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h index 1da8598ffb1..167539b2a90 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h @@ -31,19 +31,19 @@ namespace Internal { class ClangStaticAnalyzerRunner; class Diagnostic; +struct AnalyzeUnit { + AnalyzeUnit(const QString &file, const QStringList &options) + : file(file), arguments(options) {} + + QString file; + QStringList arguments; // without file itself and "-o somePath" +}; +typedef QList AnalyzeUnits; + class ClangStaticAnalyzerRunControl : public Analyzer::AnalyzerRunControl { Q_OBJECT -public: - struct AnalyzeUnit { - AnalyzeUnit(const QString &file, const QStringList &options) - : file(file), arguments(options) {} - - QString file; - QStringList arguments; // without file itself and "-o somePath" - }; - public: explicit ClangStaticAnalyzerRunControl(const Analyzer::AnalyzerStartParameters &startParams, ProjectExplorer::RunConfiguration *runConfiguration, @@ -56,7 +56,7 @@ signals: void newDiagnosticsAvailable(const QList &diagnostics); private: - QList unitsToAnalyze(); + AnalyzeUnits unitsToAnalyze(); void analyzeNextFile(); ClangStaticAnalyzerRunner *createRunner(); @@ -75,7 +75,7 @@ private: QString m_clangExecutable; QString m_clangLogFileDir; QFutureInterface m_progress; - QList m_unitsToProcess; + AnalyzeUnits m_unitsToProcess; QSet m_runners; int m_initialFilesToProcessSize; int m_filesAnalyzed; From 59e01e2a89290c0aa4a50d7064bbaade511cc8c3 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Mon, 4 May 2015 14:57:03 +0200 Subject: [PATCH 074/111] Unit tests: Explicitly check for success from runner. We will otherwise miss runner failures for any file that does not contribute to the diagnostics count. Note: The tool can also fail during the building stage, but in this case we will get notified by the signal spy timing out. Change-Id: Ia9aa797d658b1752e3da6e08a652ee55868955ba Reviewed-by: Nikolai Kosjar --- .../clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp | 3 +++ .../clangstaticanalyzer/clangstaticanalyzerruncontrol.h | 3 +++ plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp | 6 +++--- plugins/clangstaticanalyzer/clangstaticanalyzertool.h | 2 +- .../clangstaticanalyzer/clangstaticanalyzerunittests.cpp | 8 ++++---- 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp index 4ef7cacfa94..0bdbe1da0cf 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp @@ -214,6 +214,7 @@ QList ClangStaticAnalyzerRunControl: bool ClangStaticAnalyzerRunControl::startEngine() { + m_success = false; emit starting(this); QTC_ASSERT(m_projectInfo.isValid(), emit finished(); return false); @@ -277,6 +278,7 @@ bool ClangStaticAnalyzerRunControl::startEngine() m_runners.clear(); const int parallelRuns = ClangStaticAnalyzerSettings::instance()->simultaneousProcesses(); QTC_ASSERT(parallelRuns >= 1, emit finished(); return false); + m_success = true; while (m_runners.size() < parallelRuns && !m_unitsToProcess.isEmpty()) analyzeNextFile(); return true; @@ -373,6 +375,7 @@ void ClangStaticAnalyzerRunControl::onRunnerFinishedWithFailure(const QString &e qCDebug(LOG) << "onRunnerFinishedWithFailure:" << errorMessage << errorDetails; ++m_filesNotAnalyzed; + m_success = false; const QString filePath = qobject_cast(sender())->filePath(); appendMessage(tr("Failed to analyze \"%1\": %2").arg(filePath, errorMessage) + QLatin1Char('\n') diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h index 1da8598ffb1..f5782714f5f 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h @@ -52,6 +52,8 @@ public: bool startEngine(); void stopEngine(); + bool success() const { return m_success; } // For testing. + signals: void newDiagnosticsAvailable(const QList &diagnostics); @@ -80,6 +82,7 @@ private: int m_initialFilesToProcessSize; int m_filesAnalyzed; int m_filesNotAnalyzed; + bool m_success; }; } // namespace Internal diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp index 4e98a28ddd7..ce5fc9b3d32 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp @@ -228,10 +228,10 @@ void ClangStaticAnalyzerTool::startTool() m_diagnosticModel->clear(); setBusyCursor(true); Project *project = SessionManager::startupProject(); - QTC_ASSERT(project, return); + QTC_ASSERT(project, emit finished(false); return); m_diagnosticFilterModel->setProject(project); m_projectInfoBeforeBuild = CppTools::CppModelManager::instance()->projectInfo(project); - QTC_ASSERT(m_projectInfoBeforeBuild.isValid(), return); + QTC_ASSERT(m_projectInfoBeforeBuild.isValid(), emit finished(false); return); m_running = true; handleStateUpdate(); @@ -284,7 +284,7 @@ void ClangStaticAnalyzerTool::onEngineFinished() resetCursorAndProjectInfoBeforeBuild(); m_running = false; handleStateUpdate(); - emit finished(); + emit finished(static_cast(sender())->success()); } void ClangStaticAnalyzerTool::setBusyCursor(bool busy) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzertool.h b/plugins/clangstaticanalyzer/clangstaticanalyzertool.h index 4334884c7e7..24bf7dbd126 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzertool.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzertool.h @@ -57,7 +57,7 @@ public: void startTool(); signals: - void finished(); // For testing. + void finished(bool success); // For testing. private: void onEngineIsStarting(); diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.cpp index 4eed4205747..62fb91351b4 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.cpp @@ -83,10 +83,10 @@ void ClangStaticAnalyzerUnitTests::testProject() QVERIFY(projectInfo.isValid()); AnalyzerManager::selectTool(ClangStaticAnalyzerToolId); AnalyzerManager::startTool(); - if (m_analyzerTool->isRunning()) { - QSignalSpy waiter(m_analyzerTool, SIGNAL(finished())); - QVERIFY(waiter.wait(30000)); - } + QSignalSpy waiter(m_analyzerTool, SIGNAL(finished(bool))); + QVERIFY(waiter.wait(30000)); + const QList arguments = waiter.takeFirst(); + QVERIFY(arguments.first().toBool()); QCOMPARE(m_analyzerTool->diagnostics().count(), expectedDiagCount); } From 19f4072142d94861ab488b3e2255af0597fa59a6 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Wed, 15 Apr 2015 11:48:26 +0200 Subject: [PATCH 075/111] Run the analyzer within the build environment. This is especially important for clang-cl, which requires the environment set by e.g. vcvars32.bat [1]. [1] http://clang.llvm.org/docs/UsersManual.html#clang-cl Change-Id: If319bb94752bbef9207581c50173dde99af007bc Reviewed-by: Christian Kandeler --- .../clangstaticanalyzerruncontrol.cpp | 13 ++++++++++++- .../clangstaticanalyzerruncontrolfactory.cpp | 5 +++++ .../clangstaticanalyzerrunner.cpp | 2 ++ .../clangstaticanalyzer/clangstaticanalyzerrunner.h | 1 + .../tst_clangstaticanalyzerrunner.cpp | 6 ++++-- 5 files changed, 24 insertions(+), 3 deletions(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp index 9eec04f25b8..80338bdd776 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp @@ -209,6 +209,13 @@ AnalyzeUnits ClangStaticAnalyzerRunControl::unitsToAnalyze() m_wordWidth); } +static QDebug operator<<(QDebug debug, const Utils::Environment &environment) +{ + foreach (const QString &entry, environment.toStringList()) + debug << "\n " << entry; + return debug; +} + bool ClangStaticAnalyzerRunControl::startEngine() { emit starting(this); @@ -271,6 +278,7 @@ bool ClangStaticAnalyzerRunControl::startEngine() m_progress.reportStarted(); // Start process(es) + qCDebug(LOG) << "Environment:" << startParameters().environment; m_runners.clear(); const int parallelRuns = ClangStaticAnalyzerSettings::instance()->simultaneousProcesses(); QTC_ASSERT(parallelRuns >= 1, emit finished(); return false); @@ -335,7 +343,10 @@ ClangStaticAnalyzerRunner *ClangStaticAnalyzerRunControl::createRunner() QTC_ASSERT(!m_clangLogFileDir.isEmpty(), return 0); ClangStaticAnalyzerRunner *runner - = new ClangStaticAnalyzerRunner(m_clangExecutable, m_clangLogFileDir, this); + = new ClangStaticAnalyzerRunner(m_clangExecutable, + m_clangLogFileDir, + startParameters().environment, + this); connect(runner, &ClangStaticAnalyzerRunner::finishedWithSuccess, this, &ClangStaticAnalyzerRunControl::onRunnerFinishedWithSuccess); connect(runner, &ClangStaticAnalyzerRunner::finishedWithFailure, diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp index 34fb3d4b5a6..0b54fa2af3b 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp @@ -25,6 +25,7 @@ #include #include +#include #include #include #include @@ -99,6 +100,10 @@ RunControl *ClangStaticAnalyzerRunControlFactory::create(RunConfiguration *runCo AnalyzerStartParameters sp; sp.runMode = runMode; sp.startMode = StartLocal; + BuildConfiguration * const buildConfiguration = target->activeBuildConfiguration(); + QTC_ASSERT(buildConfiguration, return 0); + sp.environment = buildConfiguration->environment(); + return AnalyzerManager::createRunControl(sp, runConfiguration); } diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.cpp index be3cc8607de..be934bbc8c0 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.cpp @@ -64,6 +64,7 @@ QString finishedWithBadExitCode(int exitCode) ClangStaticAnalyzerRunner::ClangStaticAnalyzerRunner(const QString &clangExecutable, const QString &clangLogFileDir, + const Utils::Environment &environment, QObject *parent) : QObject(parent) , m_clangExecutable(clangExecutable) @@ -73,6 +74,7 @@ ClangStaticAnalyzerRunner::ClangStaticAnalyzerRunner(const QString &clangExecuta QTC_CHECK(!m_clangLogFileDir.isEmpty()); m_process.setProcessChannelMode(QProcess::MergedChannels); + m_process.setProcessEnvironment(environment.toProcessEnvironment()); m_process.setWorkingDirectory(m_clangLogFileDir); // Current clang-cl puts log file into working dir. connect(&m_process, &QProcess::started, this, &ClangStaticAnalyzerRunner::onProcessStarted); diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.h b/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.h index 6164d6ab801..62f8152771f 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.h @@ -37,6 +37,7 @@ class ClangStaticAnalyzerRunner : public QObject public: ClangStaticAnalyzerRunner(const QString &clangExecutable, const QString &clangLogFileDir, + const Utils::Environment &environment, QObject *parent = 0); ~ClangStaticAnalyzerRunner(); diff --git a/plugins/clangstaticanalyzer/tests/clangstaticanalyzerrunner/tst_clangstaticanalyzerrunner.cpp b/plugins/clangstaticanalyzer/tests/clangstaticanalyzerrunner/tst_clangstaticanalyzerrunner.cpp index 428213717f8..53d31b1d7ea 100644 --- a/plugins/clangstaticanalyzer/tests/clangstaticanalyzerrunner/tst_clangstaticanalyzerrunner.cpp +++ b/plugins/clangstaticanalyzer/tests/clangstaticanalyzerrunner/tst_clangstaticanalyzerrunner.cpp @@ -141,7 +141,8 @@ void ClangStaticAnalyzerRunnerTest::runWithTestCodeGeneratedOneIssue() QTemporaryDir temporaryDir(QDir::tempPath() + QLatin1String("/qtc-clangstaticanalyzer-XXXXXX")); QVERIFY(temporaryDir.isValid()); - ClangStaticAnalyzerRunner runner(QLatin1String("clang"), temporaryDir.path()); + ClangStaticAnalyzerRunner runner(QLatin1String("clang"), temporaryDir.path(), + Utils::Environment::systemEnvironment()); ClangStaticAnalyzerRunnerSignalTester st(&runner); QVERIFY(runner.run(testFilePath)); @@ -153,7 +154,8 @@ void ClangStaticAnalyzerRunnerTest::runWithNonExistentFileToAnalyze() { QTemporaryDir temporaryDir(QDir::tempPath() + QLatin1String("/qtc-clangstaticanalyzer-XXXXXX")); QVERIFY(temporaryDir.isValid()); - ClangStaticAnalyzerRunner runner(QLatin1String("clang"), temporaryDir.path()); + ClangStaticAnalyzerRunner runner(QLatin1String("clang"), temporaryDir.path(), + Utils::Environment::systemEnvironment()); ClangStaticAnalyzerRunnerSignalTester st(&runner); QVERIFY(runner.run(QLatin1String("not.existing.file.111"))); From dca023a8551c8a20b33d846dae57dc522c68ebf9 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Thu, 16 Apr 2015 13:33:57 +0200 Subject: [PATCH 076/111] Mini refactorings in ClangStaticAnalyzerRunControl ...making ClangStaticAnalyzerRunControl::startEngine() a bit shorter. Change-Id: Ie1547d81ba8443d663983bc0c2aa8f342932c338 Reviewed-by: Christian Kandeler --- .../clangstaticanalyzerruncontrol.cpp | 37 ++++++++++++------- .../clangstaticanalyzerruncontrol.h | 2 +- 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp index 80338bdd776..1ec5e6d2648 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp @@ -197,16 +197,24 @@ static AnalyzeUnits unitsToAnalyzeFromProjectParts(const QList return unitsToAnalyze; } -AnalyzeUnits ClangStaticAnalyzerRunControl::unitsToAnalyze() +AnalyzeUnits ClangStaticAnalyzerRunControl::sortedUnitsToAnalyze() { QTC_ASSERT(m_projectInfo.isValid(), return AnalyzeUnits()); + AnalyzeUnits units; const ProjectInfo::CompilerCallData compilerCallData = m_projectInfo.compilerCallData(); - if (!compilerCallData.isEmpty()) - return unitsToAnalyzeFromCompilerCallData(compilerCallData, m_wordWidth); - return unitsToAnalyzeFromProjectParts(m_projectInfo.projectParts(), - m_toolchainType, - m_wordWidth); + if (compilerCallData.isEmpty()) { + units = unitsToAnalyzeFromProjectParts(m_projectInfo.projectParts(), + m_toolchainType, + m_wordWidth); + } else { + units = unitsToAnalyzeFromCompilerCallData(compilerCallData, m_wordWidth); + } + + Utils::sort(units, [](const AnalyzeUnit &a1, const AnalyzeUnit &a2) -> bool { + return a1.file < a2.file; + }); + return units; } static QDebug operator<<(QDebug debug, const Utils::Environment &environment) @@ -216,6 +224,13 @@ static QDebug operator<<(QDebug debug, const Utils::Environment &environment) return debug; } +static QDebug operator<<(QDebug debug, const AnalyzeUnits &analyzeUnits) +{ + foreach (const AnalyzeUnit &unit, analyzeUnits) + debug << "\n " << unit.file; + return debug; +} + bool ClangStaticAnalyzerRunControl::startEngine() { emit starting(this); @@ -253,14 +268,8 @@ bool ClangStaticAnalyzerRunControl::startEngine() m_clangLogFileDir = temporaryDir.path(); // Collect files - AnalyzeUnits unitsToProcess = unitsToAnalyze(); - Utils::sort(unitsToProcess, [](const AnalyzeUnit &a1, const AnalyzeUnit &a2) -> bool { - return a1.file < a2.file; - }); - - qCDebug(LOG) << "Files to process:"; - foreach (const AnalyzeUnit &fileConfig, unitsToProcess) - qCDebug(LOG) << fileConfig.file; + const AnalyzeUnits unitsToProcess = sortedUnitsToAnalyze(); + qCDebug(LOG) << "Files to process:" << unitsToProcess; m_unitsToProcess = unitsToProcess; m_initialFilesToProcessSize = m_unitsToProcess.count(); m_filesAnalyzed = 0; diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h index 167539b2a90..783713535df 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h @@ -56,7 +56,7 @@ signals: void newDiagnosticsAvailable(const QList &diagnostics); private: - AnalyzeUnits unitsToAnalyze(); + AnalyzeUnits sortedUnitsToAnalyze(); void analyzeNextFile(); ClangStaticAnalyzerRunner *createRunner(); From 1a122c2e251649d78edb0f535222fd4359948ee2 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Tue, 28 Apr 2015 14:50:47 +0200 Subject: [PATCH 077/111] Get rid of FancyLineEdit::validate Use aggregation instead of inheritance for customization of validation Change-Id: I5a9703bad5bace78e8c3cc1e2c353a734001bd0a Reviewed-by: Eike Ziller --- .../clangstaticanalyzerconfigwidget.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.cpp index cb6c45c00b3..d73fd5436a2 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.cpp @@ -40,10 +40,11 @@ ClangStaticAnalyzerConfigWidget::ClangStaticAnalyzerConfigWidget( chooser->setHistoryCompleter(QLatin1String("ClangStaticAnalyzer.ClangCommand.History")); chooser->setPromptDialogTitle(tr("Clang Command")); chooser->setPath(settings->clangExecutable()); - const auto validator = [chooser](const QString &, QString *errorMessage) { - return isClangExecutableUsable(chooser->fileName().toString(), errorMessage); + const auto validator = [chooser](Utils::FancyLineEdit *edit, QString *errorMessage) { + return chooser->defaultValidationFunction()(edit, errorMessage) + && isClangExecutableUsable(chooser->fileName().toString(), errorMessage); }; - chooser->setAdditionalPathValidator(validator); + chooser->setValidationFunction(validator); connect(m_ui->clangExecutableChooser, &Utils::PathChooser::changed, [settings](const QString &path) { settings->setClangExecutable(path); }); From fef80b8fe69d1ad13a045c0012fd445967108d02 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Mon, 18 May 2015 11:32:43 +0200 Subject: [PATCH 078/111] Tests: Minor refactorings and TemporaryCopiedDir check Change-Id: Ia509e2d7229fadca06791f537c462924c32b8add Reviewed-by: Christian Kandeler --- .../clangstaticanalyzer/clangstaticanalyzerunittests.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.cpp index 62fb91351b4..e375a0f646d 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.cpp @@ -66,6 +66,7 @@ void ClangStaticAnalyzerUnitTests::initTestCase() QSKIP("No clang suitable for analyzing found"); m_tmpDir = new CppTools::Tests::TemporaryCopiedDir(QLatin1String(":/unit-tests")); + QVERIFY(m_tmpDir->isValid()); } void ClangStaticAnalyzerUnitTests::cleanupTestCase() @@ -96,14 +97,14 @@ void ClangStaticAnalyzerUnitTests::testProject_data() QTest::addColumn("expectedDiagCount"); QTest::newRow("simple qbs project") - << QString(m_tmpDir->path() + QLatin1String("/simple/simple.qbs")) << 1; + << QString(m_tmpDir->absolutePath("simple/simple.qbs")) << 1; QTest::newRow("simple qmake project") - << QString(m_tmpDir->path() + QLatin1String("/simple/simple.pro")) << 1; + << QString(m_tmpDir->absolutePath("simple/simple.pro")) << 1; QTest::newRow("qt-widgets-app qbs project") - << QString(m_tmpDir->path() + QLatin1String("/qt-widgets-app/qt-widgets-app.qbs")) << 0; + << QString(m_tmpDir->absolutePath("qt-widgets-app/qt-widgets-app.qbs")) << 0; QTest::newRow("qt-widgets-app qmake project") - << QString(m_tmpDir->path() + QLatin1String("/qt-widgets-app/qt-widgets-app.pro")) << 0; + << QString(m_tmpDir->absolutePath("qt-widgets-app/qt-widgets-app.pro")) << 0; } } // namespace Internal From 770a7de8fe2123f45ebcf44378aff5ee30627a4a Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Thu, 11 Jun 2015 15:47:35 +0200 Subject: [PATCH 079/111] Use native dir separators in user visible paths Change-Id: Ifc54be09fae6125a65a016d7030ca1d291e308c2 Reviewed-by: Christian Kandeler --- .../clangstaticanalyzerruncontrol.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp index 6bf9582e378..6e77de72d67 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp @@ -237,9 +237,9 @@ bool ClangStaticAnalyzerRunControl::startEngine() emit starting(this); QTC_ASSERT(m_projectInfo.isValid(), emit finished(); return false); - const QString projectFile = m_projectInfo.project()->projectFilePath().toString(); - appendMessage(tr("Running Clang Static Analyzer on %1").arg(projectFile) + QLatin1Char('\n'), - Utils::NormalMessageFormat); + const Utils::FileName projectFile = m_projectInfo.project()->projectFilePath(); + appendMessage(tr("Running Clang Static Analyzer on %1").arg(projectFile.toUserOutput()) + + QLatin1Char('\n'), Utils::NormalMessageFormat); // Check clang executable bool isValidClangExecutable; @@ -344,7 +344,8 @@ void ClangStaticAnalyzerRunControl::analyzeNextFile() m_runners.insert(runner); QTC_ASSERT(runner->run(unit.file, unit.arguments), return); - appendMessage(tr("Analyzing \"%1\".").arg(unit.file) + QLatin1Char('\n'), + appendMessage(tr("Analyzing \"%1\".").arg( + Utils::FileName::fromString(unit.file).toUserOutput()) + QLatin1Char('\n'), Utils::StdOutFormat); } From cffd9f8f3efa88b694cdb849e58666fe73494e0a Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Thu, 18 Jun 2015 12:25:18 +0200 Subject: [PATCH 080/111] Adapt to API changes in AnalyzerBase. Change-Id: Id61d77653c3161f3abc97581f5e9674adf81598b Reviewed-by: Andre Poenitz --- plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp | 1 - .../clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp | 1 - 2 files changed, 2 deletions(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp index dced8b03d6c..dc18783772d 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp @@ -156,7 +156,6 @@ bool ClangStaticAnalyzerPlugin::initializeEnterpriseFeatures(const QStringList & action->setText(tr("Clang Static Analyzer")); action->setToolTip(toolTip); action->setMenuGroup(Constants::G_ANALYZER_TOOLS); - action->setStartMode(StartLocal); action->setEnabled(false); AnalyzerManager::addAction(action); diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp index 0b54fa2af3b..6531ca39a2f 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp @@ -99,7 +99,6 @@ RunControl *ClangStaticAnalyzerRunControlFactory::create(RunConfiguration *runCo AnalyzerStartParameters sp; sp.runMode = runMode; - sp.startMode = StartLocal; BuildConfiguration * const buildConfiguration = target->activeBuildConfiguration(); QTC_ASSERT(buildConfiguration, return 0); sp.environment = buildConfiguration->environment(); From a92d11001e006b6ecae7dcc5b41f60ad42025a0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Fri, 19 Jun 2015 11:55:37 +0200 Subject: [PATCH 081/111] Adapt to upstream API change Change-Id: I33168006b955af224fd914482a042958f6319c4e Reviewed-by: Christian Kandeler --- plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp index dc18783772d..6e1b2bb79aa 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp @@ -152,7 +152,7 @@ bool ClangStaticAnalyzerPlugin::initializeEnterpriseFeatures(const QStringList & action->setActionId("ClangStaticAnalyzer"); action->setWidgetCreator(widgetCreator); action->setRunControlCreator(runControlCreator); - action->setToolStarter([tool] { tool->startTool(); }); + action->setCustomToolStarter([tool] { tool->startTool(); }); action->setText(tr("Clang Static Analyzer")); action->setToolTip(toolTip); action->setMenuGroup(Constants::G_ANALYZER_TOOLS); From bd3195ec6bb96379c59079627da39b2db297bb4a Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Tue, 23 Jun 2015 09:24:54 +0200 Subject: [PATCH 082/111] 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 e375a0f646d..a4611c6ef77 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(); From d49232bbf122f9b65e9a1c25d296cdb9d130d4dd Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Thu, 11 Jun 2015 17:29:00 +0200 Subject: [PATCH 083/111] Make licensechecker dependency optional Change-Id: Ie867d2da37a507d36caaf16494f996b88ca4e142 Reviewed-by: Christian Kandeler --- plugins/clangstaticanalyzer/clangstaticanalyzer.pro | 2 ++ .../clangstaticanalyzer_dependencies.pri | 5 +++-- .../clangstaticanalyzer/clangstaticanalyzerplugin.cpp | 10 ++++++++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzer.pro b/plugins/clangstaticanalyzer/clangstaticanalyzer.pro index cdffb1f1d1c..f348951ea7c 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 f857a18e430..22a09515c44 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 6e1b2bb79aa..6668bfe9de2 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, From 44f0bb287c577169b408fb5833bf9583799487ae Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Thu, 25 Jun 2015 14:17:11 +0200 Subject: [PATCH 084/111] 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 6e77de72d67..9281673bec6 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( From 3529df2e6e468faf9d5bf113d7c4c45f647368f8 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Thu, 25 Jun 2015 17:29:41 +0200 Subject: [PATCH 085/111] Fix license header Change-Id: I017092613cdec7c00736442c10ca80b3c74f0189 Reviewed-by: Christian Kandeler --- plugins/clangstaticanalyzer/clangstaticanalyzer_global.h | 2 +- .../clangstaticanalyzer/clangstaticanalyzerconfigwidget.cpp | 2 +- plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.h | 2 +- plugins/clangstaticanalyzer/clangstaticanalyzerconstants.h | 2 +- plugins/clangstaticanalyzer/clangstaticanalyzerdiagnostic.cpp | 2 +- plugins/clangstaticanalyzer/clangstaticanalyzerdiagnostic.h | 2 +- .../clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.cpp | 2 +- .../clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.h | 2 +- .../clangstaticanalyzer/clangstaticanalyzerdiagnosticview.cpp | 2 +- .../clangstaticanalyzer/clangstaticanalyzerdiagnosticview.h | 2 +- .../clangstaticanalyzer/clangstaticanalyzerlogfilereader.cpp | 2 +- plugins/clangstaticanalyzer/clangstaticanalyzerlogfilereader.h | 2 +- plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp | 2 +- plugins/clangstaticanalyzer/clangstaticanalyzerplugin.h | 2 +- .../clangstaticanalyzer/clangstaticanalyzerprojectsettings.cpp | 3 ++- .../clangstaticanalyzer/clangstaticanalyzerprojectsettings.h | 2 +- .../clangstaticanalyzerprojectsettingsmanager.cpp | 3 ++- .../clangstaticanalyzerprojectsettingsmanager.h | 3 ++- .../clangstaticanalyzerprojectsettingswidget.cpp | 3 ++- .../clangstaticanalyzerprojectsettingswidget.h | 3 ++- plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp | 2 +- plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h | 2 +- .../clangstaticanalyzerruncontrolfactory.cpp | 2 +- .../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 +- .../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 bc96f936e0c..46bb4566ff0 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 d73fd5436a2..b8fb5cfa477 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 11c6018fefb..4f55be8f4ed 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 04ed79b998d..0a0e734a7bc 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 a20ed6caa8f..2f626a6afd4 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 dfb2f449625..4ab2e3c30d7 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 40f59244425..0cc4dfb9a0d 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 a2dc49c26c3..492624627af 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 f1805f2da20..a4c3fd66e32 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 4fbdc7f8668..b9b5fa6fc35 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 eb905439694..55f7bf0547b 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 f2febffd77f..f9d89d6a4b8 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 6668bfe9de2..f31e7c3298a 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 474934e0ee1..fca517e55e0 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 7ee14816be9..b5a57b4410a 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 2a993de966d..a5d54f5ef76 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 8b1637bba1b..2040ac8293c 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 97f8d79a99f..9baa41a00f6 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 580e6f750d4..387b9361434 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 66699197369..c83fc0ce4ca 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 9281673bec6..35590e82845 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 7a4729babe9..f9456df30a9 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 6531ca39a2f..81a8c21ec12 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 3d06a5e80fb..9afd9f9f5ca 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 be934bbc8c0..98eba1cacdc 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 62f8152771f..6379ce8a3fb 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 774bf4941be..97c456ff81b 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 acd75458895..70f85d49125 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 38e715dfc1c..e6181c01e55 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 24bf7dbd126..3cc1ff18659 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 a4611c6ef77..faa21907263 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 bbf9cc88f6f..cd63b51d842 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 3860f929a6e..65a5bb0a659 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 ca06c4874e5..38485e82106 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 89547adcaa9..ebd0e5ab007 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 53d31b1d7ea..95bab274b8c 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 From 73ec42f62399601938026612692a3969965ed3ec Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Wed, 24 Jun 2015 16:00:44 +0200 Subject: [PATCH 086/111] 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 2ccc31337cc..524debd5005 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" } From c26e6e398bc3e924b7dddb4e48b7c379f8a9b539 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Fri, 26 Jun 2015 09:15:51 +0200 Subject: [PATCH 087/111] 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 b8fb5cfa477..6bc81cac64f 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); }); From fafb0cb8d46b9a1515d3913129785428e599fd80 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Fri, 26 Jun 2015 13:53:50 +0200 Subject: [PATCH 088/111] 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 35590e82845..0a1e65676af 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 f9456df30a9..f9419e21c33 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; From 33ee3ffcca22f08fe8de88504cc2c689ca1b2025 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Mon, 29 Jun 2015 13:16:07 +0200 Subject: [PATCH 089/111] 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 0a1e65676af..2fa55429600 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; }; From 39613b3b084d16c056ea22ea327712f4c05f5437 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Tue, 30 Jun 2015 10:56:56 +0200 Subject: [PATCH 090/111] Adapt to changes to run mode Change-Id: I9e299d6fa49920ffa98ececb5b96e9512055ba34 Reviewed-by: Nikolai Kosjar --- .../clangstaticanalyzer/clangstaticanalyzerconstants.h | 1 + plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp | 5 +++-- .../clangstaticanalyzerruncontrolfactory.cpp | 8 +++++--- .../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 0a0e734a7bc..11147306141 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 f31e7c3298a..2afd35cec30 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 81a8c21ec12..acc5f519e81 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 9afd9f9f5ca..68eb68e3cb4 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 e6181c01e55..959de1c5976 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 From 313724ace923b5b4a453722139c31ae2d8465e9c Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Wed, 1 Jul 2015 12:33:03 +0200 Subject: [PATCH 091/111] Adapt to API change in main QtC. Change-Id: I1496b29cc4b3a9802587f67d078b9c3d953f0141 Reviewed-by: Andre Poenitz --- plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp index 959de1c5976..08ad19f1703 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp @@ -316,7 +316,7 @@ void ClangStaticAnalyzerTool::handleStateUpdate() message += tr("%n issues found (%1 suppressed).", 0, issuesFound) .arg(issuesFound - issuesVisible); } - AnalyzerManager::showPermanentStatusMessage(message); + AnalyzerManager::showPermanentStatusMessage(ClangStaticAnalyzerToolId, message); } } // namespace Internal From daa478adad625b40d51cea9d90be8a77210a6818 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Wed, 1 Jul 2015 17:20:45 +0200 Subject: [PATCH 092/111] Factor out license check. Change-Id: Ifcaab7252239bde1affa8bc55ab38761c0f6e99f Reviewed-by: Nikolai Kosjar --- .../clangstaticanalyzer.pro | 1 + .../clangstaticanalyzer.qbs | 1 + .../clangstaticanalyzerlicensecheck.h | 45 +++++++++++++++++++ .../clangstaticanalyzerplugin.cpp | 24 ++-------- 4 files changed, 51 insertions(+), 20 deletions(-) create mode 100644 plugins/clangstaticanalyzer/clangstaticanalyzerlicensecheck.h diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzer.pro b/plugins/clangstaticanalyzer/clangstaticanalyzer.pro index f348951ea7c..176c3274f18 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzer.pro +++ b/plugins/clangstaticanalyzer/clangstaticanalyzer.pro @@ -28,6 +28,7 @@ HEADERS += \ clangstaticanalyzerdiagnosticmodel.h \ clangstaticanalyzerdiagnosticview.h \ clangstaticanalyzer_global.h \ + clangstaticanalyzerlicensecheck.h \ clangstaticanalyzerlogfilereader.h \ clangstaticanalyzerplugin.h \ clangstaticanalyzerprojectsettings.h \ diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzer.qbs b/plugins/clangstaticanalyzer/clangstaticanalyzer.qbs index 524debd5005..beb745f5293 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzer.qbs +++ b/plugins/clangstaticanalyzer/clangstaticanalyzer.qbs @@ -30,6 +30,7 @@ QtcCommercialPlugin { "clangstaticanalyzerdiagnosticmodel.h", "clangstaticanalyzerdiagnosticview.cpp", "clangstaticanalyzerdiagnosticview.h", + "clangstaticanalyzerlicensecheck.h", "clangstaticanalyzerlogfilereader.cpp", "clangstaticanalyzerlogfilereader.h", "clangstaticanalyzerplugin.cpp", diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerlicensecheck.h b/plugins/clangstaticanalyzer/clangstaticanalyzerlicensecheck.h new file mode 100644 index 00000000000..7b0d09ba9df --- /dev/null +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerlicensecheck.h @@ -0,0 +1,45 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd +** 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 ClangStaticAnalyzer Add-on. +** +** Licensees holding valid Qt Enterprise licenses may use this file in +** accordance with the Qt Enterprise License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. +** +** If you have questions regarding the use of this file, please use +** contact form at http://www.qt.io/contact-us +** +****************************************************************************/ + +#ifndef CLANGSTATICANALYZERLICENSECHECK_H +#define CLANGSTATICANALYZERLICENSECHECK_H + +#ifdef LICENSECHECKER +#include +#include +#endif + +inline bool enterpriseFeaturesAvailable() +{ +#ifdef LICENSECHECKER + LicenseChecker::LicenseCheckerPlugin *licenseChecker + = ExtensionSystem::PluginManager::getObject(); + + if (licenseChecker && licenseChecker->hasValidLicense()) { + if (licenseChecker->enterpriseFeatures()) + return true; + } else { + qWarning() << "Invalid license, disabling Clang Static Analyzer"; + } + return false; +#else // LICENSECHECKER + return true; +#endif +} + +#endif // Include guard. diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp index 2afd35cec30..2fb20ea644c 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp @@ -20,6 +20,7 @@ #include "clangstaticanalyzerconfigwidget.h" #include "clangstaticanalyzerconstants.h" +#include "clangstaticanalyzerlicensecheck.h" #include "clangstaticanalyzerprojectsettingswidget.h" #include "clangstaticanalyzerruncontrolfactory.h" #include "clangstaticanalyzertool.h" @@ -38,12 +39,6 @@ #include #include -#ifdef LICENSECHECKER -#include -#endif - -#include - #include #include #include @@ -117,21 +112,7 @@ bool ClangStaticAnalyzerPlugin::initialize(const QStringList &arguments, QString panelFactory->setDisplayName(tr("Clang Static Analyzer Settings")); panelFactory->setSimpleCreateWidgetFunction(QIcon()); ProjectExplorer::ProjectPanelFactory::registerFactory(panelFactory); - -#ifdef LICENSECHECKER - LicenseChecker::LicenseCheckerPlugin *licenseChecker - = ExtensionSystem::PluginManager::getObject(); - - if (licenseChecker && licenseChecker->hasValidLicense()) { - if (licenseChecker->enterpriseFeatures()) - return initializeEnterpriseFeatures(arguments, errorString); - } else { - qWarning() << "Invalid license, disabling Clang Static Analyzer"; - } - return true; -#else // LICENSECHECKER return initializeEnterpriseFeatures(arguments, errorString); -#endif } bool ClangStaticAnalyzerPlugin::initializeEnterpriseFeatures(const QStringList &arguments, @@ -140,6 +121,9 @@ bool ClangStaticAnalyzerPlugin::initializeEnterpriseFeatures(const QStringList & Q_UNUSED(arguments); Q_UNUSED(errorString); + if (!enterpriseFeaturesAvailable()) + return true; + auto tool = m_analyzerTool = new ClangStaticAnalyzerTool(this); addAutoReleasedObject(new ClangStaticAnalyzerRunControlFactory(m_analyzerTool)); addAutoReleasedObject(new ClangStaticAnalyzerOptionsPage); From 19d470ac6a7285000a869b7068dad7e710633227 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Tue, 7 Jul 2015 09:54:43 +0200 Subject: [PATCH 093/111] Fix displaying tab name in the application output pane It was empty due to commit c209eb9fbbbdac177dca0ec5cfb3454fcb8fc262 AnalyerRunControl: Don't store the runconfiguration Change-Id: Ib20ca9ab5b6e4b4fe971e6b9bcba1fba46a3b152 Reviewed-by: Daniel Teske --- .../clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp index acc5f519e81..c8a24e4fcf5 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp @@ -100,6 +100,7 @@ RunControl *ClangStaticAnalyzerRunControlFactory::create(RunConfiguration *runCo } AnalyzerStartParameters sp; + sp.displayName = runConfiguration->displayName(); sp.runMode = runMode; BuildConfiguration * const buildConfiguration = target->activeBuildConfiguration(); QTC_ASSERT(buildConfiguration, return 0); From d8d5bff0711d0f76092d0f0520e00fc44227dd2f Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Thu, 9 Jul 2015 15:28:09 +0200 Subject: [PATCH 094/111] Handle zero files to process The analyzer was stuck in the running mode (busy cursor, progress bar) for zero files. Change-Id: I9e520dc65b6d027b82e6e31043c0401ebb9f3673 Reviewed-by: Christian Kandeler --- .../clangstaticanalyzerruncontrol.cpp | 39 ++++++++++++------- .../clangstaticanalyzerruncontrol.h | 2 + 2 files changed, 27 insertions(+), 14 deletions(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp index 2fa55429600..9ca6a1dfa1e 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp @@ -349,6 +349,11 @@ bool ClangStaticAnalyzerRunControl::startEngine() const int parallelRuns = ClangStaticAnalyzerSettings::instance()->simultaneousProcesses(); QTC_ASSERT(parallelRuns >= 1, emit finished(); return false); m_success = true; + + if (m_unitsToProcess.isEmpty()) { + finalize(); + return false; + } while (m_runners.size() < parallelRuns && !m_unitsToProcess.isEmpty()) analyzeNextFile(); return true; @@ -376,20 +381,8 @@ void ClangStaticAnalyzerRunControl::analyzeNextFile() return; // The previous call already reported that we are finished. if (m_unitsToProcess.isEmpty()) { - if (m_runners.size() == 0) { - appendMessage(tr("Clang Static Analyzer finished: " - "Processed %1 files successfully, %2 failed.") - .arg(m_filesAnalyzed) - .arg(m_filesNotAnalyzed) - + QLatin1Char('\n'), - Utils::NormalMessageFormat); - if (m_filesAnalyzed == 0 && m_filesNotAnalyzed != 0) { - AnalyzerUtils::logToIssuesPane(Task::Error, - tr("Clang Static Analyzer: Failed to analyze any files.")); - } - m_progress.reportFinished(); - emit finished(); - } + if (m_runners.isEmpty()) + finalize(); return; } @@ -480,5 +473,23 @@ void ClangStaticAnalyzerRunControl::updateProgressValue() m_progress.setProgressValue(m_initialFilesToProcessSize - m_unitsToProcess.size()); } +void ClangStaticAnalyzerRunControl::finalize() +{ + appendMessage(tr("Clang Static Analyzer finished: " + "Processed %1 files successfully, %2 failed.") + .arg(m_filesAnalyzed) + .arg(m_filesNotAnalyzed) + + QLatin1Char('\n'), + Utils::NormalMessageFormat); + + if (m_filesAnalyzed == 0 && m_filesNotAnalyzed != 0) { + AnalyzerUtils::logToIssuesPane(Task::Error, + tr("Clang Static Analyzer: Failed to analyze any files.")); + } + + m_progress.reportFinished(); + emit finished(); +} + } // namespace Internal } // namespace ClangStaticAnalyzer diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h index f9419e21c33..0bffb4d7881 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h @@ -69,6 +69,8 @@ private: void onProgressCanceled(); void updateProgressValue(); + void finalize(); + private: const CppTools::ProjectInfo m_projectInfo; const unsigned char m_wordWidth; From 378b057a9f29829ac0c2e38c408df8e9568a9791 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Thu, 9 Jul 2015 17:19:21 +0200 Subject: [PATCH 095/111] By default, look for the clang executable in Creator's libexec dir. It will be part of the installation from 3.5 on. Also look explicitly for "clang-cl" on Windows now, as we do not ship clang.exe. Change-Id: I67e22ed4251791dd59015dd6f9648c7a14d941d7 Reviewed-by: Nikolai Kosjar --- .../clangstaticanalyzerconfigwidget.cpp | 26 ++++++++++++++-- .../clangstaticanalyzerconstants.h | 1 - .../clangstaticanalyzersettings.cpp | 31 ++++++++++++++----- .../clangstaticanalyzersettings.h | 3 +- 4 files changed, 49 insertions(+), 12 deletions(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.cpp index 6bc81cac64f..58fa6d0c47a 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.cpp @@ -40,11 +40,31 @@ ClangStaticAnalyzerConfigWidget::ClangStaticAnalyzerConfigWidget( chooser->setHistoryCompleter(QLatin1String("ClangStaticAnalyzer.ClangCommand.History")); chooser->setPromptDialogTitle(tr("Clang Command")); const auto validator = [chooser](Utils::FancyLineEdit *edit, QString *errorMessage) { - return chooser->defaultValidationFunction()(edit, errorMessage) - && isClangExecutableUsable(chooser->fileName().toString(), errorMessage); + const QString currentFilePath = chooser->fileName().toString(); + Utils::PathChooser pc; + Utils::PathChooser *helperPathChooser; + if (currentFilePath.isEmpty()) { + pc.setExpectedKind(chooser->expectedKind()); + pc.setPath(edit->placeholderText()); + helperPathChooser = &pc; + } else { + helperPathChooser = chooser; + } + return chooser->defaultValidationFunction()(helperPathChooser->lineEdit(), errorMessage) + && isClangExecutableUsable(helperPathChooser->fileName().toString(), errorMessage); }; chooser->setValidationFunction(validator); - chooser->setPath(settings->clangExecutable()); + bool clangExeIsSet; + const QString clangExe = settings->clangExecutable(&clangExeIsSet); + chooser->lineEdit()->setPlaceholderText(settings->defaultClangExecutable()); + if (clangExeIsSet) { + chooser->setPath(clangExe); + } else { + // Setting an empty string does not trigger the validator, as that is the initial value + // in the line edit. + chooser->setPath(QLatin1String(" ")); + chooser->lineEdit()->clear(); + } connect(m_ui->clangExecutableChooser, &Utils::PathChooser::changed, [settings](const QString &path) { settings->setClangExecutable(path); }); diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerconstants.h b/plugins/clangstaticanalyzer/clangstaticanalyzerconstants.h index 11147306141..bc696b5b9df 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerconstants.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerconstants.h @@ -22,7 +22,6 @@ namespace ClangStaticAnalyzer { namespace Constants { -const char CLANG_EXECUTABLE_BASE_NAME[] = "clang"; const char SETTINGS_ID[] = "ClangStaticAnalyzer"; const char CLANGSTATICANALYZER_RUN_MODE[] = "ClangStaticAnalyzer.RunMode"; diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzersettings.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzersettings.cpp index 97c456ff81b..3ab12ef958d 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzersettings.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzersettings.cpp @@ -46,14 +46,34 @@ ClangStaticAnalyzerSettings *ClangStaticAnalyzerSettings::instance() return &instance; } -QString ClangStaticAnalyzerSettings::clangExecutable() const +static QString clangExecutableFileName() { + return QLatin1String(Utils::HostOsInfo::isWindowsHost() ? "clang-cl.exe" : "clang"); +} + +QString ClangStaticAnalyzerSettings::defaultClangExecutable() const +{ + const QString shippedBinary = Core::ICore::libexecPath() + QLatin1Char('/') + + clangExecutableFileName(); + if (QFileInfo(shippedBinary).isExecutable()) + return shippedBinary; + return clangExecutableFileName(); +} + +QString ClangStaticAnalyzerSettings::clangExecutable(bool *isSet) const +{ + if (m_clangExecutable.isEmpty()) { + if (isSet) + *isSet = false; + return defaultClangExecutable(); + } + if (isSet) + *isSet = true; return m_clangExecutable; } void ClangStaticAnalyzerSettings::setClangExecutable(const QString &exectuable) { - QTC_ASSERT(!exectuable.isEmpty(), return); m_clangExecutable = exectuable; } @@ -73,10 +93,7 @@ void ClangStaticAnalyzerSettings::readSettings() QSettings *settings = Core::ICore::settings(); settings->beginGroup(QLatin1String(Constants::SETTINGS_ID)); - const QString defaultClangExecutable = Utils::HostOsInfo::withExecutableSuffix( - QLatin1String(Constants::CLANG_EXECUTABLE_BASE_NAME)); - setClangExecutable(settings->value(QLatin1String(clangExecutableKey), - defaultClangExecutable).toString()); + setClangExecutable(settings->value(QLatin1String(clangExecutableKey)).toString()); const int defaultSimultaneousProcesses = qMax(0, QThread::idealThreadCount() / 2); setSimultaneousProcesses(settings->value(QLatin1String(simultaneousProcessesKey), @@ -89,7 +106,7 @@ void ClangStaticAnalyzerSettings::writeSettings() const { QSettings *settings = Core::ICore::settings(); settings->beginGroup(QLatin1String(Constants::SETTINGS_ID)); - settings->setValue(QLatin1String(clangExecutableKey), clangExecutable()); + settings->setValue(QLatin1String(clangExecutableKey), m_clangExecutable); settings->setValue(QLatin1String(simultaneousProcessesKey), simultaneousProcesses()); settings->endGroup(); } diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzersettings.h b/plugins/clangstaticanalyzer/clangstaticanalyzersettings.h index 70f85d49125..c4b97947363 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzersettings.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzersettings.h @@ -31,7 +31,8 @@ public: void writeSettings() const; - QString clangExecutable() const; + QString defaultClangExecutable() const; + QString clangExecutable(bool *isSet = nullptr) const; void setClangExecutable(const QString &exectuable); int simultaneousProcesses() const; From 7bdf007c8641c01a5c7bbbe2195f22df490ed936 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Tue, 7 Jul 2015 15:24:47 +0200 Subject: [PATCH 096/111] Adapt to removal of ToolChain::type() QtC change: e6d1141e1e524cce1bb43a1a859bfbd5441c02d8 Change-Id: I50c0861dc6a864e54170b21de94a4106921e5a71 Reviewed-by: Tobias Hunger --- .../clangstaticanalyzerruncontrol.cpp | 15 ++++++++------- .../clangstaticanalyzerruncontrolfactory.cpp | 8 ++++---- .../clangstaticanalyzerunittests.cpp | 2 +- .../clangstaticanalyzerutils.cpp | 6 ++++-- .../clangstaticanalyzerutils.h | 4 +++- 5 files changed, 20 insertions(+), 15 deletions(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp index 9ca6a1dfa1e..6403e5f1c89 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp @@ -143,14 +143,15 @@ public: // Therefore, prevent the inclusion of the header that references them. Of course, this // will break if code actually requires stuff from there, but that should be the less common // case. - const QString type = projectPart->toolchainType; - if (type == QLatin1String("mingw") || type == QLatin1String("gcc")) + const Core::Id type = projectPart->toolchainType; + if (type == ProjectExplorer::Constants::MINGW_TOOLCHAIN_ID + || type == ProjectExplorer::Constants::GCC_TOOLCHAIN_ID) optionsBuilder.addDefine("#define _X86INTRIN_H_INCLUDED\n"); optionsBuilder.addToolchainAndProjectDefines(); optionsBuilder.addHeaderPathOptions(); - if (projectPart->toolchainType == QLatin1String("msvc")) + if (type == ProjectExplorer::Constants::MSVC_TOOLCHAIN_ID) optionsBuilder.add(QLatin1String("/EHsc")); // clang-cl does not understand exceptions else optionsBuilder.add(QLatin1String("-fPIC")); // TODO: Remove? @@ -163,7 +164,7 @@ public: private: ClangStaticAnalyzerOptionsBuilder(const CppTools::ProjectPart::Ptr &projectPart) : CompilerOptionsBuilder(projectPart) - , m_isMsvcToolchain(m_projectPart->toolchainType == QLatin1String("msvc")) + , m_isMsvcToolchain(m_projectPart->toolchainType == ProjectExplorer::Constants::MSVC_TOOLCHAIN_ID) { } @@ -281,10 +282,10 @@ static QDebug operator<<(QDebug debug, const AnalyzeUnits &analyzeUnits) return debug; } -static QString toolchainType(ProjectExplorer::RunConfiguration *runConfiguration) +static Core::Id toolchainType(ProjectExplorer::RunConfiguration *runConfiguration) { - QTC_ASSERT(runConfiguration, return QString()); - return ToolChainKitInformation::toolChain(runConfiguration->target()->kit())->type(); + QTC_ASSERT(runConfiguration, return Core::Id()); + return ToolChainKitInformation::toolChain(runConfiguration->target()->kit())->typeId(); } bool ClangStaticAnalyzerRunControl::startEngine() diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp index c8a24e4fcf5..ef628959a9f 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp @@ -63,10 +63,10 @@ bool ClangStaticAnalyzerRunControlFactory::canRun(RunConfiguration *runConfigura Kit *kit = target->kit(); QTC_ASSERT(kit, return false); ToolChain *toolChain = ToolChainKitInformation::toolChain(kit); - return toolChain && (toolChain->type() == QLatin1String("clang") - || toolChain->type() == QLatin1String("gcc") - || toolChain->type() == QLatin1String("mingw") - || toolChain->type() == QLatin1String("msvc")); + return toolChain && (toolChain->typeId() == ProjectExplorer::Constants::CLANG_TOOLCHAIN_ID + || toolChain->typeId() == ProjectExplorer::Constants::GCC_TOOLCHAIN_ID + || toolChain->typeId() == ProjectExplorer::Constants::MINGW_TOOLCHAIN_ID + || toolChain->typeId() == ProjectExplorer::Constants::MSVC_TOOLCHAIN_ID); } RunControl *ClangStaticAnalyzerRunControlFactory::create(RunConfiguration *runConfiguration, diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.cpp index faa21907263..65873400ab2 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.cpp @@ -61,7 +61,7 @@ void ClangStaticAnalyzerUnitTests::initTestCase() if (!toolchain) QSKIP("This test requires that there is a kit with a toolchain."); bool hasClangExecutable; - clangExecutableFromSettings(toolchain->type(), &hasClangExecutable); + clangExecutableFromSettings(toolchain->typeId(), &hasClangExecutable); if (!hasClangExecutable) QSKIP("No clang suitable for analyzing found"); diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerutils.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerutils.cpp index 65a5bb0a659..c3c68fa5381 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerutils.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerutils.cpp @@ -21,6 +21,8 @@ #include "clangstaticanalyzerdiagnostic.h" #include "clangstaticanalyzersettings.h" +#include + #include #include @@ -38,10 +40,10 @@ static bool isFileExecutable(const QString &executablePath) namespace ClangStaticAnalyzer { namespace Internal { -QString clangExecutableFromSettings(const QString &toolchainType, bool *isValid) +QString clangExecutableFromSettings(Core::Id toolchainType, bool *isValid) { QString exeFromSettings = ClangStaticAnalyzerSettings::instance()->clangExecutable(); - if (toolchainType == QLatin1String("msvc")) + if (toolchainType == ProjectExplorer::Constants::MSVC_TOOLCHAIN_ID) exeFromSettings.replace(QLatin1String("clang.exe"), QLatin1String("clang-cl.exe")); return clangExecutable(exeFromSettings, isValid); } diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerutils.h b/plugins/clangstaticanalyzer/clangstaticanalyzerutils.h index 38485e82106..9885fc73904 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerutils.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerutils.h @@ -19,6 +19,8 @@ #ifndef CLANGSTATICANALYZERUTILS_H #define CLANGSTATICANALYZERUTILS_H +#include + #include QT_BEGIN_NAMESPACE @@ -33,7 +35,7 @@ class Location; bool isClangExecutableUsable(const QString &filePath, QString *errorMessage = 0); QString clangExecutable(const QString &fileNameOrPath, bool *isValid); -QString clangExecutableFromSettings(const QString &toolchainType, bool *isValid); +QString clangExecutableFromSettings(Core::Id toolchainType, bool *isValid); QString createFullLocationString(const ClangStaticAnalyzer::Internal::Location &location); From 7332cf28ff5964d8ad1d391ff28bf7393946dd1b Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Tue, 7 Jul 2015 15:37:10 +0200 Subject: [PATCH 097/111] Adapt to rename of ProjectExplorer constants QtC change: https://codereview.qt-project.org/#/c/120930/ Change-Id: I5af573d58f13dfc50e9dd003cb652d785e8c8347 Reviewed-by: Tobias Hunger --- .../clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp | 8 ++++---- .../clangstaticanalyzerruncontrolfactory.cpp | 8 ++++---- plugins/clangstaticanalyzer/clangstaticanalyzerutils.cpp | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp index 6403e5f1c89..20ac43d393a 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp @@ -144,14 +144,14 @@ public: // will break if code actually requires stuff from there, but that should be the less common // case. const Core::Id type = projectPart->toolchainType; - if (type == ProjectExplorer::Constants::MINGW_TOOLCHAIN_ID - || type == ProjectExplorer::Constants::GCC_TOOLCHAIN_ID) + if (type == ProjectExplorer::Constants::MINGW_TOOLCHAIN_TYPEID + || type == ProjectExplorer::Constants::GCC_TOOLCHAIN_TYPEID) optionsBuilder.addDefine("#define _X86INTRIN_H_INCLUDED\n"); optionsBuilder.addToolchainAndProjectDefines(); optionsBuilder.addHeaderPathOptions(); - if (type == ProjectExplorer::Constants::MSVC_TOOLCHAIN_ID) + if (type == ProjectExplorer::Constants::MSVC_TOOLCHAIN_TYPEID) optionsBuilder.add(QLatin1String("/EHsc")); // clang-cl does not understand exceptions else optionsBuilder.add(QLatin1String("-fPIC")); // TODO: Remove? @@ -164,7 +164,7 @@ public: private: ClangStaticAnalyzerOptionsBuilder(const CppTools::ProjectPart::Ptr &projectPart) : CompilerOptionsBuilder(projectPart) - , m_isMsvcToolchain(m_projectPart->toolchainType == ProjectExplorer::Constants::MSVC_TOOLCHAIN_ID) + , m_isMsvcToolchain(m_projectPart->toolchainType == ProjectExplorer::Constants::MSVC_TOOLCHAIN_TYPEID) { } diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp index ef628959a9f..7c2c61b8e85 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp @@ -63,10 +63,10 @@ bool ClangStaticAnalyzerRunControlFactory::canRun(RunConfiguration *runConfigura Kit *kit = target->kit(); QTC_ASSERT(kit, return false); ToolChain *toolChain = ToolChainKitInformation::toolChain(kit); - return toolChain && (toolChain->typeId() == ProjectExplorer::Constants::CLANG_TOOLCHAIN_ID - || toolChain->typeId() == ProjectExplorer::Constants::GCC_TOOLCHAIN_ID - || toolChain->typeId() == ProjectExplorer::Constants::MINGW_TOOLCHAIN_ID - || toolChain->typeId() == ProjectExplorer::Constants::MSVC_TOOLCHAIN_ID); + return toolChain && (toolChain->typeId() == ProjectExplorer::Constants::CLANG_TOOLCHAIN_TYPEID + || toolChain->typeId() == ProjectExplorer::Constants::GCC_TOOLCHAIN_TYPEID + || toolChain->typeId() == ProjectExplorer::Constants::MINGW_TOOLCHAIN_TYPEID + || toolChain->typeId() == ProjectExplorer::Constants::MSVC_TOOLCHAIN_TYPEID); } RunControl *ClangStaticAnalyzerRunControlFactory::create(RunConfiguration *runConfiguration, diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerutils.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerutils.cpp index c3c68fa5381..b3ba34da69f 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerutils.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerutils.cpp @@ -43,7 +43,7 @@ namespace Internal { QString clangExecutableFromSettings(Core::Id toolchainType, bool *isValid) { QString exeFromSettings = ClangStaticAnalyzerSettings::instance()->clangExecutable(); - if (toolchainType == ProjectExplorer::Constants::MSVC_TOOLCHAIN_ID) + if (toolchainType == ProjectExplorer::Constants::MSVC_TOOLCHAIN_TYPEID) exeFromSettings.replace(QLatin1String("clang.exe"), QLatin1String("clang-cl.exe")); return clangExecutable(exeFromSettings, isValid); } From 0fac5deb5948ad3a38e567a2f8270108444a6e96 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Thu, 16 Jul 2015 14:24:28 +0200 Subject: [PATCH 098/111] Make license check output more helpful. Change-Id: Ia17b5ef5661cd7bd17efbbf0f1985860c220111e Reviewed-by: Nikolai Kosjar --- .../clangstaticanalyzer/clangstaticanalyzerlicensecheck.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerlicensecheck.h b/plugins/clangstaticanalyzer/clangstaticanalyzerlicensecheck.h index 7b0d09ba9df..13a303207c2 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerlicensecheck.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerlicensecheck.h @@ -31,8 +31,12 @@ inline bool enterpriseFeaturesAvailable() = ExtensionSystem::PluginManager::getObject(); if (licenseChecker && licenseChecker->hasValidLicense()) { - if (licenseChecker->enterpriseFeatures()) + if (licenseChecker->enterpriseFeatures()) { return true; + } else { + qWarning() << "License does not cover enterprise features, " + "disabling Clang Static Analyzer"; + } } else { qWarning() << "Invalid license, disabling Clang Static Analyzer"; } From 48e5deabb7cda02beda6f09a3dfc59a2789b4b9f Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Wed, 8 Jul 2015 18:41:57 +0200 Subject: [PATCH 099/111] Disable action for non-c++ projects Change-Id: I7ccdd3d364c7761cd1206d526f4e6f7ada133ebf Task-number: QCE-59 Reviewed-by: Andre Poenitz Reviewed-by: Christian Kandeler --- .../clangstaticanalyzerruncontrolfactory.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp index c8a24e4fcf5..5cbe9d5d3e6 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp @@ -24,6 +24,8 @@ #include #include +#include + #include #include @@ -31,6 +33,8 @@ #include #include #include +#include +#include #include #include #include @@ -58,6 +62,12 @@ bool ClangStaticAnalyzerRunControlFactory::canRun(RunConfiguration *runConfigura if (runMode != Constants::CLANGSTATICANALYZER_RUN_MODE) return false; + Project *project = runConfiguration->target()->project(); + QTC_ASSERT(project, return false); + const Core::Context context = project->projectLanguages(); + if (!context.contains(ProjectExplorer::Constants::LANG_CXX)) + return false; + Target *target = runConfiguration->target(); QTC_ASSERT(target, return false); Kit *kit = target->kit(); From d9affc16c4b52edb0ea38b20bc80437c4afffbf9 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Fri, 19 Jun 2015 15:37:16 +0200 Subject: [PATCH 100/111] Adapt to new diagnostics presentation API in AnalyzerBase. Task-number: QCE-34 Change-Id: Ia86fa082b3798ba42ec209b0e417e8a8ca0f8fa7 Reviewed-by: Nikolai Kosjar --- .../clangstaticanalyzerdiagnostic.cpp | 15 -- .../clangstaticanalyzerdiagnostic.h | 21 +- .../clangstaticanalyzerdiagnosticmodel.cpp | 221 +++++++++++++--- .../clangstaticanalyzerdiagnosticmodel.h | 19 +- .../clangstaticanalyzerdiagnosticview.cpp | 248 +----------------- .../clangstaticanalyzerdiagnosticview.h | 15 -- .../clangstaticanalyzerlogfilereader.cpp | 14 +- .../clangstaticanalyzertool.cpp | 8 +- .../clangstaticanalyzertool.h | 2 +- .../clangstaticanalyzerutils.cpp | 2 +- .../clangstaticanalyzerutils.h | 6 +- .../tests/clangstaticanalyzerautotest.qbs | 1 + .../tst_clangstaticanalyzerlogfilereader.cpp | 38 +-- plugins/clangstaticanalyzer/tests/tests.pri | 1 + 14 files changed, 233 insertions(+), 378 deletions(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnostic.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnostic.cpp index 2f626a6afd4..4e5f20a6bf6 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnostic.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnostic.cpp @@ -21,21 +21,6 @@ namespace ClangStaticAnalyzer { namespace Internal { -Location::Location() - : line(0), column(0) -{ -} - -Location::Location(const QString &filePath, int line, int column) - : filePath(filePath), line(line), column(column) -{ -} - -bool Location::isValid() const -{ - return !filePath.isEmpty() && line >= 0 && column >= 0; -} - ExplainingStep::ExplainingStep() : depth(0) { diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnostic.h b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnostic.h index 4ab2e3c30d7..fe744a555bb 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnostic.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnostic.h @@ -19,6 +19,8 @@ #ifndef CLANGSTATICANALZYERDIAGNOSTIC_H #define CLANGSTATICANALZYERDIAGNOSTIC_H +#include + #include #include #include @@ -26,19 +28,6 @@ namespace ClangStaticAnalyzer { namespace Internal { -class Location -{ -public: - Location(); - Location(const QString &filePath, int line, int column); - - bool isValid() const; - - QString filePath; - int line; - int column; -}; - class ExplainingStep { public: @@ -48,8 +37,8 @@ public: QString message; QString extendedMessage; - Location location; - QList ranges; + Analyzer::DiagnosticLocation location; + QList ranges; int depth; }; @@ -63,7 +52,7 @@ public: QString type; QString issueContextKind; QString issueContext; - Location location; + Analyzer::DiagnosticLocation location; QList explainingSteps; }; diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.cpp index 0cc4dfb9a0d..c96e9c75287 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.cpp @@ -18,6 +18,7 @@ #include "clangstaticanalyzerdiagnosticmodel.h" +#include "clangstaticanalyzerdiagnosticview.h" #include "clangstaticanalyzerprojectsettingsmanager.h" #include "clangstaticanalyzerutils.h" @@ -28,32 +29,53 @@ #include #include +#include + namespace ClangStaticAnalyzer { namespace Internal { -ClangStaticAnalyzerDiagnosticModel::ClangStaticAnalyzerDiagnosticModel(QObject *parent) - : QAbstractListModel(parent) +class DiagnosticItem : public Utils::TreeItem { +public: + DiagnosticItem(const Diagnostic &diag); + + Diagnostic diagnostic() const { return m_diagnostic; } + +private: + QVariant data(int column, int role) const override; + + const Diagnostic m_diagnostic; +}; + +class ExplainingStepItem : public Utils::TreeItem +{ +public: + ExplainingStepItem(const ExplainingStep &step); + +private: + QVariant data(int column, int role) const override; + + const ExplainingStep m_step; +}; + +ClangStaticAnalyzerDiagnosticModel::ClangStaticAnalyzerDiagnosticModel(QObject *parent) + : Utils::TreeModel(parent) +{ + setHeader(QStringList() << tr("Issue") << tr("Location")); } void ClangStaticAnalyzerDiagnosticModel::addDiagnostics(const QList &diagnostics) { - beginInsertRows(QModelIndex(), m_diagnostics.size(), - m_diagnostics.size() + diagnostics.size() - 1 ); - m_diagnostics += diagnostics; - endInsertRows(); + foreach (const Diagnostic &d, diagnostics) + rootItem()->appendChild(new DiagnosticItem(d)); } -void ClangStaticAnalyzerDiagnosticModel::clear() +QList ClangStaticAnalyzerDiagnosticModel::diagnostics() const { - beginResetModel(); - m_diagnostics.clear(); - endResetModel(); -} - -int ClangStaticAnalyzerDiagnosticModel::rowCount(const QModelIndex &parent) const -{ - return parent.isValid() ? 0 : m_diagnostics.count(); + QList diags; + foreach (const Utils::TreeItem * const item, rootItem()->children()) + diags << static_cast(item)->diagnostic(); + return diags; } static QString createDiagnosticToolTipString(const Diagnostic &diagnostic) @@ -100,28 +122,162 @@ static QString createDiagnosticToolTipString(const Diagnostic &diagnostic) return html; } -QVariant ClangStaticAnalyzerDiagnosticModel::data(const QModelIndex &index, int role) const +static QString createExplainingStepToolTipString(const ExplainingStep &step) { - if (!index.isValid()) + if (step.message == step.extendedMessage) + return createFullLocationString(step.location); + + typedef QPair StringPair; + QList lines; + + if (!step.message.isEmpty()) { + lines << qMakePair( + QCoreApplication::translate("ClangStaticAnalyzer::ExplainingStep", "Message:"), + step.message.toHtmlEscaped()); + } + if (!step.extendedMessage.isEmpty()) { + lines << qMakePair( + QCoreApplication::translate("ClangStaticAnalyzer::ExplainingStep", "Extended Message:"), + step.extendedMessage.toHtmlEscaped()); + } + + lines << qMakePair( + QCoreApplication::translate("ClangStaticAnalyzer::ExplainingStep", "Location:"), + createFullLocationString(step.location)); + + QString html = QLatin1String("" + "" + "\n" + "
"); + + foreach (const StringPair &pair, lines) { + html += QLatin1String("
"); + html += pair.first; + html += QLatin1String("
"); + html += pair.second; + html += QLatin1String("
\n"); + } + html += QLatin1String("
"); + return html; +} + +static QString createLocationString(const Analyzer::DiagnosticLocation &location) +{ + const QString filePath = location.filePath; + const QString lineNumber = QString::number(location.line); + const QString fileAndLine = filePath + QLatin1Char(':') + lineNumber; + return QLatin1String("in ") + fileAndLine; +} + +static QString createExplainingStepNumberString(int number) +{ + const int fieldWidth = 2; + return QString::fromLatin1("%1:").arg(number, fieldWidth); +} + +static QString createExplainingStepString(const ExplainingStep &explainingStep, int number) +{ + return createExplainingStepNumberString(number) + + QLatin1Char(' ') + + explainingStep.extendedMessage + + QLatin1Char(' ') + + createLocationString(explainingStep.location); +} + +static QString fullText(const Diagnostic &diagnostic) +{ + // Summary. + QString text = diagnostic.category + QLatin1String(": ") + diagnostic.type; + if (diagnostic.type != diagnostic.description) + text += QLatin1String(": ") + diagnostic.description; + text += QLatin1Char('\n'); + + // Explaining steps. + int explainingStepNumber = 1; + foreach (const ExplainingStep &explainingStep, diagnostic.explainingSteps) { + text += createExplainingStepString(explainingStep, explainingStepNumber++) + + QLatin1Char('\n'); + } + + text.chop(1); // Trailing newline. + return text; +} + + +DiagnosticItem::DiagnosticItem(const Diagnostic &diag) : m_diagnostic(diag) +{ + // Don't show explaining steps if they add no information. + if (diag.explainingSteps.count() == 1) { + const ExplainingStep &step = diag.explainingSteps.first(); + if (step.message == diag.description && step.location == diag.location) + return; + } + + foreach (const ExplainingStep &s, diag.explainingSteps) + appendChild(new ExplainingStepItem(s)); +} + +QVariant locationData(int role, const Analyzer::DiagnosticLocation &location) +{ + switch (role) { + case Analyzer::DetailedErrorView::LocationRole: + return QVariant::fromValue(location); + case Qt::ToolTipRole: + return location.filePath.isEmpty() ? QVariant() : QVariant(location.filePath); + default: return QVariant(); + } +} - if (index.parent().isValid()) +QVariant DiagnosticItem::data(int column, int role) const +{ + if (column == Analyzer::DetailedErrorView::LocationColumn) + return locationData(role, m_diagnostic.location); + + // DiagnosticColumn + switch (role) { + case Analyzer::DetailedErrorView::FullTextRole: + return fullText(m_diagnostic); + case ClangStaticAnalyzerDiagnosticModel::DiagnosticRole: + return QVariant::fromValue(m_diagnostic); + case Qt::DisplayRole: + return m_diagnostic.description; + case Qt::ToolTipRole: + return createDiagnosticToolTipString(m_diagnostic); + default: return QVariant(); + } +} - const int row = index.row(); - if (row < 0 || row >= m_diagnostics.size()) +ExplainingStepItem::ExplainingStepItem(const ExplainingStep &step) : m_step(step) +{ +} + +QVariant ExplainingStepItem::data(int column, int role) const +{ + if (column == Analyzer::DetailedErrorView::LocationColumn) + return locationData(role, m_step.location); + + // DiagnosticColumn + switch (role) { + case Analyzer::DetailedErrorView::FullTextRole: + return fullText(static_cast(parent())->diagnostic()); + case ClangStaticAnalyzerDiagnosticModel::DiagnosticRole: + return QVariant::fromValue(static_cast(parent())->diagnostic()); + case Qt::DisplayRole: { + const int row = parent()->children().indexOf(const_cast(this)) + 1; + const int padding = static_cast(std::log10(parent()->rowCount())) + - static_cast(std::log10(row)); + return QString::fromLatin1("%1%2: %3") + .arg(QString(padding, QLatin1Char(' '))) + .arg(row) + .arg(m_step.message); + } + case Qt::ToolTipRole: + return createExplainingStepToolTipString(m_step); + default: return QVariant(); - - const Diagnostic diagnostic = m_diagnostics.at(row); - - if (role == Qt::DisplayRole) - return QString(QLatin1String("Some specific diagnostic")); // TODO: Remove? - else if (role == Qt::ToolTipRole) - return createDiagnosticToolTipString(diagnostic); - else if (role == Qt::UserRole) - return QVariant::fromValue(diagnostic); - - return QVariant(); + } } @@ -165,7 +321,8 @@ void ClangStaticAnalyzerDiagnosticFilterModel::addSuppressedDiagnostic( bool ClangStaticAnalyzerDiagnosticFilterModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const { - Q_UNUSED(sourceParent); + if (sourceParent.isValid()) + return true; const Diagnostic diag = static_cast(sourceModel()) ->diagnostics().at(sourceRow); foreach (const SuppressedDiagnostic &d, m_suppressedDiagnostics) { diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.h b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.h index 492624627af..0c8ab90b20f 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.h @@ -19,12 +19,13 @@ #ifndef CLANGSTATICANALYZERDIAGNOSTICMODEL_H #define CLANGSTATICANALYZERDIAGNOSTICMODEL_H -#include "clangstaticanalyzerlogfilereader.h" +#include "clangstaticanalyzerdiagnostic.h" #include "clangstaticanalyzerprojectsettings.h" +#include #include +#include -#include #include #include @@ -33,7 +34,7 @@ namespace ProjectExplorer { class Project; } namespace ClangStaticAnalyzer { namespace Internal { -class ClangStaticAnalyzerDiagnosticModel : public QAbstractListModel +class ClangStaticAnalyzerDiagnosticModel : public Utils::TreeModel { Q_OBJECT @@ -41,15 +42,11 @@ public: ClangStaticAnalyzerDiagnosticModel(QObject *parent = 0); void addDiagnostics(const QList &diagnostics); - QList diagnostics() const { return m_diagnostics; } - void clear(); + QList diagnostics() const; - // QAbstractListModel interface - int rowCount(const QModelIndex &parent = QModelIndex()) const; - QVariant data(const QModelIndex &index, int role) const; - -private: - QList m_diagnostics; + enum ItemRole { + DiagnosticRole = Analyzer::DetailedErrorView::FullTextRole + 1 + }; }; class ClangStaticAnalyzerDiagnosticFilterModel : public QSortFilterProxyModel diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.cpp index a4c3fd66e32..c4665997661 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.cpp @@ -18,7 +18,6 @@ #include "clangstaticanalyzerdiagnosticview.h" -#include "clangstaticanalyzerlogfilereader.h" #include "clangstaticanalyzerdiagnosticmodel.h" #include "clangstaticanalyzerprojectsettings.h" #include "clangstaticanalyzerprojectsettingsmanager.h" @@ -28,266 +27,27 @@ #include #include -#include #include -#include -#include -#include using namespace Analyzer; -namespace { - -QLabel *createCommonLabel() -{ - QLabel *label = new QLabel; - label->setWordWrap(true); - label->setContentsMargins(0, 0, 0, 0); - label->setMargin(0); - label->setIndent(10); - return label; -} - -QString createSummaryText(const ClangStaticAnalyzer::Internal::Diagnostic &diagnostic, - const QPalette &palette) -{ - const QColor color = palette.color(QPalette::Text); - const QString linkStyle = QString::fromLatin1("style=\"color:rgba(%1, %2, %3, %4);\"") - .arg(color.red()) - .arg(color.green()) - .arg(color.blue()) - .arg(int(0.7 * 255)); - const QString fileName = QFileInfo(diagnostic.location.filePath).fileName(); - const QString location = fileName + QLatin1Char(' ') - + QString::number(diagnostic.location.line); - return QString::fromLatin1("%1  %2") - .arg(diagnostic.description.toHtmlEscaped(), - location, - linkStyle); -} - -QLabel *createSummaryLabel(const ClangStaticAnalyzer::Internal::Diagnostic &diagnostic) -{ - QLabel *label = createCommonLabel(); - QPalette palette = label->palette(); - palette.setBrush(QPalette::Text, palette.highlightedText()); - label->setPalette(palette); - label->setText(createSummaryText(diagnostic, palette)); - return label; -} - -QLabel *createExplainingStepLabel(const QFont &font, bool useAlternateRowPalette) -{ - QLabel *label = createCommonLabel(); - - // Font - QFont fixedPitchFont = font; - fixedPitchFont.setFixedPitch(true); - label->setFont(fixedPitchFont); - - // Background - label->setAutoFillBackground(true); - if (useAlternateRowPalette) { - QPalette p = label->palette(); - p.setBrush(QPalette::Base, p.alternateBase()); - label->setPalette(p); - } - - return label; -} - -QString createLocationString(const ClangStaticAnalyzer::Internal::Location &location, - bool withMarkup, bool withAbsolutePath) -{ - const QString filePath = location.filePath; - const QString lineNumber = QString::number(location.line); - const QString columnNumber = QString::number(location.column - 1); - const QString fileAndLine = (withAbsolutePath ? filePath : QFileInfo(filePath).fileName()) - + QLatin1Char(':') + lineNumber; - - if (withMarkup) { - return QLatin1String("in ") - + fileAndLine - + QLatin1String(""); - } else { - return QLatin1String("in ") + fileAndLine; - } -} - -QString createExplainingStepNumberString(int number, bool withMarkup) -{ - const int fieldWidth = 2; - const QString result = QString::fromLatin1("%1:").arg(number, fieldWidth); - return withMarkup - ? QLatin1String("") + result + QLatin1String("") - : result; -} - -QString createExplainingStepToolTipString(const ClangStaticAnalyzer::Internal::ExplainingStep &step) -{ - if (step.message == step.extendedMessage) - return createFullLocationString(step.location); - - typedef QPair StringPair; - QList lines; - - if (!step.message.isEmpty()) { - lines << qMakePair( - QCoreApplication::translate("ClangStaticAnalyzer::ExplainingStep", "Message:"), - step.message.toHtmlEscaped()); - } - if (!step.extendedMessage.isEmpty()) { - lines << qMakePair( - QCoreApplication::translate("ClangStaticAnalyzer::ExplainingStep", "Extended Message:"), - step.extendedMessage.toHtmlEscaped()); - } - - lines << qMakePair( - QCoreApplication::translate("ClangStaticAnalyzer::ExplainingStep", "Location:"), - createFullLocationString(step.location)); - - QString html = QLatin1String("" - "" - "\n" - "
"); - - foreach (const StringPair &pair, lines) { - html += QLatin1String("
"); - html += pair.first; - html += QLatin1String("
"); - html += pair.second; - html += QLatin1String("
\n"); - } - html += QLatin1String("
"); - return html; -} - -QString createExplainingStepString( - const ClangStaticAnalyzer::Internal::ExplainingStep &explainingStep, - int number, bool withMarkup, bool withAbsolutePath) -{ - return createExplainingStepNumberString(number, withMarkup) - + QLatin1Char(' ') - + (withMarkup - ? explainingStep.extendedMessage.toHtmlEscaped() - : explainingStep.extendedMessage) - + QLatin1Char(' ') - + createLocationString(explainingStep.location, withMarkup, withAbsolutePath); -} - -} // anonymous namespace - namespace ClangStaticAnalyzer { namespace Internal { -ClangStaticAnalyzerDiagnosticDelegate::ClangStaticAnalyzerDiagnosticDelegate(QListView *parent) - : DetailedErrorDelegate(parent) -{ -} - -DetailedErrorDelegate::SummaryLineInfo ClangStaticAnalyzerDiagnosticDelegate::summaryInfo( - const QModelIndex &index) const -{ - const Diagnostic diagnostic = index.data(Qt::UserRole).value(); - QTC_ASSERT(diagnostic.isValid(), return SummaryLineInfo()); - - DetailedErrorDelegate::SummaryLineInfo info; - info.errorText = diagnostic.description; - info.errorLocation = createLocationString(diagnostic.location, - /*withMarkup=*/ false, - /*withAbsolutePath=*/ false); - return info; -} - -Diagnostic ClangStaticAnalyzerDiagnosticDelegate::getDiagnostic(const QModelIndex &index) const -{ - return index.data(Qt::UserRole).value(); -} - -QWidget *ClangStaticAnalyzerDiagnosticDelegate::createDetailsWidget(const QFont &font, - const QModelIndex &index, - QWidget *parent) const -{ - QWidget *widget = new QWidget(parent); - - const Diagnostic diagnostic = getDiagnostic(index); - if (!diagnostic.isValid()) - return widget; - - QVBoxLayout *layout = new QVBoxLayout; - - // Add summary label - QLabel *summaryLineLabel = createSummaryLabel(diagnostic); - connect(summaryLineLabel, &QLabel::linkActivated, - this, &ClangStaticAnalyzerDiagnosticDelegate::openLinkInEditor); - layout->addWidget(summaryLineLabel); - - // Add labels for explaining steps - int explainingStepNumber = 1; - foreach (const ExplainingStep &explainingStep, diagnostic.explainingSteps) { - const QString text = createExplainingStepString(explainingStep, - explainingStepNumber++, - /*withMarkup=*/ true, - /*withAbsolutePath=*/ false); - QLabel *label = createExplainingStepLabel(font, explainingStepNumber % 2 == 0); - label->setParent(widget); - label->setText(text); - label->setToolTip(createExplainingStepToolTipString(explainingStep)); - connect(label, &QLabel::linkActivated, - this, &ClangStaticAnalyzerDiagnosticDelegate::openLinkInEditor); - layout->addWidget(label); - } - - layout->setContentsMargins(0, 0, 0, 0); - layout->setSpacing(0); - widget->setLayout(layout); - return widget; -} - -QString ClangStaticAnalyzerDiagnosticDelegate::textualRepresentation() const -{ - QTC_ASSERT(m_detailsIndex.isValid(), return QString()); - - const Diagnostic diagnostic = getDiagnostic(m_detailsIndex); - QTC_ASSERT(diagnostic.isValid(), return QString()); - - // Create summary - QString clipboardText = diagnostic.category + QLatin1String(": ") + diagnostic.type; - if (diagnostic.type != diagnostic.description) - clipboardText += QLatin1String(": ") + diagnostic.description; - clipboardText += QLatin1Char('\n'); - - // Create explaining steps - int explainingStepNumber = 1; - foreach (const ExplainingStep &explainingStep, diagnostic.explainingSteps) { - clipboardText += createExplainingStepString(explainingStep, - explainingStepNumber++, - /*withMarkup=*/ false, - /*withAbsolutePath=*/ true) + QLatin1Char('\n'); - } - - clipboardText.chop(1); // Remove \n - return clipboardText; -} - ClangStaticAnalyzerDiagnosticView::ClangStaticAnalyzerDiagnosticView(QWidget *parent) : Analyzer::DetailedErrorView(parent) { - ClangStaticAnalyzerDiagnosticDelegate *delegate - = new ClangStaticAnalyzerDiagnosticDelegate(this); - setItemDelegate(delegate); m_suppressAction = new QAction(tr("Suppress this diagnostic"), this); connect(m_suppressAction, &QAction::triggered, [this](bool) { suppressCurrentDiagnostic(); }); } void ClangStaticAnalyzerDiagnosticView::suppressCurrentDiagnostic() { - const QModelIndexList indexes = selectedIndexes(); + const QModelIndexList indexes = selectionModel()->selectedRows(); QTC_ASSERT(indexes.count() == 1, return); - const Diagnostic diag = static_cast(itemDelegate()) - ->getDiagnostic(indexes.first()); + const Diagnostic diag = model()->data(indexes.first(), + ClangStaticAnalyzerDiagnosticModel::DiagnosticRole) + .value(); QTC_ASSERT(diag.isValid(), return); // If the original project was closed, we work directly on the filter model, otherwise diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.h b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.h index b9b5fa6fc35..0b00ada75c8 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.h @@ -23,7 +23,6 @@ namespace ClangStaticAnalyzer { namespace Internal { -class Diagnostic; class ClangStaticAnalyzerDiagnosticView : public Analyzer::DetailedErrorView { @@ -40,20 +39,6 @@ private: QAction *m_suppressAction; }; -class ClangStaticAnalyzerDiagnosticDelegate : public Analyzer::DetailedErrorDelegate -{ -public: - ClangStaticAnalyzerDiagnosticDelegate(QListView *parent); - - SummaryLineInfo summaryInfo(const QModelIndex &index) const; - Diagnostic getDiagnostic(const QModelIndex &index) const; - -private: - QWidget *createDetailsWidget(const QFont &font, const QModelIndex &index, - QWidget *parent) const; - QString textualRepresentation() const; -}; - } // namespace Internal } // namespace ClangStaticAnalyzer diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerlogfilereader.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerlogfilereader.cpp index 55f7bf0547b..95851ea1c43 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerlogfilereader.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerlogfilereader.cpp @@ -48,8 +48,8 @@ private: void readDiagnosticsDict(); QList readPathArray(); ExplainingStep readPathDict(); - Location readLocationDict(bool elementIsRead = false); - QList readRangesArray(); + Analyzer::DiagnosticLocation readLocationDict(bool elementIsRead = false); + QList readRangesArray(); QString readString(); QStringList readStringArray(); @@ -277,9 +277,9 @@ ExplainingStep ClangStaticAnalyzerLogFileReader::readPathDict() return explainingStep; } -Location ClangStaticAnalyzerLogFileReader::readLocationDict(bool elementIsRead) +Analyzer::DiagnosticLocation ClangStaticAnalyzerLogFileReader::readLocationDict(bool elementIsRead) { - Location location; + Analyzer::DiagnosticLocation location; if (elementIsRead) { QTC_ASSERT(m_xml.isStartElement() && m_xml.name() == QLatin1String("dict"), return location); @@ -310,14 +310,14 @@ Location ClangStaticAnalyzerLogFileReader::readLocationDict(bool elementIsRead) if (lineOk && columnOk && fileIndexOk) { QTC_ASSERT(fileIndex < m_referencedFiles.size(), return location); - location = Location(m_referencedFiles.at(fileIndex), line, column); + location = Analyzer::DiagnosticLocation(m_referencedFiles.at(fileIndex), line, column); } return location; } -QList ClangStaticAnalyzerLogFileReader::readRangesArray() +QList ClangStaticAnalyzerLogFileReader::readRangesArray() { - QList result; + QList result; // It's an array of arrays... QTC_ASSERT(m_xml.readNextStartElement() && m_xml.name() == QLatin1String("array"), diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp index 08ad19f1703..749766b02fe 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp @@ -19,6 +19,7 @@ #include "clangstaticanalyzertool.h" #include "clangstaticanalyzerconstants.h" +#include "clangstaticanalyzerdiagnostic.h" #include "clangstaticanalyzerdiagnosticmodel.h" #include "clangstaticanalyzerdiagnosticview.h" #include "clangstaticanalyzerruncontrol.h" @@ -88,11 +89,10 @@ QWidget *ClangStaticAnalyzerTool::createWidgets() // Diagnostic View // m_diagnosticView = new ClangStaticAnalyzerDiagnosticView; - m_diagnosticView->setObjectName(QLatin1String("ClangStaticAnalyzerIssuesView")); m_diagnosticView->setFrameStyle(QFrame::NoFrame); m_diagnosticView->setAttribute(Qt::WA_MacShowFocusRect, false); - m_diagnosticModel = new ClangStaticAnalyzerDiagnosticModel(m_diagnosticView); - m_diagnosticFilterModel = new ClangStaticAnalyzerDiagnosticFilterModel(m_diagnosticView); + m_diagnosticModel = new ClangStaticAnalyzerDiagnosticModel(this); + m_diagnosticFilterModel = new ClangStaticAnalyzerDiagnosticFilterModel(this); m_diagnosticFilterModel->setSourceModel(m_diagnosticModel); m_diagnosticView->setModel(m_diagnosticFilterModel); m_diagnosticView->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); @@ -302,7 +302,7 @@ void ClangStaticAnalyzerTool::handleStateUpdate() QTC_ASSERT(m_diagnosticModel, return); QTC_ASSERT(m_diagnosticFilterModel, return); - const int issuesFound = m_diagnosticModel->rowCount(); + const int issuesFound = m_diagnosticModel->diagnostics().count(); const int issuesVisible = m_diagnosticFilterModel->rowCount(); m_goBack->setEnabled(issuesVisible > 1); m_goNext->setEnabled(issuesVisible > 1); diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzertool.h b/plugins/clangstaticanalyzer/clangstaticanalyzertool.h index 3cc1ff18659..52585558d3a 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzertool.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzertool.h @@ -72,7 +72,7 @@ private: ClangStaticAnalyzerDiagnosticModel *m_diagnosticModel; ClangStaticAnalyzerDiagnosticFilterModel *m_diagnosticFilterModel; - Analyzer::DetailedErrorView *m_diagnosticView; + ClangStaticAnalyzerDiagnosticView *m_diagnosticView; QAction *m_goBack; QAction *m_goNext; diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerutils.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerutils.cpp index b3ba34da69f..3516af4771e 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerutils.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerutils.cpp @@ -70,7 +70,7 @@ QString clangExecutable(const QString &fileNameOrPath, bool *isValid) return executable; } -QString createFullLocationString(const ClangStaticAnalyzer::Internal::Location &location) +QString createFullLocationString(const Analyzer::DiagnosticLocation &location) { const QString filePath = location.filePath; const QString lineNumber = QString::number(location.line); diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerutils.h b/plugins/clangstaticanalyzer/clangstaticanalyzerutils.h index 9885fc73904..9fda05578e7 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerutils.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerutils.h @@ -27,17 +27,17 @@ QT_BEGIN_NAMESPACE class QString; QT_END_NAMESPACE +namespace Analyzer { class DiagnosticLocation; } + namespace ClangStaticAnalyzer { namespace Internal { -class Location; - bool isClangExecutableUsable(const QString &filePath, QString *errorMessage = 0); QString clangExecutable(const QString &fileNameOrPath, bool *isValid); QString clangExecutableFromSettings(Core::Id toolchainType, bool *isValid); -QString createFullLocationString(const ClangStaticAnalyzer::Internal::Location &location); +QString createFullLocationString(const Analyzer::DiagnosticLocation &location); } // namespace Internal } // namespace ClangStaticAnalyzer diff --git a/plugins/clangstaticanalyzer/tests/clangstaticanalyzerautotest.qbs b/plugins/clangstaticanalyzer/tests/clangstaticanalyzerautotest.qbs index ab51ab2e6fe..88dfcb32a13 100644 --- a/plugins/clangstaticanalyzer/tests/clangstaticanalyzerautotest.qbs +++ b/plugins/clangstaticanalyzer/tests/clangstaticanalyzerautotest.qbs @@ -2,6 +2,7 @@ import qbs QtcAutotest { Depends { name: "Qt.widgets" } + Depends { name: "AnalyzerBase" } Depends { name: "Utils" } property path pluginDir: "../../" diff --git a/plugins/clangstaticanalyzer/tests/clangstaticanalyzerlogfilereader/tst_clangstaticanalyzerlogfilereader.cpp b/plugins/clangstaticanalyzer/tests/clangstaticanalyzerlogfilereader/tst_clangstaticanalyzerlogfilereader.cpp index ebd0e5ab007..e3ef8af7db3 100644 --- a/plugins/clangstaticanalyzer/tests/clangstaticanalyzerlogfilereader/tst_clangstaticanalyzerlogfilereader.cpp +++ b/plugins/clangstaticanalyzer/tests/clangstaticanalyzerlogfilereader/tst_clangstaticanalyzerlogfilereader.cpp @@ -24,38 +24,18 @@ enum { debug = 0 }; -namespace ClangStaticAnalyzer { -namespace Internal { - -static bool operator==(const Location &first, const Location &second) -{ - return first.filePath == second.filePath - && first.line == second.line - && first.column == second.column; -} - -} // namespace Internal -} // namespace ClangStaticAnalyzer - +using namespace Analyzer; using namespace ClangStaticAnalyzer::Internal; namespace { -QDebug operator<<(QDebug dbg, const Location &location) -{ - dbg.nospace() << "Location(" << location.filePath << ", " - << location.line << ", " - << location.column << ')'; - return dbg.space(); -} - QDebug operator<<(QDebug dbg, const ExplainingStep &step) { dbg << '\n' << " ExplainingStep\n" << " location:" << step.location << '\n' << " ranges:\n"; - foreach (const Location &location, step.ranges) + foreach (const DiagnosticLocation &location, step.ranges) dbg << " " << location << '\n'; dbg << " message:" << step.message << '\n' @@ -148,23 +128,23 @@ void ClangStaticAnalyzerLogFileReaderTest::readFileWithDiagnostics() QCOMPARE(d1.type, d1.description); QCOMPARE(d1.issueContextKind, QLatin1String("function")); QCOMPARE(d1.issueContext, QLatin1String("test")); - QCOMPARE(d1.location, Location(commonPath, 36, 3)); + QCOMPARE(d1.location, DiagnosticLocation(commonPath, 36, 3)); QCOMPARE(d1.explainingSteps.size(), 2); const ExplainingStep step1 = d1.explainingSteps.at(0); - QCOMPARE(step1.location, Location(commonPath, 35, 3)); + QCOMPARE(step1.location, DiagnosticLocation(commonPath, 35, 3)); QCOMPARE(step1.ranges.size(), 2); - QCOMPARE(step1.ranges.at(0), Location(commonPath, 35, 3)); - QCOMPARE(step1.ranges.at(1), Location(commonPath, 35, 9)); + QCOMPARE(step1.ranges.at(0), DiagnosticLocation(commonPath, 35, 3)); + QCOMPARE(step1.ranges.at(1), DiagnosticLocation(commonPath, 35, 9)); QCOMPARE(step1.depth, 0); QCOMPARE(step1.message, QLatin1String("Null pointer value stored to 'foo'")); QCOMPARE(step1.extendedMessage, step1.message); const ExplainingStep step2 = d1.explainingSteps.at(1); - QCOMPARE(step2.location, Location(commonPath, 36, 3)); + QCOMPARE(step2.location, DiagnosticLocation(commonPath, 36, 3)); QCOMPARE(step2.ranges.size(), 2); - QCOMPARE(step2.ranges.at(0), Location(commonPath, 36, 3)); - QCOMPARE(step2.ranges.at(1), Location(commonPath, 36, 5)); + QCOMPARE(step2.ranges.at(0), DiagnosticLocation(commonPath, 36, 3)); + QCOMPARE(step2.ranges.at(1), DiagnosticLocation(commonPath, 36, 5)); QCOMPARE(step2.depth, 0); QCOMPARE(step2.message, QLatin1String("Called function pointer is null (null dereference)")); QCOMPARE(step2.extendedMessage, step2.message); diff --git a/plugins/clangstaticanalyzer/tests/tests.pri b/plugins/clangstaticanalyzer/tests/tests.pri index b7cfc9154c8..8975fc8448d 100644 --- a/plugins/clangstaticanalyzer/tests/tests.pri +++ b/plugins/clangstaticanalyzer/tests/tests.pri @@ -1,4 +1,5 @@ QTC_LIB_DEPENDS += utils +QTC_PLUGIN_DEPENDS += analyzerbase isEmpty(IDE_SOURCE_TREE): IDE_SOURCE_TREE=$$(QTC_SOURCE) isEmpty(IDE_BUILD_TREE): IDE_BUILD_TREE=$$(QTC_BUILD) From 7f61eaed02a32b876366e4b740a62901c71bd275 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Thu, 27 Aug 2015 17:31:45 +0200 Subject: [PATCH 101/111] qbs build: Remove workaround for fixed qbs bug. Also remove an outdated comment. Change-Id: Ib4a647b35ef5ad975a71cad35bba8e9d2a748e9c Reviewed-by: Nikolai Kosjar --- 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 beb745f5293..a97cd7f5ac2 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzer.qbs +++ b/plugins/clangstaticanalyzer/clangstaticanalyzer.qbs @@ -8,11 +8,10 @@ QtcCommercialPlugin { Depends { name: "CppTools" } Depends { name: "ExtensionSystem" } Depends { name: "ProjectExplorer" } - Depends { name: "QtcSsh" } // TODO: export + recursive dependencies broken in qbs + Depends { name: "QtcSsh" } Depends { name: "Utils" } Depends { name: "Qt.widgets" } - Depends { name: "Qt.network" } // TODO: See above pluginTestDepends: [ "QbsProjectManager", From e756dfc327469ee43782cf50bb4161f6c72a9647 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Thu, 20 Aug 2015 14:34:10 +0200 Subject: [PATCH 102/111] Adapt to change in Utils::PathChooser. Change-Id: Ib8dc9221bf39f95cfb162310a3b1b7e07399f29b 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 58fa6d0c47a..0dc0ccfab03 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.cpp @@ -65,7 +65,7 @@ ClangStaticAnalyzerConfigWidget::ClangStaticAnalyzerConfigWidget( chooser->setPath(QLatin1String(" ")); chooser->lineEdit()->clear(); } - connect(m_ui->clangExecutableChooser, &Utils::PathChooser::changed, + connect(m_ui->clangExecutableChooser, &Utils::PathChooser::rawPathChanged, [settings](const QString &path) { settings->setClangExecutable(path); }); m_ui->simultaneousProccessesSpinBox->setValue(settings->simultaneousProcesses()); From 17822dad6063fd5c4bdfa6b34b78535b276c6886 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Thu, 5 Nov 2015 11:50:39 +0100 Subject: [PATCH 103/111] Adapt to upstream CompilerOptionsBuilder changes. Change-Id: I4d6340113f044357467ecb3a157e78ad51ef5497 Reviewed-by: Christian Kandeler --- .../clangstaticanalyzerruncontrol.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp index 20ac43d393a..111727746b3 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp @@ -131,7 +131,7 @@ static QString createLanguageOptionMsvc(ProjectFile::Kind fileKind) class ClangStaticAnalyzerOptionsBuilder : public CompilerOptionsBuilder { public: - static QStringList build(const CppTools::ProjectPart::Ptr &projectPart, + static QStringList build(const CppTools::ProjectPart &projectPart, CppTools::ProjectFile::Kind fileKind, unsigned char wordWidth) { @@ -143,7 +143,7 @@ public: // Therefore, prevent the inclusion of the header that references them. Of course, this // will break if code actually requires stuff from there, but that should be the less common // case. - const Core::Id type = projectPart->toolchainType; + const Core::Id type = projectPart.toolchainType; if (type == ProjectExplorer::Constants::MINGW_TOOLCHAIN_TYPEID || type == ProjectExplorer::Constants::GCC_TOOLCHAIN_TYPEID) optionsBuilder.addDefine("#define _X86INTRIN_H_INCLUDED\n"); @@ -162,9 +162,9 @@ public: } private: - ClangStaticAnalyzerOptionsBuilder(const CppTools::ProjectPart::Ptr &projectPart) + ClangStaticAnalyzerOptionsBuilder(const CppTools::ProjectPart &projectPart) : CompilerOptionsBuilder(projectPart) - , m_isMsvcToolchain(m_projectPart->toolchainType == ProjectExplorer::Constants::MSVC_TOOLCHAIN_TYPEID) + , m_isMsvcToolchain(m_projectPart.toolchainType == ProjectExplorer::Constants::MSVC_TOOLCHAIN_TYPEID) { } @@ -240,7 +240,9 @@ static AnalyzeUnits unitsToAnalyzeFromProjectParts(const QList QTC_CHECK(file.kind != ProjectFile::Unclassified); if (ProjectFile::isSource(file.kind)) { const QStringList arguments - = ClangStaticAnalyzerOptionsBuilder::build(projectPart, file.kind, wordWidth); + = ClangStaticAnalyzerOptionsBuilder::build(*projectPart.data(), + file.kind, + wordWidth); unitsToAnalyze << AnalyzeUnit(file.path, arguments); } } From c6a377f834a011f5ec8d32fb59f3207c28fb306d Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Fri, 13 Nov 2015 11:53:12 +0100 Subject: [PATCH 104/111] Sprinkle override over ProjectConfigurations Change-Id: I4470b28184ce67e11ac5921b481db63cc26144c4 Reviewed-by: Nikolai Kosjar --- plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp index 749766b02fe..e53a770a08f 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp @@ -63,7 +63,7 @@ public: } private: - QWidget *createConfigurationWidget() { return 0; } + QWidget *createConfigurationWidget() override { return 0; } }; ClangStaticAnalyzerTool::ClangStaticAnalyzerTool(QObject *parent) From 5b49a1b39b7fa152480ddd55f406cfac4894c839 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Tue, 24 Nov 2015 14:33:54 +0100 Subject: [PATCH 105/111] Use the new Utils::Icon class Change-Id: I936a9cf3906ac23c529b3ee8ba80b4f11b476ada Reviewed-by: Eike Ziller --- plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp index e53a770a08f..caa9f7b6c03 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp @@ -26,6 +26,7 @@ #include #include +#include #include #include #include @@ -130,7 +131,7 @@ QWidget *ClangStaticAnalyzerTool::createWidgets() // Go to previous diagnostic action = new QAction(this); action->setDisabled(true); - action->setIcon(QIcon(QLatin1String(Core::Constants::ICON_PREV))); + action->setIcon(Core::Icons::PREV.icon()); action->setToolTip(tr("Go to previous bug.")); connect(action, &QAction::triggered, m_diagnosticView, &DetailedErrorView::goBack); button = new QToolButton; @@ -141,7 +142,7 @@ QWidget *ClangStaticAnalyzerTool::createWidgets() // Go to next diagnostic action = new QAction(this); action->setDisabled(true); - action->setIcon(QIcon(QLatin1String(Core::Constants::ICON_NEXT))); + action->setIcon(Core::Icons::NEXT.icon()); action->setToolTip(tr("Go to next bug.")); connect(action, &QAction::triggered, m_diagnosticView, &DetailedErrorView::goNext); button = new QToolButton; From 18bd8b8af622bc4a7815732bae7098e9cdb1fafd Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 5 Jan 2016 08:58:01 +0100 Subject: [PATCH 106/111] Adjust after upstream AnalyzerStartParameter changes Change-Id: I92a6dcee0c201905132e069291eb40e6da6da128 Reviewed-by: Nikolai Kosjar --- .../clangstaticanalyzerplugin.cpp | 4 ++-- .../clangstaticanalyzerruncontrol.cpp | 21 ++++++++++++------- .../clangstaticanalyzerruncontrol.h | 9 +++++--- .../clangstaticanalyzerruncontrolfactory.cpp | 9 +------- .../clangstaticanalyzertool.cpp | 7 ++++--- .../clangstaticanalyzertool.h | 3 ++- 6 files changed, 28 insertions(+), 25 deletions(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp index 2fb20ea644c..ea259b019c6 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp @@ -130,8 +130,8 @@ bool ClangStaticAnalyzerPlugin::initializeEnterpriseFeatures(const QStringList & auto widgetCreator = [tool] { return tool->createWidgets(); }; auto runControlCreator = [tool](const AnalyzerStartParameters &sp, - ProjectExplorer::RunConfiguration *runConfiguration) { - return tool->createRunControl(sp, runConfiguration); + ProjectExplorer::RunConfiguration *runConfiguration, Core::Id runMode) { + return tool->createRunControl(sp, runConfiguration, runMode); }; const QString toolTip = tr("Clang Static Analyzer uses the analyzer from the clang project " diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp index 111727746b3..2fd06d881cc 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp @@ -36,6 +36,7 @@ #include #include +#include #include #include #include @@ -57,15 +58,20 @@ namespace Internal { ClangStaticAnalyzerRunControl::ClangStaticAnalyzerRunControl( const Analyzer::AnalyzerStartParameters &startParams, - ProjectExplorer::RunConfiguration *runConfiguration, + RunConfiguration *runConfiguration, + Core::Id runMode, const ProjectInfo &projectInfo) - : AnalyzerRunControl(startParams, runConfiguration) + : AnalyzerRunControl(startParams, runConfiguration, runMode) , m_projectInfo(projectInfo) , m_wordWidth(runConfiguration->abi().wordWidth()) , m_initialFilesToProcessSize(0) , m_filesAnalyzed(0) , m_filesNotAnalyzed(0) { + Target *target = runConfiguration->target(); + BuildConfiguration *buildConfiguration = target->activeBuildConfiguration(); + QTC_ASSERT(buildConfiguration, return); + m_environment = buildConfiguration->environment(); } static void prependWordWidthArgumentIfNotIncluded(QStringList *arguments, unsigned char wordWidth) @@ -347,7 +353,7 @@ bool ClangStaticAnalyzerRunControl::startEngine() m_progress.reportStarted(); // Start process(es) - qCDebug(LOG) << "Environment:" << startParameters().environment; + qCDebug(LOG) << "Environment:" << m_environment; m_runners.clear(); const int parallelRuns = ClangStaticAnalyzerSettings::instance()->simultaneousProcesses(); QTC_ASSERT(parallelRuns >= 1, emit finished(); return false); @@ -406,11 +412,10 @@ ClangStaticAnalyzerRunner *ClangStaticAnalyzerRunControl::createRunner() QTC_ASSERT(!m_clangExecutable.isEmpty(), return 0); QTC_ASSERT(!m_clangLogFileDir.isEmpty(), return 0); - ClangStaticAnalyzerRunner *runner - = new ClangStaticAnalyzerRunner(m_clangExecutable, - m_clangLogFileDir, - startParameters().environment, - this); + auto runner = new ClangStaticAnalyzerRunner(m_clangExecutable, + m_clangLogFileDir, + m_environment, + this); connect(runner, &ClangStaticAnalyzerRunner::finishedWithSuccess, this, &ClangStaticAnalyzerRunControl::onRunnerFinishedWithSuccess); connect(runner, &ClangStaticAnalyzerRunner::finishedWithFailure, diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h index 0bffb4d7881..b5baafb4b7b 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h @@ -21,6 +21,7 @@ #include #include +#include #include #include @@ -45,9 +46,10 @@ class ClangStaticAnalyzerRunControl : public Analyzer::AnalyzerRunControl Q_OBJECT public: - explicit ClangStaticAnalyzerRunControl(const Analyzer::AnalyzerStartParameters &startParams, - ProjectExplorer::RunConfiguration *runConfiguration, - const CppTools::ProjectInfo &projectInfo); + ClangStaticAnalyzerRunControl(const Analyzer::AnalyzerStartParameters &startParams, + ProjectExplorer::RunConfiguration *runConfiguration, + Core::Id runMode, + const CppTools::ProjectInfo &projectInfo); bool startEngine(); void stopEngine(); @@ -75,6 +77,7 @@ private: const CppTools::ProjectInfo m_projectInfo; const unsigned char m_wordWidth; + Utils::Environment m_environment; QString m_clangExecutable; QString m_clangLogFileDir; QFutureInterface m_progress; diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp index 95bc9e628a0..a61dcbe2734 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp @@ -109,14 +109,7 @@ RunControl *ClangStaticAnalyzerRunControlFactory::create(RunConfiguration *runCo return 0; } - AnalyzerStartParameters sp; - sp.displayName = runConfiguration->displayName(); - sp.runMode = runMode; - BuildConfiguration * const buildConfiguration = target->activeBuildConfiguration(); - QTC_ASSERT(buildConfiguration, return 0); - sp.environment = buildConfiguration->environment(); - - return AnalyzerManager::createRunControl(sp, runConfiguration); + return AnalyzerManager::createRunControl(AnalyzerStartParameters(), runConfiguration, runMode); } } // namespace Internal diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp index caa9f7b6c03..1b2bdcad381 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp @@ -160,7 +160,8 @@ QWidget *ClangStaticAnalyzerTool::createWidgets() AnalyzerRunControl *ClangStaticAnalyzerTool::createRunControl( const AnalyzerStartParameters &sp, - ProjectExplorer::RunConfiguration *runConfiguration) + RunConfiguration *runConfiguration, + Core::Id runMode) { QTC_ASSERT(runConfiguration, return 0); QTC_ASSERT(m_projectInfoBeforeBuild.isValid(), return 0); @@ -176,8 +177,8 @@ AnalyzerRunControl *ClangStaticAnalyzerTool::createRunControl( return 0); m_projectInfoBeforeBuild = CppTools::ProjectInfo(); - ClangStaticAnalyzerRunControl *engine - = new ClangStaticAnalyzerRunControl(sp, runConfiguration, projectInfoAfterBuild); + auto engine = new ClangStaticAnalyzerRunControl(sp, runConfiguration, runMode, + projectInfoAfterBuild); connect(engine, &ClangStaticAnalyzerRunControl::starting, this, &ClangStaticAnalyzerTool::onEngineIsStarting); connect(engine, &ClangStaticAnalyzerRunControl::newDiagnosticsAvailable, diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzertool.h b/plugins/clangstaticanalyzer/clangstaticanalyzertool.h index 52585558d3a..e9000fa78b1 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzertool.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzertool.h @@ -53,7 +53,8 @@ public: QWidget *createWidgets(); Analyzer::AnalyzerRunControl *createRunControl(const Analyzer::AnalyzerStartParameters &sp, - ProjectExplorer::RunConfiguration *runConfiguration); + ProjectExplorer::RunConfiguration *runConfiguration, + Core::Id runMode); void startTool(); signals: From 5fa9e4272565dc0f89fa418a5b0b23871f65e708 Mon Sep 17 00:00:00 2001 From: Marco Bubke Date: Wed, 13 Jan 2016 12:11:07 +0100 Subject: [PATCH 107/111] Adapt to removal of cpptools/cppprojects.h Change-Id: I914700271f28f3fdef9c7f30ed7cb2fc65d4d39e Reviewed-by: Nikolai Kosjar --- plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp | 4 +++- plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h | 2 +- .../clangstaticanalyzerruncontrolfactory.cpp | 1 - plugins/clangstaticanalyzer/clangstaticanalyzertool.h | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp index 2fd06d881cc..1d882a9255b 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp @@ -31,9 +31,10 @@ #include #include +#include #include -#include #include +#include #include #include @@ -42,6 +43,7 @@ #include #include #include +#include #include diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h index b5baafb4b7b..4322324b488 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h @@ -20,7 +20,7 @@ #define CLANGSTATICANALYZERRUNCONTROL_H #include -#include +#include #include #include diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp index a61dcbe2734..9674579aa4c 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp @@ -27,7 +27,6 @@ #include #include -#include #include #include diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzertool.h b/plugins/clangstaticanalyzer/clangstaticanalyzertool.h index e9000fa78b1..7bb4b1cbe7c 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzertool.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzertool.h @@ -20,7 +20,7 @@ #define CLANGSTATICANALYZERTOOL_H #include -#include +#include #include From 4dba05a94cc39d67995bef775e3122ee336cc827 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Thu, 14 Jan 2016 10:59:10 +0100 Subject: [PATCH 108/111] Update license: Add "GPLv3 with exceptions" Change-Id: I2567bec6384497994f4c1a996e98a8d4ed6d3452 Reviewed-by: Eike Ziller --- .../ClangStaticAnalyzer.json.in | 8 ++++-- .../clangstaticanalyzer_global.h | 25 +++++++++++------- .../clangstaticanalyzerconfigwidget.cpp | 25 +++++++++++------- .../clangstaticanalyzerconfigwidget.h | 25 +++++++++++------- .../clangstaticanalyzerconstants.h | 25 +++++++++++------- .../clangstaticanalyzerdiagnostic.cpp | 25 +++++++++++------- .../clangstaticanalyzerdiagnostic.h | 25 +++++++++++------- .../clangstaticanalyzerdiagnosticmodel.cpp | 25 +++++++++++------- .../clangstaticanalyzerdiagnosticmodel.h | 25 +++++++++++------- .../clangstaticanalyzerdiagnosticview.cpp | 25 +++++++++++------- .../clangstaticanalyzerdiagnosticview.h | 25 +++++++++++------- .../clangstaticanalyzerlicensecheck.h | 25 +++++++++++------- .../clangstaticanalyzerlogfilereader.cpp | 25 +++++++++++------- .../clangstaticanalyzerlogfilereader.h | 25 +++++++++++------- .../clangstaticanalyzerplugin.cpp | 25 +++++++++++------- .../clangstaticanalyzerplugin.h | 25 +++++++++++------- .../clangstaticanalyzerprojectsettings.cpp | 25 +++++++++++------- .../clangstaticanalyzerprojectsettings.h | 26 ++++++++++++------- ...ngstaticanalyzerprojectsettingsmanager.cpp | 25 +++++++++++------- ...langstaticanalyzerprojectsettingsmanager.h | 25 +++++++++++------- ...angstaticanalyzerprojectsettingswidget.cpp | 25 +++++++++++------- ...clangstaticanalyzerprojectsettingswidget.h | 25 +++++++++++------- .../clangstaticanalyzerruncontrol.cpp | 25 +++++++++++------- .../clangstaticanalyzerruncontrol.h | 25 +++++++++++------- .../clangstaticanalyzerruncontrolfactory.cpp | 25 +++++++++++------- .../clangstaticanalyzerruncontrolfactory.h | 25 +++++++++++------- .../clangstaticanalyzerrunner.cpp | 25 +++++++++++------- .../clangstaticanalyzerrunner.h | 25 +++++++++++------- .../clangstaticanalyzersettings.cpp | 25 +++++++++++------- .../clangstaticanalyzersettings.h | 25 +++++++++++------- .../clangstaticanalyzertool.cpp | 25 +++++++++++------- .../clangstaticanalyzertool.h | 25 +++++++++++------- .../clangstaticanalyzerunittests.cpp | 25 +++++++++++------- .../clangstaticanalyzerunittests.h | 25 +++++++++++------- .../clangstaticanalyzerutils.cpp | 25 +++++++++++------- .../clangstaticanalyzerutils.h | 25 +++++++++++------- .../tst_clangstaticanalyzerlogfilereader.cpp | 25 +++++++++++------- .../tst_clangstaticanalyzerrunner.cpp | 25 +++++++++++------- 38 files changed, 599 insertions(+), 335 deletions(-) diff --git a/plugins/clangstaticanalyzer/ClangStaticAnalyzer.json.in b/plugins/clangstaticanalyzer/ClangStaticAnalyzer.json.in index fc86ed513b3..8be50b27da5 100644 --- a/plugins/clangstaticanalyzer/ClangStaticAnalyzer.json.in +++ b/plugins/clangstaticanalyzer/ClangStaticAnalyzer.json.in @@ -3,10 +3,14 @@ \"Version\" : \"$$QTCREATOR_VERSION\", \"CompatVersion\" : \"$$QTCREATOR_COMPAT_VERSION\", \"Vendor\" : \"The Qt Company Ltd\", - \"Copyright\" : \"(C) 2015 The Qt Company Ltd\", + \"Copyright\" : \"(C) 2016 The Qt Company Ltd\", \"License\" : [ \"Commercial Usage\", \"\", - \"Licensees holding valid Qt Commercial licenses may use this plugin in accordance with the Qt Commercial License Agreement provided with the Software or, alternatively, in accordance with the terms contained in a written agreement between you and The Qt Company.\" + \"Licensees holding valid commercial Qt licenses may use this file in accordance with the commercial license agreement provided with the Software or, alternatively, in accordance with the terms contained in a written agreement between you and The Qt Company. For licensing terms and conditions see https://www.qt.io/terms-conditions. For further information use the contact form at https://www.qt.io/contact-us.\", + \"\", + \"GNU General Public License Usage\", + \"\", + \"Alternatively, this file may be used under the terms of the GNU General Public License version 3 as published by the Free Software Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT included in the packaging of this file. Please review the following information to ensure the GNU General Public License requirements will be met: https://www.gnu.org/licenses/gpl-3.0.html.\" ], \"Category\" : \"Code Analyzer\", \"Description\" : \"ClangStaticAnalyzer Plugin.\", diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzer_global.h b/plugins/clangstaticanalyzer/clangstaticanalyzer_global.h index 46bb4566ff0..39fb5239765 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzer_global.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzer_global.h @@ -1,18 +1,25 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd -** All rights reserved. -** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on. +** This file is part of Qt Creator. ** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** If you have questions regarding the use of this file, please use -** contact form at http://www.qt.io/contact-us +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ****************************************************************************/ diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.cpp index 0dc0ccfab03..0ffe9ca8c27 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.cpp @@ -1,18 +1,25 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd -** All rights reserved. -** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on. +** This file is part of Qt Creator. ** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** If you have questions regarding the use of this file, please use -** contact form at http://www.qt.io/contact-us +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ****************************************************************************/ diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.h b/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.h index 4f55be8f4ed..4655a07eec8 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.h @@ -1,18 +1,25 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd -** All rights reserved. -** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on. +** This file is part of Qt Creator. ** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** If you have questions regarding the use of this file, please use -** contact form at http://www.qt.io/contact-us +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ****************************************************************************/ diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerconstants.h b/plugins/clangstaticanalyzer/clangstaticanalyzerconstants.h index bc696b5b9df..66b1f149fe8 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerconstants.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerconstants.h @@ -1,18 +1,25 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd -** All rights reserved. -** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on. +** This file is part of Qt Creator. ** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** If you have questions regarding the use of this file, please use -** contact form at http://www.qt.io/contact-us +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ****************************************************************************/ diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnostic.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnostic.cpp index 4e5f20a6bf6..173e5ee5964 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnostic.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnostic.cpp @@ -1,18 +1,25 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd -** All rights reserved. -** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on. +** This file is part of Qt Creator. ** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** If you have questions regarding the use of this file, please use -** contact form at http://www.qt.io/contact-us +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ****************************************************************************/ diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnostic.h b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnostic.h index fe744a555bb..6da02dfaa97 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnostic.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnostic.h @@ -1,18 +1,25 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd -** All rights reserved. -** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on. +** This file is part of Qt Creator. ** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** If you have questions regarding the use of this file, please use -** contact form at http://www.qt.io/contact-us +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ****************************************************************************/ diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.cpp index c96e9c75287..fa0625891a3 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.cpp @@ -1,18 +1,25 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd -** All rights reserved. -** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on. +** This file is part of Qt Creator. ** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** If you have questions regarding the use of this file, please use -** contact form at http://www.qt.io/contact-us +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ****************************************************************************/ diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.h b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.h index 0c8ab90b20f..9c93fb9f779 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.h @@ -1,18 +1,25 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd -** All rights reserved. -** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on. +** This file is part of Qt Creator. ** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** If you have questions regarding the use of this file, please use -** contact form at http://www.qt.io/contact-us +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ****************************************************************************/ diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.cpp index c4665997661..69fb87a3bb5 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.cpp @@ -1,18 +1,25 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd -** All rights reserved. -** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on. +** This file is part of Qt Creator. ** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** If you have questions regarding the use of this file, please use -** contact form at http://www.qt.io/contact-us +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ****************************************************************************/ diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.h b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.h index 0b00ada75c8..392294fd861 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.h @@ -1,18 +1,25 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd -** All rights reserved. -** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on. +** This file is part of Qt Creator. ** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** If you have questions regarding the use of this file, please use -** contact form at http://www.qt.io/contact-us +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ****************************************************************************/ diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerlicensecheck.h b/plugins/clangstaticanalyzer/clangstaticanalyzerlicensecheck.h index 13a303207c2..94cf2f3b3fa 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerlicensecheck.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerlicensecheck.h @@ -1,18 +1,25 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd -** All rights reserved. -** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on. +** This file is part of Qt Creator. ** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** If you have questions regarding the use of this file, please use -** contact form at http://www.qt.io/contact-us +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ****************************************************************************/ diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerlogfilereader.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerlogfilereader.cpp index 95851ea1c43..dd0727864fc 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerlogfilereader.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerlogfilereader.cpp @@ -1,18 +1,25 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd -** All rights reserved. -** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on. +** This file is part of Qt Creator. ** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** If you have questions regarding the use of this file, please use -** contact form at http://www.qt.io/contact-us +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ****************************************************************************/ diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerlogfilereader.h b/plugins/clangstaticanalyzer/clangstaticanalyzerlogfilereader.h index f9d89d6a4b8..8b05ada7aa3 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerlogfilereader.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerlogfilereader.h @@ -1,18 +1,25 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd -** All rights reserved. -** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on. +** This file is part of Qt Creator. ** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** If you have questions regarding the use of this file, please use -** contact form at http://www.qt.io/contact-us +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ****************************************************************************/ diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp index ea259b019c6..96c08007836 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp @@ -1,18 +1,25 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd -** All rights reserved. -** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on. +** This file is part of Qt Creator. ** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** If you have questions regarding the use of this file, please use -** contact form at http://www.qt.io/contact-us +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ****************************************************************************/ diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.h b/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.h index fca517e55e0..b663a164877 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.h @@ -1,18 +1,25 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd -** All rights reserved. -** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on. +** This file is part of Qt Creator. ** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** If you have questions regarding the use of this file, please use -** contact form at http://www.qt.io/contact-us +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ****************************************************************************/ diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettings.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettings.cpp index b5a57b4410a..4d37154c858 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettings.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettings.cpp @@ -1,18 +1,25 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd -** All rights reserved. -** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on. +** This file is part of Qt Creator. ** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** If you have questions regarding the use of this file, please use -** contact form at http://www.qt.io/contact-us +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ****************************************************************************/ diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettings.h b/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettings.h index a5d54f5ef76..f30298b69f6 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettings.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettings.h @@ -1,20 +1,28 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd -** All rights reserved. -** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on. +** This file is part of Qt Creator. ** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** If you have questions regarding the use of this file, please use -** contact form at http://www.qt.io/contact-us +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ****************************************************************************/ + #ifndef CLANGSTATICANALYZERPROJECTSETTINGS_H #define CLANGSTATICANALYZERPROJECTSETTINGS_H diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingsmanager.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingsmanager.cpp index 2040ac8293c..c0b456345b6 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingsmanager.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingsmanager.cpp @@ -1,18 +1,25 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd -** All rights reserved. -** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on. +** This file is part of Qt Creator. ** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** If you have questions regarding the use of this file, please use -** contact form at http://www.qt.io/contact-us +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ****************************************************************************/ diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingsmanager.h b/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingsmanager.h index 9baa41a00f6..a588a7824d7 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingsmanager.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingsmanager.h @@ -1,18 +1,25 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd -** All rights reserved. -** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on. +** This file is part of Qt Creator. ** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** If you have questions regarding the use of this file, please use -** contact form at http://www.qt.io/contact-us +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ****************************************************************************/ diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingswidget.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingswidget.cpp index 387b9361434..3ec14f7d291 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingswidget.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingswidget.cpp @@ -1,18 +1,25 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd -** All rights reserved. -** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on. +** This file is part of Qt Creator. ** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** If you have questions regarding the use of this file, please use -** contact form at http://www.qt.io/contact-us +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ****************************************************************************/ diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingswidget.h b/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingswidget.h index c83fc0ce4ca..b68003b25c5 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingswidget.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingswidget.h @@ -1,18 +1,25 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd -** All rights reserved. -** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on. +** This file is part of Qt Creator. ** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** If you have questions regarding the use of this file, please use -** contact form at http://www.qt.io/contact-us +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ****************************************************************************/ diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp index 1d882a9255b..1d329109dd9 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp @@ -1,18 +1,25 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd -** All rights reserved. -** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on. +** This file is part of Qt Creator. ** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** If you have questions regarding the use of this file, please use -** contact form at http://www.qt.io/contact-us +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ****************************************************************************/ diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h index 4322324b488..fae23663bbe 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h @@ -1,18 +1,25 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd -** All rights reserved. -** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on. +** This file is part of Qt Creator. ** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** If you have questions regarding the use of this file, please use -** contact form at http://www.qt.io/contact-us +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ****************************************************************************/ diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp index 9674579aa4c..43b171d4e82 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp @@ -1,18 +1,25 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd -** All rights reserved. -** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on. +** This file is part of Qt Creator. ** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** If you have questions regarding the use of this file, please use -** contact form at http://www.qt.io/contact-us +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ****************************************************************************/ diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.h b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.h index 68eb68e3cb4..6f9e5fc81cd 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.h @@ -1,18 +1,25 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd -** All rights reserved. -** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on. +** This file is part of Qt Creator. ** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** If you have questions regarding the use of this file, please use -** contact form at http://www.qt.io/contact-us +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ****************************************************************************/ diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.cpp index 98eba1cacdc..00e0672d3b4 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.cpp @@ -1,18 +1,25 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd -** All rights reserved. -** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on. +** This file is part of Qt Creator. ** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** If you have questions regarding the use of this file, please use -** contact form at http://www.qt.io/contact-us +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ****************************************************************************/ diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.h b/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.h index 6379ce8a3fb..92852d34c2c 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.h @@ -1,18 +1,25 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd -** All rights reserved. -** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on. +** This file is part of Qt Creator. ** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** If you have questions regarding the use of this file, please use -** contact form at http://www.qt.io/contact-us +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ****************************************************************************/ diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzersettings.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzersettings.cpp index 3ab12ef958d..803cbb02f09 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzersettings.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzersettings.cpp @@ -1,18 +1,25 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd -** All rights reserved. -** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on. +** This file is part of Qt Creator. ** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** If you have questions regarding the use of this file, please use -** contact form at http://www.qt.io/contact-us +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ****************************************************************************/ diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzersettings.h b/plugins/clangstaticanalyzer/clangstaticanalyzersettings.h index c4b97947363..5f7d80a01fb 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzersettings.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzersettings.h @@ -1,18 +1,25 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd -** All rights reserved. -** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on. +** This file is part of Qt Creator. ** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** If you have questions regarding the use of this file, please use -** contact form at http://www.qt.io/contact-us +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ****************************************************************************/ diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp index 1b2bdcad381..b1162316f9b 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp @@ -1,18 +1,25 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd -** All rights reserved. -** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on. +** This file is part of Qt Creator. ** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** If you have questions regarding the use of this file, please use -** contact form at http://www.qt.io/contact-us +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ****************************************************************************/ diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzertool.h b/plugins/clangstaticanalyzer/clangstaticanalyzertool.h index 7bb4b1cbe7c..d60c04d393c 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzertool.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzertool.h @@ -1,18 +1,25 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd -** All rights reserved. -** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on. +** This file is part of Qt Creator. ** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** If you have questions regarding the use of this file, please use -** contact form at http://www.qt.io/contact-us +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ****************************************************************************/ diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.cpp index 65873400ab2..12acb811a62 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.cpp @@ -1,18 +1,25 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on. +** This file is part of Qt Creator. ** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ****************************************************************************/ diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.h b/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.h index cd63b51d842..b49ef5b1d30 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.h @@ -1,18 +1,25 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on. +** This file is part of Qt Creator. ** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ****************************************************************************/ diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerutils.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerutils.cpp index 3516af4771e..1c7af5176ba 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerutils.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerutils.cpp @@ -1,18 +1,25 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd -** All rights reserved. -** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on. +** This file is part of Qt Creator. ** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** If you have questions regarding the use of this file, please use -** contact form at http://www.qt.io/contact-us +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ****************************************************************************/ diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerutils.h b/plugins/clangstaticanalyzer/clangstaticanalyzerutils.h index 9fda05578e7..63f6f6517f9 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerutils.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerutils.h @@ -1,18 +1,25 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd -** All rights reserved. -** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on. +** This file is part of Qt Creator. ** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** If you have questions regarding the use of this file, please use -** contact form at http://www.qt.io/contact-us +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ****************************************************************************/ diff --git a/plugins/clangstaticanalyzer/tests/clangstaticanalyzerlogfilereader/tst_clangstaticanalyzerlogfilereader.cpp b/plugins/clangstaticanalyzer/tests/clangstaticanalyzerlogfilereader/tst_clangstaticanalyzerlogfilereader.cpp index e3ef8af7db3..e8050c514ed 100644 --- a/plugins/clangstaticanalyzer/tests/clangstaticanalyzerlogfilereader/tst_clangstaticanalyzerlogfilereader.cpp +++ b/plugins/clangstaticanalyzer/tests/clangstaticanalyzerlogfilereader/tst_clangstaticanalyzerlogfilereader.cpp @@ -1,18 +1,25 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd -** All rights reserved. -** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on. +** This file is part of Qt Creator. ** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** If you have questions regarding the use of this file, please use -** contact form at http://www.qt.io/contact-us +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ****************************************************************************/ diff --git a/plugins/clangstaticanalyzer/tests/clangstaticanalyzerrunner/tst_clangstaticanalyzerrunner.cpp b/plugins/clangstaticanalyzer/tests/clangstaticanalyzerrunner/tst_clangstaticanalyzerrunner.cpp index 95bab274b8c..712875c3291 100644 --- a/plugins/clangstaticanalyzer/tests/clangstaticanalyzerrunner/tst_clangstaticanalyzerrunner.cpp +++ b/plugins/clangstaticanalyzer/tests/clangstaticanalyzerrunner/tst_clangstaticanalyzerrunner.cpp @@ -1,18 +1,25 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd -** All rights reserved. -** For any questions to The Qt Company, please use contact form at http://www.qt.io/contact-us +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** -** This file is part of the Qt Enterprise ClangStaticAnalyzer Add-on. +** This file is part of Qt Creator. ** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** If you have questions regarding the use of this file, please use -** contact form at http://www.qt.io/contact-us +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ****************************************************************************/ From e775ff3049fb7433ac97cb687b0ebfa956a8a040 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Thu, 14 Jan 2016 11:23:13 +0100 Subject: [PATCH 109/111] Remove license checker dependency Change-Id: I99fc1ad25adf294409f372c654f2affb872f8957 Reviewed-by: Christian Kandeler Reviewed-by: Oswald Buddenhagen Reviewed-by: Eike Ziller --- .../clangstaticanalyzer.pro | 3 - .../clangstaticanalyzer.qbs | 3 +- .../clangstaticanalyzer_dependencies.pri | 2 - .../clangstaticanalyzerlicensecheck.h | 56 ------------------- .../clangstaticanalyzerplugin.cpp | 4 -- 5 files changed, 1 insertion(+), 67 deletions(-) delete mode 100644 plugins/clangstaticanalyzer/clangstaticanalyzerlicensecheck.h diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzer.pro b/plugins/clangstaticanalyzer/clangstaticanalyzer.pro index 176c3274f18..cdffb1f1d1c 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzer.pro +++ b/plugins/clangstaticanalyzer/clangstaticanalyzer.pro @@ -28,7 +28,6 @@ HEADERS += \ clangstaticanalyzerdiagnosticmodel.h \ clangstaticanalyzerdiagnosticview.h \ clangstaticanalyzer_global.h \ - clangstaticanalyzerlicensecheck.h \ clangstaticanalyzerlogfilereader.h \ clangstaticanalyzerplugin.h \ clangstaticanalyzerprojectsettings.h \ @@ -51,7 +50,5 @@ 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 a97cd7f5ac2..2562b46b3c1 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzer.qbs +++ b/plugins/clangstaticanalyzer/clangstaticanalyzer.qbs @@ -1,6 +1,6 @@ import qbs -QtcCommercialPlugin { +QtcPlugin { name: "ClangStaticAnalyzer" Depends { name: "AnalyzerBase" } @@ -29,7 +29,6 @@ QtcCommercialPlugin { "clangstaticanalyzerdiagnosticmodel.h", "clangstaticanalyzerdiagnosticview.cpp", "clangstaticanalyzerdiagnosticview.h", - "clangstaticanalyzerlicensecheck.h", "clangstaticanalyzerlogfilereader.cpp", "clangstaticanalyzerlogfilereader.h", "clangstaticanalyzerplugin.cpp", diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzer_dependencies.pri b/plugins/clangstaticanalyzer/clangstaticanalyzer_dependencies.pri index 22a09515c44..b0993923732 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzer_dependencies.pri +++ b/plugins/clangstaticanalyzer/clangstaticanalyzer_dependencies.pri @@ -8,5 +8,3 @@ QTC_PLUGIN_DEPENDS += \ QTC_TEST_DEPENDS += \ qbsprojectmanager \ qmakeprojectmanager - -CONFIG(licensechecker): QTC_PLUGIN_DEPENDS += licensechecker diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerlicensecheck.h b/plugins/clangstaticanalyzer/clangstaticanalyzerlicensecheck.h deleted file mode 100644 index 94cf2f3b3fa..00000000000 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerlicensecheck.h +++ /dev/null @@ -1,56 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#ifndef CLANGSTATICANALYZERLICENSECHECK_H -#define CLANGSTATICANALYZERLICENSECHECK_H - -#ifdef LICENSECHECKER -#include -#include -#endif - -inline bool enterpriseFeaturesAvailable() -{ -#ifdef LICENSECHECKER - LicenseChecker::LicenseCheckerPlugin *licenseChecker - = ExtensionSystem::PluginManager::getObject(); - - if (licenseChecker && licenseChecker->hasValidLicense()) { - if (licenseChecker->enterpriseFeatures()) { - return true; - } else { - qWarning() << "License does not cover enterprise features, " - "disabling Clang Static Analyzer"; - } - } else { - qWarning() << "Invalid license, disabling Clang Static Analyzer"; - } - return false; -#else // LICENSECHECKER - return true; -#endif -} - -#endif // Include guard. diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp index 96c08007836..5d5cec13e14 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp @@ -27,7 +27,6 @@ #include "clangstaticanalyzerconfigwidget.h" #include "clangstaticanalyzerconstants.h" -#include "clangstaticanalyzerlicensecheck.h" #include "clangstaticanalyzerprojectsettingswidget.h" #include "clangstaticanalyzerruncontrolfactory.h" #include "clangstaticanalyzertool.h" @@ -128,9 +127,6 @@ bool ClangStaticAnalyzerPlugin::initializeEnterpriseFeatures(const QStringList & Q_UNUSED(arguments); Q_UNUSED(errorString); - if (!enterpriseFeaturesAvailable()) - return true; - auto tool = m_analyzerTool = new ClangStaticAnalyzerTool(this); addAutoReleasedObject(new ClangStaticAnalyzerRunControlFactory(m_analyzerTool)); addAutoReleasedObject(new ClangStaticAnalyzerOptionsPage); From 1386ff6443ffb186eaf4d896ddc276f5a9630c9d Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 20 Jan 2016 10:55:34 +0100 Subject: [PATCH 110/111] Adapt to upstream analyzer changes Change-Id: I541aeb4de35ec89146721ef017d6a58f0a1911a9 Reviewed-by: Nikolai Kosjar --- .../clangstaticanalyzerplugin.cpp | 6 +++--- .../clangstaticanalyzerruncontrol.cpp | 3 +-- .../clangstaticanalyzerruncontrol.h | 3 +-- .../clangstaticanalyzerruncontrolfactory.cpp | 2 +- .../clangstaticanalyzertool.cpp | 18 ++++++++---------- .../clangstaticanalyzertool.h | 3 +-- 6 files changed, 15 insertions(+), 20 deletions(-) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp index 5d5cec13e14..eb9683e3d42 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp @@ -132,15 +132,15 @@ bool ClangStaticAnalyzerPlugin::initializeEnterpriseFeatures(const QStringList & addAutoReleasedObject(new ClangStaticAnalyzerOptionsPage); auto widgetCreator = [tool] { return tool->createWidgets(); }; - auto runControlCreator = [tool](const AnalyzerStartParameters &sp, + auto runControlCreator = [tool](const AnalyzerStartParameters &, ProjectExplorer::RunConfiguration *runConfiguration, Core::Id runMode) { - return tool->createRunControl(sp, runConfiguration, runMode); + return tool->createRunControl(runConfiguration, runMode); }; const QString toolTip = tr("Clang Static Analyzer uses the analyzer from the clang project " "to find bugs."); - AnalyzerAction *action = new AnalyzerAction(this); + auto action = new AnalyzerAction(this); action->setRunMode(Constants::CLANGSTATICANALYZER_RUN_MODE); action->setToolId(ClangStaticAnalyzerToolId); action->setActionId("ClangStaticAnalyzer"); diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp index 1d329109dd9..35652728c47 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp @@ -66,11 +66,10 @@ namespace ClangStaticAnalyzer { namespace Internal { ClangStaticAnalyzerRunControl::ClangStaticAnalyzerRunControl( - const Analyzer::AnalyzerStartParameters &startParams, RunConfiguration *runConfiguration, Core::Id runMode, const ProjectInfo &projectInfo) - : AnalyzerRunControl(startParams, runConfiguration, runMode) + : AnalyzerRunControl(runConfiguration, runMode) , m_projectInfo(projectInfo) , m_wordWidth(runConfiguration->abi().wordWidth()) , m_initialFilesToProcessSize(0) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h index fae23663bbe..06cbc7ed932 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h @@ -53,8 +53,7 @@ class ClangStaticAnalyzerRunControl : public Analyzer::AnalyzerRunControl Q_OBJECT public: - ClangStaticAnalyzerRunControl(const Analyzer::AnalyzerStartParameters &startParams, - ProjectExplorer::RunConfiguration *runConfiguration, + ClangStaticAnalyzerRunControl(ProjectExplorer::RunConfiguration *runConfiguration, Core::Id runMode, const CppTools::ProjectInfo &projectInfo); diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp index 43b171d4e82..b89ea1cee55 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp @@ -115,7 +115,7 @@ RunControl *ClangStaticAnalyzerRunControlFactory::create(RunConfiguration *runCo return 0; } - return AnalyzerManager::createRunControl(AnalyzerStartParameters(), runConfiguration, runMode); + return AnalyzerManager::createRunControl(runConfiguration, runMode); } } // namespace Internal diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp b/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp index b1162316f9b..9fe109d63d6 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp +++ b/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp @@ -165,10 +165,8 @@ QWidget *ClangStaticAnalyzerTool::createWidgets() return toolbarWidget; } -AnalyzerRunControl *ClangStaticAnalyzerTool::createRunControl( - const AnalyzerStartParameters &sp, - RunConfiguration *runConfiguration, - Core::Id runMode) +AnalyzerRunControl *ClangStaticAnalyzerTool::createRunControl(RunConfiguration *runConfiguration, + Core::Id runMode) { QTC_ASSERT(runConfiguration, return 0); QTC_ASSERT(m_projectInfoBeforeBuild.isValid(), return 0); @@ -184,15 +182,15 @@ AnalyzerRunControl *ClangStaticAnalyzerTool::createRunControl( return 0); m_projectInfoBeforeBuild = CppTools::ProjectInfo(); - auto engine = new ClangStaticAnalyzerRunControl(sp, runConfiguration, runMode, - projectInfoAfterBuild); - connect(engine, &ClangStaticAnalyzerRunControl::starting, + auto runControl = new ClangStaticAnalyzerRunControl(runConfiguration, runMode, + projectInfoAfterBuild); + connect(runControl, &ClangStaticAnalyzerRunControl::starting, this, &ClangStaticAnalyzerTool::onEngineIsStarting); - connect(engine, &ClangStaticAnalyzerRunControl::newDiagnosticsAvailable, + connect(runControl, &ClangStaticAnalyzerRunControl::newDiagnosticsAvailable, this, &ClangStaticAnalyzerTool::onNewDiagnosticsAvailable); - connect(engine, &ClangStaticAnalyzerRunControl::finished, + connect(runControl, &ClangStaticAnalyzerRunControl::finished, this, &ClangStaticAnalyzerTool::onEngineFinished); - return engine; + return runControl; } static bool dontStartAfterHintForDebugMode(Project *project) diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzertool.h b/plugins/clangstaticanalyzer/clangstaticanalyzertool.h index d60c04d393c..e5a748d0cd1 100644 --- a/plugins/clangstaticanalyzer/clangstaticanalyzertool.h +++ b/plugins/clangstaticanalyzer/clangstaticanalyzertool.h @@ -59,8 +59,7 @@ public: QList diagnostics() const; QWidget *createWidgets(); - Analyzer::AnalyzerRunControl *createRunControl(const Analyzer::AnalyzerStartParameters &sp, - ProjectExplorer::RunConfiguration *runConfiguration, + Analyzer::AnalyzerRunControl *createRunControl(ProjectExplorer::RunConfiguration *runConfiguration, Core::Id runMode); void startTool(); From 06e1cc0331ae8cd1aa5834ec238f9d22a7354cdf Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Wed, 20 Jan 2016 14:06:40 +0100 Subject: [PATCH 111/111] Move sources to new location for Qt Creator repository When moving the files within the merge commit, git for some reason does not recognize the files as moved, so we move them before actually doing the merge. Change-Id: I5a8ba6b027734c8ff38a7f2a5dc51a30a0fc17a8 Reviewed-by: Nikolai Kosjar --- .../plugins}/clangstaticanalyzer/ClangStaticAnalyzer.json.in | 0 .../plugins}/clangstaticanalyzer/clangstaticanalyzer.pro | 0 .../plugins}/clangstaticanalyzer/clangstaticanalyzer.qbs | 0 .../clangstaticanalyzer/clangstaticanalyzer_dependencies.pri | 0 .../plugins}/clangstaticanalyzer/clangstaticanalyzer_global.h | 0 .../clangstaticanalyzer/clangstaticanalyzerconfigwidget.cpp | 0 .../clangstaticanalyzer/clangstaticanalyzerconfigwidget.h | 0 .../clangstaticanalyzer/clangstaticanalyzerconfigwidget.ui | 0 .../plugins}/clangstaticanalyzer/clangstaticanalyzerconstants.h | 0 .../clangstaticanalyzer/clangstaticanalyzerdiagnostic.cpp | 0 .../plugins}/clangstaticanalyzer/clangstaticanalyzerdiagnostic.h | 0 .../clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.cpp | 0 .../clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.h | 0 .../clangstaticanalyzer/clangstaticanalyzerdiagnosticview.cpp | 0 .../clangstaticanalyzer/clangstaticanalyzerdiagnosticview.h | 0 .../clangstaticanalyzer/clangstaticanalyzerlogfilereader.cpp | 0 .../clangstaticanalyzer/clangstaticanalyzerlogfilereader.h | 0 .../plugins}/clangstaticanalyzer/clangstaticanalyzerplugin.cpp | 0 .../plugins}/clangstaticanalyzer/clangstaticanalyzerplugin.h | 0 .../clangstaticanalyzer/clangstaticanalyzerprojectsettings.cpp | 0 .../clangstaticanalyzer/clangstaticanalyzerprojectsettings.h | 0 .../clangstaticanalyzerprojectsettingsmanager.cpp | 0 .../clangstaticanalyzerprojectsettingsmanager.h | 0 .../clangstaticanalyzerprojectsettingswidget.cpp | 0 .../clangstaticanalyzerprojectsettingswidget.h | 0 .../clangstaticanalyzerprojectsettingswidget.ui | 0 .../clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp | 0 .../plugins}/clangstaticanalyzer/clangstaticanalyzerruncontrol.h | 0 .../clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp | 0 .../clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.h | 0 .../plugins}/clangstaticanalyzer/clangstaticanalyzerrunner.cpp | 0 .../plugins}/clangstaticanalyzer/clangstaticanalyzerrunner.h | 0 .../plugins}/clangstaticanalyzer/clangstaticanalyzersettings.cpp | 0 .../plugins}/clangstaticanalyzer/clangstaticanalyzersettings.h | 0 .../plugins}/clangstaticanalyzer/clangstaticanalyzertool.cpp | 0 .../plugins}/clangstaticanalyzer/clangstaticanalyzertool.h | 0 .../plugins}/clangstaticanalyzer/clangstaticanalyzerunittests.cpp | 0 .../plugins}/clangstaticanalyzer/clangstaticanalyzerunittests.h | 0 .../plugins}/clangstaticanalyzer/clangstaticanalyzerunittests.qrc | 0 .../plugins}/clangstaticanalyzer/clangstaticanalyzerutils.cpp | 0 .../plugins}/clangstaticanalyzer/clangstaticanalyzerutils.h | 0 .../clangstaticanalyzer/tests/clangstaticanalyzerautotest.qbs | 0 .../clangstaticanalyzerlogfilereader.pro | 0 .../clangstaticanalyzerlogfilereader.qbs | 0 .../clangstaticanalyzerlogfilereader/data/noDiagnostics.plist | 0 .../clangstaticanalyzerlogfilereader/data/someDiagnostics.plist | 0 .../tst_clangstaticanalyzerlogfilereader.cpp | 0 .../tests/clangstaticanalyzerrunner/clangstaticanalyzerrunner.pro | 0 .../tests/clangstaticanalyzerrunner/clangstaticanalyzerrunner.qbs | 0 .../clangstaticanalyzerrunner/tst_clangstaticanalyzerrunner.cpp | 0 {plugins => src/plugins}/clangstaticanalyzer/tests/tests.pri | 0 {plugins => src/plugins}/clangstaticanalyzer/tests/tests.pro | 0 {plugins => src/plugins}/clangstaticanalyzer/tests/tests.qbs | 0 .../clangstaticanalyzer/unit-tests/qt-widgets-app/main.cpp | 0 .../clangstaticanalyzer/unit-tests/qt-widgets-app/mainwindow.cpp | 0 .../clangstaticanalyzer/unit-tests/qt-widgets-app/mainwindow.h | 0 .../clangstaticanalyzer/unit-tests/qt-widgets-app/mainwindow.ui | 0 .../unit-tests/qt-widgets-app/qt-widgets-app.pro | 0 .../unit-tests/qt-widgets-app/qt-widgets-app.qbs | 0 .../plugins}/clangstaticanalyzer/unit-tests/simple/main.cpp | 0 .../plugins}/clangstaticanalyzer/unit-tests/simple/simple.pro | 0 .../plugins}/clangstaticanalyzer/unit-tests/simple/simple.qbs | 0 62 files changed, 0 insertions(+), 0 deletions(-) rename {plugins => src/plugins}/clangstaticanalyzer/ClangStaticAnalyzer.json.in (100%) rename {plugins => src/plugins}/clangstaticanalyzer/clangstaticanalyzer.pro (100%) rename {plugins => src/plugins}/clangstaticanalyzer/clangstaticanalyzer.qbs (100%) rename {plugins => src/plugins}/clangstaticanalyzer/clangstaticanalyzer_dependencies.pri (100%) rename {plugins => src/plugins}/clangstaticanalyzer/clangstaticanalyzer_global.h (100%) rename {plugins => src/plugins}/clangstaticanalyzer/clangstaticanalyzerconfigwidget.cpp (100%) rename {plugins => src/plugins}/clangstaticanalyzer/clangstaticanalyzerconfigwidget.h (100%) rename {plugins => src/plugins}/clangstaticanalyzer/clangstaticanalyzerconfigwidget.ui (100%) rename {plugins => src/plugins}/clangstaticanalyzer/clangstaticanalyzerconstants.h (100%) rename {plugins => src/plugins}/clangstaticanalyzer/clangstaticanalyzerdiagnostic.cpp (100%) rename {plugins => src/plugins}/clangstaticanalyzer/clangstaticanalyzerdiagnostic.h (100%) rename {plugins => src/plugins}/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.cpp (100%) rename {plugins => src/plugins}/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.h (100%) rename {plugins => src/plugins}/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.cpp (100%) rename {plugins => src/plugins}/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.h (100%) rename {plugins => src/plugins}/clangstaticanalyzer/clangstaticanalyzerlogfilereader.cpp (100%) rename {plugins => src/plugins}/clangstaticanalyzer/clangstaticanalyzerlogfilereader.h (100%) rename {plugins => src/plugins}/clangstaticanalyzer/clangstaticanalyzerplugin.cpp (100%) rename {plugins => src/plugins}/clangstaticanalyzer/clangstaticanalyzerplugin.h (100%) rename {plugins => src/plugins}/clangstaticanalyzer/clangstaticanalyzerprojectsettings.cpp (100%) rename {plugins => src/plugins}/clangstaticanalyzer/clangstaticanalyzerprojectsettings.h (100%) rename {plugins => src/plugins}/clangstaticanalyzer/clangstaticanalyzerprojectsettingsmanager.cpp (100%) rename {plugins => src/plugins}/clangstaticanalyzer/clangstaticanalyzerprojectsettingsmanager.h (100%) rename {plugins => src/plugins}/clangstaticanalyzer/clangstaticanalyzerprojectsettingswidget.cpp (100%) rename {plugins => src/plugins}/clangstaticanalyzer/clangstaticanalyzerprojectsettingswidget.h (100%) rename {plugins => src/plugins}/clangstaticanalyzer/clangstaticanalyzerprojectsettingswidget.ui (100%) rename {plugins => src/plugins}/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp (100%) rename {plugins => src/plugins}/clangstaticanalyzer/clangstaticanalyzerruncontrol.h (100%) rename {plugins => src/plugins}/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp (100%) rename {plugins => src/plugins}/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.h (100%) rename {plugins => src/plugins}/clangstaticanalyzer/clangstaticanalyzerrunner.cpp (100%) rename {plugins => src/plugins}/clangstaticanalyzer/clangstaticanalyzerrunner.h (100%) rename {plugins => src/plugins}/clangstaticanalyzer/clangstaticanalyzersettings.cpp (100%) rename {plugins => src/plugins}/clangstaticanalyzer/clangstaticanalyzersettings.h (100%) rename {plugins => src/plugins}/clangstaticanalyzer/clangstaticanalyzertool.cpp (100%) rename {plugins => src/plugins}/clangstaticanalyzer/clangstaticanalyzertool.h (100%) rename {plugins => src/plugins}/clangstaticanalyzer/clangstaticanalyzerunittests.cpp (100%) rename {plugins => src/plugins}/clangstaticanalyzer/clangstaticanalyzerunittests.h (100%) rename {plugins => src/plugins}/clangstaticanalyzer/clangstaticanalyzerunittests.qrc (100%) rename {plugins => src/plugins}/clangstaticanalyzer/clangstaticanalyzerutils.cpp (100%) rename {plugins => src/plugins}/clangstaticanalyzer/clangstaticanalyzerutils.h (100%) rename {plugins => src/plugins}/clangstaticanalyzer/tests/clangstaticanalyzerautotest.qbs (100%) rename {plugins => src/plugins}/clangstaticanalyzer/tests/clangstaticanalyzerlogfilereader/clangstaticanalyzerlogfilereader.pro (100%) rename {plugins => src/plugins}/clangstaticanalyzer/tests/clangstaticanalyzerlogfilereader/clangstaticanalyzerlogfilereader.qbs (100%) rename {plugins => src/plugins}/clangstaticanalyzer/tests/clangstaticanalyzerlogfilereader/data/noDiagnostics.plist (100%) rename {plugins => src/plugins}/clangstaticanalyzer/tests/clangstaticanalyzerlogfilereader/data/someDiagnostics.plist (100%) rename {plugins => src/plugins}/clangstaticanalyzer/tests/clangstaticanalyzerlogfilereader/tst_clangstaticanalyzerlogfilereader.cpp (100%) rename {plugins => src/plugins}/clangstaticanalyzer/tests/clangstaticanalyzerrunner/clangstaticanalyzerrunner.pro (100%) rename {plugins => src/plugins}/clangstaticanalyzer/tests/clangstaticanalyzerrunner/clangstaticanalyzerrunner.qbs (100%) rename {plugins => src/plugins}/clangstaticanalyzer/tests/clangstaticanalyzerrunner/tst_clangstaticanalyzerrunner.cpp (100%) rename {plugins => src/plugins}/clangstaticanalyzer/tests/tests.pri (100%) rename {plugins => src/plugins}/clangstaticanalyzer/tests/tests.pro (100%) rename {plugins => src/plugins}/clangstaticanalyzer/tests/tests.qbs (100%) rename {plugins => src/plugins}/clangstaticanalyzer/unit-tests/qt-widgets-app/main.cpp (100%) rename {plugins => src/plugins}/clangstaticanalyzer/unit-tests/qt-widgets-app/mainwindow.cpp (100%) rename {plugins => src/plugins}/clangstaticanalyzer/unit-tests/qt-widgets-app/mainwindow.h (100%) rename {plugins => src/plugins}/clangstaticanalyzer/unit-tests/qt-widgets-app/mainwindow.ui (100%) rename {plugins => src/plugins}/clangstaticanalyzer/unit-tests/qt-widgets-app/qt-widgets-app.pro (100%) rename {plugins => src/plugins}/clangstaticanalyzer/unit-tests/qt-widgets-app/qt-widgets-app.qbs (100%) rename {plugins => src/plugins}/clangstaticanalyzer/unit-tests/simple/main.cpp (100%) rename {plugins => src/plugins}/clangstaticanalyzer/unit-tests/simple/simple.pro (100%) rename {plugins => src/plugins}/clangstaticanalyzer/unit-tests/simple/simple.qbs (100%) diff --git a/plugins/clangstaticanalyzer/ClangStaticAnalyzer.json.in b/src/plugins/clangstaticanalyzer/ClangStaticAnalyzer.json.in similarity index 100% rename from plugins/clangstaticanalyzer/ClangStaticAnalyzer.json.in rename to src/plugins/clangstaticanalyzer/ClangStaticAnalyzer.json.in diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzer.pro b/src/plugins/clangstaticanalyzer/clangstaticanalyzer.pro similarity index 100% rename from plugins/clangstaticanalyzer/clangstaticanalyzer.pro rename to src/plugins/clangstaticanalyzer/clangstaticanalyzer.pro diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzer.qbs b/src/plugins/clangstaticanalyzer/clangstaticanalyzer.qbs similarity index 100% rename from plugins/clangstaticanalyzer/clangstaticanalyzer.qbs rename to src/plugins/clangstaticanalyzer/clangstaticanalyzer.qbs diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzer_dependencies.pri b/src/plugins/clangstaticanalyzer/clangstaticanalyzer_dependencies.pri similarity index 100% rename from plugins/clangstaticanalyzer/clangstaticanalyzer_dependencies.pri rename to src/plugins/clangstaticanalyzer/clangstaticanalyzer_dependencies.pri diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzer_global.h b/src/plugins/clangstaticanalyzer/clangstaticanalyzer_global.h similarity index 100% rename from plugins/clangstaticanalyzer/clangstaticanalyzer_global.h rename to src/plugins/clangstaticanalyzer/clangstaticanalyzer_global.h diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.cpp b/src/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.cpp similarity index 100% rename from plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.cpp rename to src/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.cpp diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.h b/src/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.h similarity index 100% rename from plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.h rename to src/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.h diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.ui b/src/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.ui similarity index 100% rename from plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.ui rename to src/plugins/clangstaticanalyzer/clangstaticanalyzerconfigwidget.ui diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerconstants.h b/src/plugins/clangstaticanalyzer/clangstaticanalyzerconstants.h similarity index 100% rename from plugins/clangstaticanalyzer/clangstaticanalyzerconstants.h rename to src/plugins/clangstaticanalyzer/clangstaticanalyzerconstants.h diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnostic.cpp b/src/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnostic.cpp similarity index 100% rename from plugins/clangstaticanalyzer/clangstaticanalyzerdiagnostic.cpp rename to src/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnostic.cpp diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnostic.h b/src/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnostic.h similarity index 100% rename from plugins/clangstaticanalyzer/clangstaticanalyzerdiagnostic.h rename to src/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnostic.h diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.cpp b/src/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.cpp similarity index 100% rename from plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.cpp rename to src/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.cpp diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.h b/src/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.h similarity index 100% rename from plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.h rename to src/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticmodel.h diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.cpp b/src/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.cpp similarity index 100% rename from plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.cpp rename to src/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.cpp diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.h b/src/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.h similarity index 100% rename from plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.h rename to src/plugins/clangstaticanalyzer/clangstaticanalyzerdiagnosticview.h diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerlogfilereader.cpp b/src/plugins/clangstaticanalyzer/clangstaticanalyzerlogfilereader.cpp similarity index 100% rename from plugins/clangstaticanalyzer/clangstaticanalyzerlogfilereader.cpp rename to src/plugins/clangstaticanalyzer/clangstaticanalyzerlogfilereader.cpp diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerlogfilereader.h b/src/plugins/clangstaticanalyzer/clangstaticanalyzerlogfilereader.h similarity index 100% rename from plugins/clangstaticanalyzer/clangstaticanalyzerlogfilereader.h rename to src/plugins/clangstaticanalyzer/clangstaticanalyzerlogfilereader.h diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp b/src/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp similarity index 100% rename from plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp rename to src/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.cpp diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.h b/src/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.h similarity index 100% rename from plugins/clangstaticanalyzer/clangstaticanalyzerplugin.h rename to src/plugins/clangstaticanalyzer/clangstaticanalyzerplugin.h diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettings.cpp b/src/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettings.cpp similarity index 100% rename from plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettings.cpp rename to src/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettings.cpp diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettings.h b/src/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettings.h similarity index 100% rename from plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettings.h rename to src/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettings.h diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingsmanager.cpp b/src/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingsmanager.cpp similarity index 100% rename from plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingsmanager.cpp rename to src/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingsmanager.cpp diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingsmanager.h b/src/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingsmanager.h similarity index 100% rename from plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingsmanager.h rename to src/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingsmanager.h diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingswidget.cpp b/src/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingswidget.cpp similarity index 100% rename from plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingswidget.cpp rename to src/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingswidget.cpp diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingswidget.h b/src/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingswidget.h similarity index 100% rename from plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingswidget.h rename to src/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingswidget.h diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingswidget.ui b/src/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingswidget.ui similarity index 100% rename from plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingswidget.ui rename to src/plugins/clangstaticanalyzer/clangstaticanalyzerprojectsettingswidget.ui diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp b/src/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp similarity index 100% rename from plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp rename to src/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h b/src/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h similarity index 100% rename from plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h rename to src/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.h diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp b/src/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp similarity index 100% rename from plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp rename to src/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.cpp diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.h b/src/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.h similarity index 100% rename from plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.h rename to src/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrolfactory.h diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.cpp b/src/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.cpp similarity index 100% rename from plugins/clangstaticanalyzer/clangstaticanalyzerrunner.cpp rename to src/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.cpp diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.h b/src/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.h similarity index 100% rename from plugins/clangstaticanalyzer/clangstaticanalyzerrunner.h rename to src/plugins/clangstaticanalyzer/clangstaticanalyzerrunner.h diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzersettings.cpp b/src/plugins/clangstaticanalyzer/clangstaticanalyzersettings.cpp similarity index 100% rename from plugins/clangstaticanalyzer/clangstaticanalyzersettings.cpp rename to src/plugins/clangstaticanalyzer/clangstaticanalyzersettings.cpp diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzersettings.h b/src/plugins/clangstaticanalyzer/clangstaticanalyzersettings.h similarity index 100% rename from plugins/clangstaticanalyzer/clangstaticanalyzersettings.h rename to src/plugins/clangstaticanalyzer/clangstaticanalyzersettings.h diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp b/src/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp similarity index 100% rename from plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp rename to src/plugins/clangstaticanalyzer/clangstaticanalyzertool.cpp diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzertool.h b/src/plugins/clangstaticanalyzer/clangstaticanalyzertool.h similarity index 100% rename from plugins/clangstaticanalyzer/clangstaticanalyzertool.h rename to src/plugins/clangstaticanalyzer/clangstaticanalyzertool.h diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.cpp b/src/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.cpp similarity index 100% rename from plugins/clangstaticanalyzer/clangstaticanalyzerunittests.cpp rename to src/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.cpp diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.h b/src/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.h similarity index 100% rename from plugins/clangstaticanalyzer/clangstaticanalyzerunittests.h rename to src/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.h diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.qrc b/src/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.qrc similarity index 100% rename from plugins/clangstaticanalyzer/clangstaticanalyzerunittests.qrc rename to src/plugins/clangstaticanalyzer/clangstaticanalyzerunittests.qrc diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerutils.cpp b/src/plugins/clangstaticanalyzer/clangstaticanalyzerutils.cpp similarity index 100% rename from plugins/clangstaticanalyzer/clangstaticanalyzerutils.cpp rename to src/plugins/clangstaticanalyzer/clangstaticanalyzerutils.cpp diff --git a/plugins/clangstaticanalyzer/clangstaticanalyzerutils.h b/src/plugins/clangstaticanalyzer/clangstaticanalyzerutils.h similarity index 100% rename from plugins/clangstaticanalyzer/clangstaticanalyzerutils.h rename to src/plugins/clangstaticanalyzer/clangstaticanalyzerutils.h diff --git a/plugins/clangstaticanalyzer/tests/clangstaticanalyzerautotest.qbs b/src/plugins/clangstaticanalyzer/tests/clangstaticanalyzerautotest.qbs similarity index 100% rename from plugins/clangstaticanalyzer/tests/clangstaticanalyzerautotest.qbs rename to src/plugins/clangstaticanalyzer/tests/clangstaticanalyzerautotest.qbs diff --git a/plugins/clangstaticanalyzer/tests/clangstaticanalyzerlogfilereader/clangstaticanalyzerlogfilereader.pro b/src/plugins/clangstaticanalyzer/tests/clangstaticanalyzerlogfilereader/clangstaticanalyzerlogfilereader.pro similarity index 100% rename from plugins/clangstaticanalyzer/tests/clangstaticanalyzerlogfilereader/clangstaticanalyzerlogfilereader.pro rename to src/plugins/clangstaticanalyzer/tests/clangstaticanalyzerlogfilereader/clangstaticanalyzerlogfilereader.pro diff --git a/plugins/clangstaticanalyzer/tests/clangstaticanalyzerlogfilereader/clangstaticanalyzerlogfilereader.qbs b/src/plugins/clangstaticanalyzer/tests/clangstaticanalyzerlogfilereader/clangstaticanalyzerlogfilereader.qbs similarity index 100% rename from plugins/clangstaticanalyzer/tests/clangstaticanalyzerlogfilereader/clangstaticanalyzerlogfilereader.qbs rename to src/plugins/clangstaticanalyzer/tests/clangstaticanalyzerlogfilereader/clangstaticanalyzerlogfilereader.qbs diff --git a/plugins/clangstaticanalyzer/tests/clangstaticanalyzerlogfilereader/data/noDiagnostics.plist b/src/plugins/clangstaticanalyzer/tests/clangstaticanalyzerlogfilereader/data/noDiagnostics.plist similarity index 100% rename from plugins/clangstaticanalyzer/tests/clangstaticanalyzerlogfilereader/data/noDiagnostics.plist rename to src/plugins/clangstaticanalyzer/tests/clangstaticanalyzerlogfilereader/data/noDiagnostics.plist diff --git a/plugins/clangstaticanalyzer/tests/clangstaticanalyzerlogfilereader/data/someDiagnostics.plist b/src/plugins/clangstaticanalyzer/tests/clangstaticanalyzerlogfilereader/data/someDiagnostics.plist similarity index 100% rename from plugins/clangstaticanalyzer/tests/clangstaticanalyzerlogfilereader/data/someDiagnostics.plist rename to src/plugins/clangstaticanalyzer/tests/clangstaticanalyzerlogfilereader/data/someDiagnostics.plist diff --git a/plugins/clangstaticanalyzer/tests/clangstaticanalyzerlogfilereader/tst_clangstaticanalyzerlogfilereader.cpp b/src/plugins/clangstaticanalyzer/tests/clangstaticanalyzerlogfilereader/tst_clangstaticanalyzerlogfilereader.cpp similarity index 100% rename from plugins/clangstaticanalyzer/tests/clangstaticanalyzerlogfilereader/tst_clangstaticanalyzerlogfilereader.cpp rename to src/plugins/clangstaticanalyzer/tests/clangstaticanalyzerlogfilereader/tst_clangstaticanalyzerlogfilereader.cpp diff --git a/plugins/clangstaticanalyzer/tests/clangstaticanalyzerrunner/clangstaticanalyzerrunner.pro b/src/plugins/clangstaticanalyzer/tests/clangstaticanalyzerrunner/clangstaticanalyzerrunner.pro similarity index 100% rename from plugins/clangstaticanalyzer/tests/clangstaticanalyzerrunner/clangstaticanalyzerrunner.pro rename to src/plugins/clangstaticanalyzer/tests/clangstaticanalyzerrunner/clangstaticanalyzerrunner.pro diff --git a/plugins/clangstaticanalyzer/tests/clangstaticanalyzerrunner/clangstaticanalyzerrunner.qbs b/src/plugins/clangstaticanalyzer/tests/clangstaticanalyzerrunner/clangstaticanalyzerrunner.qbs similarity index 100% rename from plugins/clangstaticanalyzer/tests/clangstaticanalyzerrunner/clangstaticanalyzerrunner.qbs rename to src/plugins/clangstaticanalyzer/tests/clangstaticanalyzerrunner/clangstaticanalyzerrunner.qbs diff --git a/plugins/clangstaticanalyzer/tests/clangstaticanalyzerrunner/tst_clangstaticanalyzerrunner.cpp b/src/plugins/clangstaticanalyzer/tests/clangstaticanalyzerrunner/tst_clangstaticanalyzerrunner.cpp similarity index 100% rename from plugins/clangstaticanalyzer/tests/clangstaticanalyzerrunner/tst_clangstaticanalyzerrunner.cpp rename to src/plugins/clangstaticanalyzer/tests/clangstaticanalyzerrunner/tst_clangstaticanalyzerrunner.cpp diff --git a/plugins/clangstaticanalyzer/tests/tests.pri b/src/plugins/clangstaticanalyzer/tests/tests.pri similarity index 100% rename from plugins/clangstaticanalyzer/tests/tests.pri rename to src/plugins/clangstaticanalyzer/tests/tests.pri diff --git a/plugins/clangstaticanalyzer/tests/tests.pro b/src/plugins/clangstaticanalyzer/tests/tests.pro similarity index 100% rename from plugins/clangstaticanalyzer/tests/tests.pro rename to src/plugins/clangstaticanalyzer/tests/tests.pro diff --git a/plugins/clangstaticanalyzer/tests/tests.qbs b/src/plugins/clangstaticanalyzer/tests/tests.qbs similarity index 100% rename from plugins/clangstaticanalyzer/tests/tests.qbs rename to src/plugins/clangstaticanalyzer/tests/tests.qbs diff --git a/plugins/clangstaticanalyzer/unit-tests/qt-widgets-app/main.cpp b/src/plugins/clangstaticanalyzer/unit-tests/qt-widgets-app/main.cpp similarity index 100% rename from plugins/clangstaticanalyzer/unit-tests/qt-widgets-app/main.cpp rename to src/plugins/clangstaticanalyzer/unit-tests/qt-widgets-app/main.cpp diff --git a/plugins/clangstaticanalyzer/unit-tests/qt-widgets-app/mainwindow.cpp b/src/plugins/clangstaticanalyzer/unit-tests/qt-widgets-app/mainwindow.cpp similarity index 100% rename from plugins/clangstaticanalyzer/unit-tests/qt-widgets-app/mainwindow.cpp rename to src/plugins/clangstaticanalyzer/unit-tests/qt-widgets-app/mainwindow.cpp diff --git a/plugins/clangstaticanalyzer/unit-tests/qt-widgets-app/mainwindow.h b/src/plugins/clangstaticanalyzer/unit-tests/qt-widgets-app/mainwindow.h similarity index 100% rename from plugins/clangstaticanalyzer/unit-tests/qt-widgets-app/mainwindow.h rename to src/plugins/clangstaticanalyzer/unit-tests/qt-widgets-app/mainwindow.h diff --git a/plugins/clangstaticanalyzer/unit-tests/qt-widgets-app/mainwindow.ui b/src/plugins/clangstaticanalyzer/unit-tests/qt-widgets-app/mainwindow.ui similarity index 100% rename from plugins/clangstaticanalyzer/unit-tests/qt-widgets-app/mainwindow.ui rename to src/plugins/clangstaticanalyzer/unit-tests/qt-widgets-app/mainwindow.ui diff --git a/plugins/clangstaticanalyzer/unit-tests/qt-widgets-app/qt-widgets-app.pro b/src/plugins/clangstaticanalyzer/unit-tests/qt-widgets-app/qt-widgets-app.pro similarity index 100% rename from plugins/clangstaticanalyzer/unit-tests/qt-widgets-app/qt-widgets-app.pro rename to src/plugins/clangstaticanalyzer/unit-tests/qt-widgets-app/qt-widgets-app.pro diff --git a/plugins/clangstaticanalyzer/unit-tests/qt-widgets-app/qt-widgets-app.qbs b/src/plugins/clangstaticanalyzer/unit-tests/qt-widgets-app/qt-widgets-app.qbs similarity index 100% rename from plugins/clangstaticanalyzer/unit-tests/qt-widgets-app/qt-widgets-app.qbs rename to src/plugins/clangstaticanalyzer/unit-tests/qt-widgets-app/qt-widgets-app.qbs diff --git a/plugins/clangstaticanalyzer/unit-tests/simple/main.cpp b/src/plugins/clangstaticanalyzer/unit-tests/simple/main.cpp similarity index 100% rename from plugins/clangstaticanalyzer/unit-tests/simple/main.cpp rename to src/plugins/clangstaticanalyzer/unit-tests/simple/main.cpp diff --git a/plugins/clangstaticanalyzer/unit-tests/simple/simple.pro b/src/plugins/clangstaticanalyzer/unit-tests/simple/simple.pro similarity index 100% rename from plugins/clangstaticanalyzer/unit-tests/simple/simple.pro rename to src/plugins/clangstaticanalyzer/unit-tests/simple/simple.pro diff --git a/plugins/clangstaticanalyzer/unit-tests/simple/simple.qbs b/src/plugins/clangstaticanalyzer/unit-tests/simple/simple.qbs similarity index 100% rename from plugins/clangstaticanalyzer/unit-tests/simple/simple.qbs rename to src/plugins/clangstaticanalyzer/unit-tests/simple/simple.qbs