forked from qt-creator/qt-creator
ClangTools: Modernize
modernize-use-nullptr modernize-use-override modernize-use-equals-default Change-Id: I14a840c6f2972f57763cdfd4bb4483df1ec261d4 Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: Marco Bubke <marco.bubke@qt.io>
This commit is contained in:
@@ -363,7 +363,7 @@ SelectableFilesDialog::SelectableFilesDialog(const ProjectInfo &projectInfo,
|
||||
});
|
||||
}
|
||||
|
||||
SelectableFilesDialog::~SelectableFilesDialog() {}
|
||||
SelectableFilesDialog::~SelectableFilesDialog() = default;
|
||||
|
||||
FileInfos SelectableFilesDialog::filteredFileInfos() const
|
||||
{
|
||||
|
||||
@@ -47,7 +47,7 @@ ClangTidyClazyRunControl::ClangTidyClazyRunControl(
|
||||
|
||||
ClangToolRunner *ClangTidyClazyRunControl::createRunner()
|
||||
{
|
||||
QTC_ASSERT(!m_clangExecutable.isEmpty(), return 0);
|
||||
QTC_ASSERT(!m_clangExecutable.isEmpty(), return nullptr);
|
||||
|
||||
auto runner = new ClangTidyClazyRunner(m_diagnosticConfig,
|
||||
m_clangExecutable,
|
||||
|
||||
@@ -44,7 +44,7 @@ class ClangTool : public QObject
|
||||
|
||||
public:
|
||||
ClangTool(const QString &name);
|
||||
virtual ~ClangTool();
|
||||
~ClangTool() override;
|
||||
|
||||
virtual void startTool(bool askUserForFileSelection) = 0;
|
||||
|
||||
|
||||
@@ -354,7 +354,7 @@ void ClangToolRunControl::stop()
|
||||
QSetIterator<ClangToolRunner *> i(m_runners);
|
||||
while (i.hasNext()) {
|
||||
ClangToolRunner *runner = i.next();
|
||||
QObject::disconnect(runner, 0, this, 0);
|
||||
QObject::disconnect(runner, nullptr, this, nullptr);
|
||||
delete runner;
|
||||
}
|
||||
m_runners.clear();
|
||||
|
||||
@@ -50,7 +50,7 @@ struct AnalyzeUnit {
|
||||
QString file;
|
||||
QStringList arguments; // without file itself and "-o somePath"
|
||||
};
|
||||
typedef QList<AnalyzeUnit> AnalyzeUnits;
|
||||
using AnalyzeUnits = QList<AnalyzeUnit>;
|
||||
|
||||
class ClangToolRunControl : public ProjectExplorer::RunWorker
|
||||
{
|
||||
|
||||
@@ -45,7 +45,7 @@ public:
|
||||
const Utils::Environment &environment,
|
||||
const QString &name,
|
||||
QObject *parent = nullptr);
|
||||
virtual ~ClangToolRunner();
|
||||
~ClangToolRunner() override;
|
||||
|
||||
// compilerOptions is expected to contain everything except:
|
||||
// (1) filePath, that is the file to analyze
|
||||
|
||||
@@ -38,8 +38,8 @@ class ClangToolsBasicSettings : public QWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ClangToolsBasicSettings(QWidget *parent = 0);
|
||||
~ClangToolsBasicSettings();
|
||||
explicit ClangToolsBasicSettings(QWidget *parent = nullptr);
|
||||
~ClangToolsBasicSettings() override;
|
||||
|
||||
Ui::ClangToolsBasicSettings *ui();
|
||||
private:
|
||||
|
||||
@@ -44,7 +44,7 @@ class ClangToolsConfigWidget : public QWidget
|
||||
|
||||
public:
|
||||
ClangToolsConfigWidget(ClangToolsSettings *settings, QWidget *parent = nullptr);
|
||||
~ClangToolsConfigWidget();
|
||||
~ClangToolsConfigWidget() override;
|
||||
private:
|
||||
std::unique_ptr<Ui::ClangToolsConfigWidget> m_ui;
|
||||
ClangToolsSettings *m_settings;
|
||||
|
||||
@@ -87,7 +87,7 @@ int ClangToolsDiagnosticModel::diagnosticsCount() const
|
||||
|
||||
static QString createDiagnosticToolTipString(const Diagnostic &diagnostic)
|
||||
{
|
||||
typedef QPair<QString, QString> StringPair;
|
||||
using StringPair = QPair<QString, QString>;
|
||||
QList<StringPair> lines;
|
||||
|
||||
if (!diagnostic.category.isEmpty()) {
|
||||
@@ -140,7 +140,7 @@ static QString createExplainingStepToolTipString(const ExplainingStep &step)
|
||||
if (step.message == step.extendedMessage)
|
||||
return createFullLocationString(step.location);
|
||||
|
||||
typedef QPair<QString, QString> StringPair;
|
||||
using StringPair = QPair<QString, QString>;
|
||||
QList<StringPair> lines;
|
||||
|
||||
if (!step.message.isEmpty()) {
|
||||
|
||||
@@ -115,7 +115,7 @@ public:
|
||||
ProjectExplorer::Project *project() const { return m_project; }
|
||||
|
||||
private:
|
||||
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const;
|
||||
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override;
|
||||
void handleSuppressedDiagnosticsChanged();
|
||||
|
||||
QPointer<ProjectExplorer::Project> m_project;
|
||||
|
||||
@@ -47,7 +47,7 @@ class ClickableFixItHeader : public QHeaderView
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ClickableFixItHeader(Qt::Orientation orientation, QWidget *parent = 0)
|
||||
ClickableFixItHeader(Qt::Orientation orientation, QWidget *parent = nullptr)
|
||||
: QHeaderView(orientation, parent)
|
||||
{
|
||||
}
|
||||
@@ -58,7 +58,7 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
void paintSection(QPainter *painter, const QRect &rect, int logicalIndex) const
|
||||
void paintSection(QPainter *painter, const QRect &rect, int logicalIndex) const override
|
||||
{
|
||||
painter->save();
|
||||
QHeaderView::paintSection(painter, rect, logicalIndex);
|
||||
@@ -72,7 +72,7 @@ protected:
|
||||
}
|
||||
}
|
||||
|
||||
void mousePressEvent(QMouseEvent *event)
|
||||
void mousePressEvent(QMouseEvent *event) override
|
||||
{
|
||||
if (event->localPos().x() > sectionPosition(DiagnosticView::FixItColumn)) {
|
||||
state = (state != QStyle::State_On) ? QStyle::State_On : QStyle::State_Off;
|
||||
|
||||
@@ -35,7 +35,7 @@ class DiagnosticView : public Debugger::DetailedErrorView
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DiagnosticView(QWidget *parent = 0);
|
||||
DiagnosticView(QWidget *parent = nullptr);
|
||||
|
||||
enum ExtraColumn {
|
||||
FixItColumn = LocationColumn + 1,
|
||||
@@ -46,7 +46,7 @@ public:
|
||||
private:
|
||||
void suppressCurrentDiagnostic();
|
||||
|
||||
QList<QAction *> customActions() const;
|
||||
QList<QAction *> customActions() const override;
|
||||
bool eventFilter(QObject *watched, QEvent *event) override;
|
||||
void setModel(QAbstractItemModel *model) override;
|
||||
|
||||
|
||||
@@ -82,19 +82,19 @@ public:
|
||||
setCategoryIcon(Analyzer::Icons::SETTINGSCATEGORY_ANALYZER);
|
||||
}
|
||||
|
||||
QWidget *widget()
|
||||
QWidget *widget() override
|
||||
{
|
||||
if (!m_widget)
|
||||
m_widget = new ClangToolsConfigWidget(ClangToolsSettings::instance());
|
||||
return m_widget;
|
||||
}
|
||||
|
||||
void apply()
|
||||
void apply() override
|
||||
{
|
||||
ClangToolsSettings::instance()->writeSettings();
|
||||
}
|
||||
|
||||
void finish()
|
||||
void finish() override
|
||||
{
|
||||
delete m_widget;
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ inline bool operator==(const SuppressedDiagnostic &d1, const SuppressedDiagnosti
|
||||
&& d1.uniquifier == d2.uniquifier;
|
||||
}
|
||||
|
||||
typedef QList<SuppressedDiagnostic> SuppressedDiagnosticsList;
|
||||
using SuppressedDiagnosticsList = QList<SuppressedDiagnostic>;
|
||||
|
||||
class ClangToolsProjectSettings : public QObject
|
||||
{
|
||||
|
||||
@@ -39,7 +39,7 @@ class SuppressedDiagnosticsModel : public QAbstractTableModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
SuppressedDiagnosticsModel(QObject *parent = 0) : QAbstractTableModel(parent) { }
|
||||
SuppressedDiagnosticsModel(QObject *parent = nullptr) : QAbstractTableModel(parent) { }
|
||||
|
||||
void setDiagnostics(const SuppressedDiagnosticsList &diagnostics);
|
||||
SuppressedDiagnostic diagnosticAt(int i) const;
|
||||
@@ -47,10 +47,11 @@ public:
|
||||
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;
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
int columnCount(const QModelIndex & = QModelIndex()) const override { return ColumnLast + 1; }
|
||||
QVariant headerData(int section, Qt::Orientation orientation,
|
||||
int role = Qt::DisplayRole) const override;
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
|
||||
SuppressedDiagnosticsList m_diagnostics;
|
||||
};
|
||||
|
||||
@@ -40,8 +40,8 @@ class ProjectSettingsWidget : public QWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ProjectSettingsWidget(ProjectExplorer::Project *project, QWidget *parent = 0);
|
||||
~ProjectSettingsWidget();
|
||||
explicit ProjectSettingsWidget(ProjectExplorer::Project *project, QWidget *parent = nullptr);
|
||||
~ProjectSettingsWidget() override;
|
||||
|
||||
private:
|
||||
void updateButtonStates();
|
||||
|
||||
@@ -37,7 +37,7 @@ class ClangToolsUnitTests : public QObject
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ClangToolsUnitTests() {}
|
||||
ClangToolsUnitTests() = default;
|
||||
|
||||
private slots:
|
||||
void initTestCase();
|
||||
|
||||
Reference in New Issue
Block a user