ClangTools: Rename some classes and files

...to some more generic names since they are not anymore specific to the
clang static analyzer.

 * ClangStaticAnalyzerDiagnosticView --> DiagnosticView
 * ClangStaticAnalyzerDiagnosticFilterModel --> DiagnosticFilterModel
 * ClangStaticAnalyzerPreconfiguredSesssionTest -->
    PreconfiguredSessionTests
 * clangstaticanalyzerprojectsettingswidget.* -->
   clangtoolsdiagnosticwidget.*

Change-Id: Ifd34f207d31dc24d6a97654aca76ff27b5025547
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
Nikolai Kosjar
2018-05-08 17:33:29 +02:00
parent 92ea3c93af
commit a10cd337c7
16 changed files with 57 additions and 57 deletions

View File

@@ -28,7 +28,7 @@
#include "clangtoolsconstants.h" #include "clangtoolsconstants.h"
#include "clangtoolsdiagnosticmodel.h" #include "clangtoolsdiagnosticmodel.h"
#include "clangtoolslogfilereader.h" #include "clangtoolslogfilereader.h"
#include "clangstaticanalyzerdiagnosticview.h" #include "clangtoolsdiagnosticview.h"
#include "clangstaticanalyzerruncontrol.h" #include "clangstaticanalyzerruncontrol.h"
#include <coreplugin/actionmanager/actioncontainer.h> #include <coreplugin/actionmanager/actioncontainer.h>
@@ -62,10 +62,10 @@ ClangStaticAnalyzerTool::ClangStaticAnalyzerTool()
setObjectName("ClangStaticAnalyzerTool"); setObjectName("ClangStaticAnalyzerTool");
s_instance = this; s_instance = this;
m_diagnosticFilterModel = new ClangStaticAnalyzerDiagnosticFilterModel(this); m_diagnosticFilterModel = new DiagnosticFilterModel(this);
m_diagnosticFilterModel->setSourceModel(m_diagnosticModel); m_diagnosticFilterModel->setSourceModel(m_diagnosticModel);
m_diagnosticView = new ClangStaticAnalyzerDiagnosticView; m_diagnosticView = new DiagnosticView;
initDiagnosticView(); initDiagnosticView();
m_diagnosticView->setModel(m_diagnosticFilterModel); m_diagnosticView->setModel(m_diagnosticFilterModel);
m_diagnosticView->setObjectName(QLatin1String("ClangStaticAnalyzerIssuesView")); m_diagnosticView->setObjectName(QLatin1String("ClangStaticAnalyzerIssuesView"));

View File

@@ -30,9 +30,9 @@
namespace ClangTools { namespace ClangTools {
namespace Internal { namespace Internal {
class ClangStaticAnalyzerDiagnosticFilterModel; class DiagnosticFilterModel;
class ClangToolsDiagnosticModel; class ClangToolsDiagnosticModel;
class ClangStaticAnalyzerDiagnosticView; class DiagnosticView;
class Diagnostic; class Diagnostic;
const char ClangStaticAnalyzerPerspectiveId[] = "ClangStaticAnalyzer.Perspective"; const char ClangStaticAnalyzerPerspectiveId[] = "ClangStaticAnalyzer.Perspective";
@@ -58,7 +58,7 @@ private:
void updateRunActions(); void updateRunActions();
ClangStaticAnalyzerDiagnosticFilterModel *m_diagnosticFilterModel = nullptr; DiagnosticFilterModel *m_diagnosticFilterModel = nullptr;
QAction *m_goBack = nullptr; QAction *m_goBack = nullptr;
QAction *m_goNext = nullptr; QAction *m_goNext = nullptr;

View File

@@ -30,7 +30,7 @@
#include "clangtoolsdiagnosticmodel.h" #include "clangtoolsdiagnosticmodel.h"
#include "clangtoolslogfilereader.h" #include "clangtoolslogfilereader.h"
#include "clangtidyclazyruncontrol.h" #include "clangtidyclazyruncontrol.h"
#include "clangstaticanalyzerdiagnosticview.h" #include "clangtoolsdiagnosticview.h"
#include <coreplugin/actionmanager/actioncontainer.h> #include <coreplugin/actionmanager/actioncontainer.h>
#include <coreplugin/actionmanager/actionmanager.h> #include <coreplugin/actionmanager/actionmanager.h>
@@ -65,10 +65,10 @@ ClangTidyClazyTool::ClangTidyClazyTool()
setObjectName("ClangTidyClazyTool"); setObjectName("ClangTidyClazyTool");
s_instance = this; s_instance = this;
m_diagnosticFilterModel = new ClangStaticAnalyzerDiagnosticFilterModel(this); m_diagnosticFilterModel = new DiagnosticFilterModel(this);
m_diagnosticFilterModel->setSourceModel(m_diagnosticModel); m_diagnosticFilterModel->setSourceModel(m_diagnosticModel);
m_diagnosticView = new ClangStaticAnalyzerDiagnosticView; m_diagnosticView = new DiagnosticView;
initDiagnosticView(); initDiagnosticView();
m_diagnosticView->setModel(m_diagnosticFilterModel); m_diagnosticView->setModel(m_diagnosticFilterModel);
m_diagnosticView->setObjectName(QLatin1String("ClangTidyClazyIssuesView")); m_diagnosticView->setObjectName(QLatin1String("ClangTidyClazyIssuesView"));

View File

@@ -30,7 +30,7 @@
namespace ClangTools { namespace ClangTools {
namespace Internal { namespace Internal {
class ClangStaticAnalyzerDiagnosticFilterModel; class DiagnosticFilterModel;
const char ClangTidyClazyPerspectiveId[] = "ClangTidyClazy.Perspective"; const char ClangTidyClazyPerspectiveId[] = "ClangTidyClazy.Perspective";
const char ClangTidyClazyDockId[] = "ClangTidyClazy.Dock"; const char ClangTidyClazyDockId[] = "ClangTidyClazy.Dock";
@@ -56,7 +56,7 @@ private:
void updateRunActions(); void updateRunActions();
ClangStaticAnalyzerDiagnosticFilterModel *m_diagnosticFilterModel = nullptr; DiagnosticFilterModel *m_diagnosticFilterModel = nullptr;
}; };
} // namespace Internal } // namespace Internal

View File

@@ -10,8 +10,8 @@ INCLUDEPATH += $$LLVM_INCLUDEPATH
SOURCES += \ SOURCES += \
clangselectablefilesdialog.cpp \ clangselectablefilesdialog.cpp \
clangstaticanalyzerdiagnosticview.cpp \ clangtoolsdiagnosticview.cpp \
clangstaticanalyzerprojectsettingswidget.cpp \ clangtoolsprojectsettingswidget.cpp \
clangstaticanalyzerruncontrol.cpp \ clangstaticanalyzerruncontrol.cpp \
clangstaticanalyzerrunner.cpp \ clangstaticanalyzerrunner.cpp \
clangstaticanalyzertool.cpp \ clangstaticanalyzertool.cpp \
@@ -33,8 +33,8 @@ SOURCES += \
HEADERS += \ HEADERS += \
clangfileinfo.h \ clangfileinfo.h \
clangselectablefilesdialog.h \ clangselectablefilesdialog.h \
clangstaticanalyzerdiagnosticview.h \ clangtoolsdiagnosticview.h \
clangstaticanalyzerprojectsettingswidget.h \ clangtoolsprojectsettingswidget.h \
clangstaticanalyzerruncontrol.h \ clangstaticanalyzerruncontrol.h \
clangstaticanalyzerrunner.h \ clangstaticanalyzerrunner.h \
clangstaticanalyzertool.h \ clangstaticanalyzertool.h \
@@ -56,17 +56,17 @@ HEADERS += \
clangtoolsconfigwidget.h clangtoolsconfigwidget.h
FORMS += \ FORMS += \
clangstaticanalyzerprojectsettingswidget.ui \ clangtoolsprojectsettingswidget.ui \
clangtoolsconfigwidget.ui clangtoolsconfigwidget.ui
clangselectablefilesdialog.ui clangselectablefilesdialog.ui
equals(TEST, 1) { equals(TEST, 1) {
HEADERS += \ HEADERS += \
clangstaticanalyzerpreconfiguredsessiontests.h \ clangtoolspreconfiguredsessiontests.h \
clangtoolsunittests.h clangtoolsunittests.h
SOURCES += \ SOURCES += \
clangstaticanalyzerpreconfiguredsessiontests.cpp \ clangtoolspreconfiguredsessiontests.cpp \
clangtoolsunittests.cpp clangtoolsunittests.cpp
RESOURCES += clangtoolsunittests.qrc RESOURCES += clangtoolsunittests.qrc

View File

@@ -45,11 +45,11 @@ QtcPlugin {
"clangselectablefilesdialog.cpp", "clangselectablefilesdialog.cpp",
"clangselectablefilesdialog.h", "clangselectablefilesdialog.h",
"clangselectablefilesdialog.ui", "clangselectablefilesdialog.ui",
"clangstaticanalyzerdiagnosticview.cpp", "clangtoolsdiagnosticview.cpp",
"clangstaticanalyzerdiagnosticview.h", "clangtoolsdiagnosticview.h",
"clangstaticanalyzerprojectsettingswidget.cpp", "clangtoolsprojectsettingswidget.cpp",
"clangstaticanalyzerprojectsettingswidget.h", "clangtoolsprojectsettingswidget.h",
"clangstaticanalyzerprojectsettingswidget.ui", "clangtoolsprojectsettingswidget.ui",
"clangstaticanalyzerruncontrol.cpp", "clangstaticanalyzerruncontrol.cpp",
"clangstaticanalyzerruncontrol.h", "clangstaticanalyzerruncontrol.h",
"clangstaticanalyzerrunner.cpp", "clangstaticanalyzerrunner.cpp",
@@ -93,8 +93,8 @@ QtcPlugin {
name: "Unit tests" name: "Unit tests"
condition: qtc.testsEnabled condition: qtc.testsEnabled
files: [ files: [
"clangstaticanalyzerpreconfiguredsessiontests.cpp", "clangtoolspreconfiguredsessiontests.cpp",
"clangstaticanalyzerpreconfiguredsessiontests.h", "clangtoolspreconfiguredsessiontests.h",
"clangtoolsunittests.cpp", "clangtoolsunittests.cpp",
"clangtoolsunittests.h", "clangtoolsunittests.h",
"clangtoolsunittests.qrc", "clangtoolsunittests.qrc",

View File

@@ -25,7 +25,7 @@
#include "clangtoolsdiagnosticmodel.h" #include "clangtoolsdiagnosticmodel.h"
#include "clangstaticanalyzerdiagnosticview.h" #include "clangtoolsdiagnosticview.h"
#include "clangtoolsprojectsettings.h" #include "clangtoolsprojectsettings.h"
#include "clangtoolsutils.h" #include "clangtoolsutils.h"
@@ -306,7 +306,7 @@ QVariant ExplainingStepItem::data(int column, int role) const
} }
ClangStaticAnalyzerDiagnosticFilterModel::ClangStaticAnalyzerDiagnosticFilterModel(QObject *parent) DiagnosticFilterModel::DiagnosticFilterModel(QObject *parent)
: QSortFilterProxyModel(parent) : QSortFilterProxyModel(parent)
{ {
// So that when a user closes and re-opens a project and *then* clicks "Suppress", // So that when a user closes and re-opens a project and *then* clicks "Suppress",
@@ -319,23 +319,23 @@ ClangStaticAnalyzerDiagnosticFilterModel::ClangStaticAnalyzerDiagnosticFilterMod
}); });
} }
void ClangStaticAnalyzerDiagnosticFilterModel::setProject(ProjectExplorer::Project *project) void DiagnosticFilterModel::setProject(ProjectExplorer::Project *project)
{ {
QTC_ASSERT(project, return); QTC_ASSERT(project, return);
if (m_project) { if (m_project) {
disconnect(ClangToolsProjectSettingsManager::getSettings(m_project), disconnect(ClangToolsProjectSettingsManager::getSettings(m_project),
&ClangToolsProjectSettings::suppressedDiagnosticsChanged, this, &ClangToolsProjectSettings::suppressedDiagnosticsChanged, this,
&ClangStaticAnalyzerDiagnosticFilterModel::handleSuppressedDiagnosticsChanged); &DiagnosticFilterModel::handleSuppressedDiagnosticsChanged);
} }
m_project = project; m_project = project;
m_lastProjectDirectory = m_project->projectDirectory(); m_lastProjectDirectory = m_project->projectDirectory();
connect(ClangToolsProjectSettingsManager::getSettings(m_project), connect(ClangToolsProjectSettingsManager::getSettings(m_project),
&ClangToolsProjectSettings::suppressedDiagnosticsChanged, &ClangToolsProjectSettings::suppressedDiagnosticsChanged,
this, &ClangStaticAnalyzerDiagnosticFilterModel::handleSuppressedDiagnosticsChanged); this, &DiagnosticFilterModel::handleSuppressedDiagnosticsChanged);
handleSuppressedDiagnosticsChanged(); handleSuppressedDiagnosticsChanged();
} }
void ClangStaticAnalyzerDiagnosticFilterModel::addSuppressedDiagnostic( void DiagnosticFilterModel::addSuppressedDiagnostic(
const SuppressedDiagnostic &diag) const SuppressedDiagnostic &diag)
{ {
QTC_ASSERT(!m_project, return); QTC_ASSERT(!m_project, return);
@@ -343,7 +343,7 @@ void ClangStaticAnalyzerDiagnosticFilterModel::addSuppressedDiagnostic(
invalidate(); invalidate();
} }
bool ClangStaticAnalyzerDiagnosticFilterModel::filterAcceptsRow(int sourceRow, bool DiagnosticFilterModel::filterAcceptsRow(int sourceRow,
const QModelIndex &sourceParent) const const QModelIndex &sourceParent) const
{ {
if (sourceParent.isValid()) if (sourceParent.isValid())
@@ -363,7 +363,7 @@ bool ClangStaticAnalyzerDiagnosticFilterModel::filterAcceptsRow(int sourceRow,
return true; return true;
} }
void ClangStaticAnalyzerDiagnosticFilterModel::handleSuppressedDiagnosticsChanged() void DiagnosticFilterModel::handleSuppressedDiagnosticsChanged()
{ {
QTC_ASSERT(m_project, return); QTC_ASSERT(m_project, return);
m_suppressedDiagnostics m_suppressedDiagnostics

View File

@@ -55,12 +55,12 @@ public:
}; };
}; };
class ClangStaticAnalyzerDiagnosticFilterModel : public QSortFilterProxyModel class DiagnosticFilterModel : public QSortFilterProxyModel
{ {
Q_OBJECT Q_OBJECT
public: public:
ClangStaticAnalyzerDiagnosticFilterModel(QObject *parent = nullptr); DiagnosticFilterModel(QObject *parent = nullptr);
void setProject(ProjectExplorer::Project *project); void setProject(ProjectExplorer::Project *project);
void addSuppressedDiagnostic(const SuppressedDiagnostic &diag); void addSuppressedDiagnostic(const SuppressedDiagnostic &diag);

View File

@@ -23,7 +23,7 @@
** **
****************************************************************************/ ****************************************************************************/
#include "clangstaticanalyzerdiagnosticview.h" #include "clangtoolsdiagnosticview.h"
#include "clangtoolsdiagnosticmodel.h" #include "clangtoolsdiagnosticmodel.h"
#include "clangtoolsprojectsettings.h" #include "clangtoolsprojectsettings.h"
@@ -40,15 +40,15 @@ using namespace Debugger;
namespace ClangTools { namespace ClangTools {
namespace Internal { namespace Internal {
ClangStaticAnalyzerDiagnosticView::ClangStaticAnalyzerDiagnosticView(QWidget *parent) DiagnosticView::DiagnosticView(QWidget *parent)
: Debugger::DetailedErrorView(parent) : Debugger::DetailedErrorView(parent)
{ {
m_suppressAction = new QAction(tr("Suppress This Diagnostic"), this); m_suppressAction = new QAction(tr("Suppress This Diagnostic"), this);
connect(m_suppressAction, &QAction::triggered, connect(m_suppressAction, &QAction::triggered,
this, &ClangStaticAnalyzerDiagnosticView::suppressCurrentDiagnostic); this, &DiagnosticView::suppressCurrentDiagnostic);
} }
void ClangStaticAnalyzerDiagnosticView::suppressCurrentDiagnostic() void DiagnosticView::suppressCurrentDiagnostic()
{ {
const QModelIndexList indexes = selectionModel()->selectedRows(); const QModelIndexList indexes = selectionModel()->selectedRows();
QTC_ASSERT(indexes.count() == 1, return); QTC_ASSERT(indexes.count() == 1, return);
@@ -59,7 +59,7 @@ void ClangStaticAnalyzerDiagnosticView::suppressCurrentDiagnostic()
// If the original project was closed, we work directly on the filter model, otherwise // If the original project was closed, we work directly on the filter model, otherwise
// we go via the project settings. // we go via the project settings.
auto * const filterModel = static_cast<ClangStaticAnalyzerDiagnosticFilterModel *>(model()); auto * const filterModel = static_cast<DiagnosticFilterModel *>(model());
ProjectExplorer::Project * const project = filterModel->project(); ProjectExplorer::Project * const project = filterModel->project();
if (project) { if (project) {
Utils::FileName filePath = Utils::FileName::fromString(diag.location.filePath); Utils::FileName filePath = Utils::FileName::fromString(diag.location.filePath);
@@ -75,7 +75,7 @@ void ClangStaticAnalyzerDiagnosticView::suppressCurrentDiagnostic()
} }
} }
QList<QAction *> ClangStaticAnalyzerDiagnosticView::customActions() const QList<QAction *> DiagnosticView::customActions() const
{ {
return QList<QAction *>() << m_suppressAction; return QList<QAction *>() << m_suppressAction;
} }

View File

@@ -30,12 +30,12 @@
namespace ClangTools { namespace ClangTools {
namespace Internal { namespace Internal {
class ClangStaticAnalyzerDiagnosticView : public Debugger::DetailedErrorView class DiagnosticView : public Debugger::DetailedErrorView
{ {
Q_OBJECT Q_OBJECT
public: public:
ClangStaticAnalyzerDiagnosticView(QWidget *parent = 0); DiagnosticView(QWidget *parent = 0);
private: private:
void suppressCurrentDiagnostic(); void suppressCurrentDiagnostic();

View File

@@ -27,14 +27,14 @@
#include "clangtoolsconfigwidget.h" #include "clangtoolsconfigwidget.h"
#include "clangtoolsconstants.h" #include "clangtoolsconstants.h"
#include "clangstaticanalyzerprojectsettingswidget.h" #include "clangtoolsprojectsettingswidget.h"
#include "clangstaticanalyzerruncontrol.h" #include "clangstaticanalyzerruncontrol.h"
#include "clangstaticanalyzertool.h" #include "clangstaticanalyzertool.h"
#include "clangtidyclazytool.h" #include "clangtidyclazytool.h"
#include "clangtoolsprojectsettings.h" #include "clangtoolsprojectsettings.h"
#ifdef WITH_TESTS #ifdef WITH_TESTS
#include "clangstaticanalyzerpreconfiguredsessiontests.h" #include "clangtoolspreconfiguredsessiontests.h"
#include "clangtoolsunittests.h" #include "clangtoolsunittests.h"
#endif #endif
@@ -136,7 +136,7 @@ QList<QObject *> ClangToolsPlugin::createTestObjects() const
{ {
QList<QObject *> tests; QList<QObject *> tests;
#ifdef WITH_TESTS #ifdef WITH_TESTS
tests << new ClangStaticAnalyzerPreconfiguredSessionTests; tests << new PreconfiguredSessionTests;
tests << new ClangToolsUnitTests; tests << new ClangToolsUnitTests;
#endif #endif
return tests; return tests;

View File

@@ -23,7 +23,7 @@
** **
****************************************************************************/ ****************************************************************************/
#include "clangstaticanalyzerpreconfiguredsessiontests.h" #include "clangtoolspreconfiguredsessiontests.h"
#include "clangtoolsdiagnostic.h" #include "clangtoolsdiagnostic.h"
#include "clangstaticanalyzertool.h" #include "clangstaticanalyzertool.h"
@@ -97,11 +97,11 @@ private:
namespace ClangTools { namespace ClangTools {
namespace Internal { namespace Internal {
void ClangStaticAnalyzerPreconfiguredSessionTests::initTestCase() void PreconfiguredSessionTests::initTestCase()
{ {
const QString preconfiguredSessionName = QLatin1String("ClangStaticAnalyzerPreconfiguredSession"); const QString preconfiguredSessionName = QLatin1String("ClangToolsTest");
if (!SessionManager::sessions().contains(preconfiguredSessionName)) if (!SessionManager::sessions().contains(preconfiguredSessionName))
QSKIP("Manually preconfigured session 'ClangStaticAnalyzerPreconfiguredSession' needed."); QSKIP("Manually preconfigured session 'ClangToolsTest' needed.");
if (SessionManager::activeSession() == preconfiguredSessionName) if (SessionManager::activeSession() == preconfiguredSessionName)
QSKIP("Session must not be already active."); QSKIP("Session must not be already active.");
@@ -113,7 +113,7 @@ void ClangStaticAnalyzerPreconfiguredSessionTests::initTestCase()
QVERIFY(waitForParsedProjects.wait()); QVERIFY(waitForParsedProjects.wait());
} }
void ClangStaticAnalyzerPreconfiguredSessionTests::testPreconfiguredSession() void PreconfiguredSessionTests::testPreconfiguredSession()
{ {
QFETCH(Project *, project); QFETCH(Project *, project);
QFETCH(Target *, target); QFETCH(Target *, target);
@@ -188,7 +188,7 @@ static QByteArray dataTagName(Project *project, Target *target)
return dataTagAsString.toUtf8(); return dataTagAsString.toUtf8();
} }
void ClangStaticAnalyzerPreconfiguredSessionTests::testPreconfiguredSession_data() void PreconfiguredSessionTests::testPreconfiguredSession_data()
{ {
QTest::addColumn<Project *>("project"); QTest::addColumn<Project *>("project");
QTest::addColumn<Target *>("target"); QTest::addColumn<Target *>("target");
@@ -206,7 +206,7 @@ void ClangStaticAnalyzerPreconfiguredSessionTests::testPreconfiguredSession_data
QSKIP("Session has no valid projects/targets to test."); QSKIP("Session has no valid projects/targets to test.");
} }
bool ClangStaticAnalyzerPreconfiguredSessionTests::switchToProjectAndTarget(Project *project, bool PreconfiguredSessionTests::switchToProjectAndTarget(Project *project,
Target *target) Target *target)
{ {
Project * const activeProject = SessionManager::startupProject(); Project * const activeProject = SessionManager::startupProject();

View File

@@ -36,7 +36,7 @@ class Target;
namespace ClangTools { namespace ClangTools {
namespace Internal { namespace Internal {
class ClangStaticAnalyzerPreconfiguredSessionTests: public QObject class PreconfiguredSessionTests: public QObject
{ {
Q_OBJECT Q_OBJECT

View File

@@ -23,8 +23,8 @@
** **
****************************************************************************/ ****************************************************************************/
#include "clangstaticanalyzerprojectsettingswidget.h" #include "clangtoolsprojectsettingswidget.h"
#include "ui_clangstaticanalyzerprojectsettingswidget.h" #include "ui_clangtoolsprojectsettingswidget.h"
#include "clangtoolsprojectsettings.h" #include "clangtoolsprojectsettings.h"
@@ -164,4 +164,4 @@ QVariant SuppressedDiagnosticsModel::data(const QModelIndex &index, int role) co
} // namespace Internal } // namespace Internal
} // namespace ClangTools } // namespace ClangTools
#include "clangstaticanalyzerprojectsettingswidget.moc" #include "clangtoolsprojectsettingswidget.moc"