ClangTools: Allow suppressing diagnostics for tidy/clazy

...copy/pasted from the static analyzer tool, which will vanish soon.

Change-Id: Ibbdd402b66af35b268896eff420bd1c6597d9ced
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
Nikolai Kosjar
2018-05-08 17:02:40 +02:00
parent de751e5b69
commit 92ea3c93af
2 changed files with 24 additions and 2 deletions

View File

@@ -30,6 +30,7 @@
#include "clangtoolsdiagnosticmodel.h"
#include "clangtoolslogfilereader.h"
#include "clangtidyclazyruncontrol.h"
#include "clangstaticanalyzerdiagnosticview.h"
#include <coreplugin/actionmanager/actioncontainer.h>
#include <coreplugin/actionmanager/actionmanager.h>
@@ -64,12 +65,27 @@ ClangTidyClazyTool::ClangTidyClazyTool()
setObjectName("ClangTidyClazyTool");
s_instance = this;
m_diagnosticView = new Debugger::DetailedErrorView;
m_diagnosticFilterModel = new ClangStaticAnalyzerDiagnosticFilterModel(this);
m_diagnosticFilterModel->setSourceModel(m_diagnosticModel);
m_diagnosticView = new ClangStaticAnalyzerDiagnosticView;
initDiagnosticView();
m_diagnosticView->setModel(m_diagnosticModel);
m_diagnosticView->setModel(m_diagnosticFilterModel);
m_diagnosticView->setObjectName(QLatin1String("ClangTidyClazyIssuesView"));
m_diagnosticView->setWindowTitle(tr("Clang-Tidy and Clazy Issues"));
foreach (auto * const model,
QList<QAbstractItemModel *>() << m_diagnosticModel << m_diagnosticFilterModel) {
connect(model, &QAbstractItemModel::rowsInserted,
this, &ClangTidyClazyTool::handleStateUpdate);
connect(model, &QAbstractItemModel::rowsRemoved,
this, &ClangTidyClazyTool::handleStateUpdate);
connect(model, &QAbstractItemModel::modelReset,
this, &ClangTidyClazyTool::handleStateUpdate);
connect(model, &QAbstractItemModel::layoutChanged, // For QSortFilterProxyModel::invalidate()
this, &ClangTidyClazyTool::handleStateUpdate);
}
ActionContainer *menu = ActionManager::actionContainer(Debugger::Constants::M_DEBUG_ANALYZER);
const QString toolTip = tr("Clang-Tidy and Clazy use a customized Clang executable from the "
"Clang project to search for errors and warnings.");
@@ -141,6 +157,7 @@ void ClangTidyClazyTool::startTool(bool askUserForFileSelection)
m_diagnosticModel->clear();
setToolBusy(true);
m_diagnosticFilterModel->setProject(project);
m_running = true;
handleStateUpdate();
updateRunActions();