Improve usage of std::move and const references parameters
Accomplished using `run-clang-tidy` with `performance-move-const-arg,performance-unnecessary-value-param,modernize-pass-by-value`. Changed arguments to const references, removed them where inappropriate (e.g. sink parameters). Same with std::move. Manually reviewed each change to make sure that it makes sense, and do something more appropriate if possible.
This commit is contained in:
1 parent
33f62b0f9f
commit
95dec13203
140 files changed
+318
-277
No files matched your search
@@ -9,6 +9,7 @@
|
||||
#include <QToolTip>
|
||||
|
||||
#include <filesystem>
|
||||
#include <utility>
|
||||
|
||||
#include "Common/StringUtil.h"
|
||||
#include "DolphinQt/Debugger/GekkoSyntaxHighlight.h"
|
||||
@@ -23,8 +24,8 @@ void AsmEditor::LineNumberArea::paintEvent(QPaintEvent* event)
|
||||
asm_editor->LineNumberAreaPaintEvent(event);
|
||||
}
|
||||
|
||||
AsmEditor::AsmEditor(const QString& path, int editor_num, bool dark_scheme, QWidget* parent)
|
||||
: QPlainTextEdit(parent), m_path(path), m_base_address(QStringLiteral("0")),
|
||||
AsmEditor::AsmEditor(QString path, int editor_num, bool dark_scheme, QWidget* parent)
|
||||
: QPlainTextEdit(parent), m_path(std::move(path)), m_base_address(QStringLiteral("0")),
|
||||
m_editor_num(editor_num), m_dirty(false), m_dark_scheme(dark_scheme)
|
||||
{
|
||||
if (!m_path.isEmpty())
|
||||
|
||||
@@ -18,7 +18,7 @@ class AsmEditor : public QPlainTextEdit
|
||||
Q_OBJECT;
|
||||
|
||||
public:
|
||||
AsmEditor(const QString& file_path, int editor_num, bool dark_scheme, QWidget* parent = nullptr);
|
||||
AsmEditor(QString file_path, int editor_num, bool dark_scheme, QWidget* parent = nullptr);
|
||||
void LineNumberAreaPaintEvent(QPaintEvent* event);
|
||||
int LineNumberAreaWidth();
|
||||
const QString& Path() const { return m_path; }
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
|
||||
#include "Common/Assembler/GekkoParser.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include <QLabel>
|
||||
#include <QPalette>
|
||||
|
||||
@@ -189,7 +191,7 @@ void GekkoSyntaxHighlight::highlightBlock(const QString& text)
|
||||
|
||||
GekkoSyntaxHighlight::GekkoSyntaxHighlight(QTextDocument* document, QTextCharFormat base_format,
|
||||
bool dark_scheme)
|
||||
: QSyntaxHighlighter(document), m_base_format(base_format)
|
||||
: QSyntaxHighlighter(document), m_base_format(std::move(base_format))
|
||||
{
|
||||
QPalette base_scheme;
|
||||
m_theme_idx = dark_scheme ? 1 : 0;
|
||||
|
||||
@@ -517,8 +517,9 @@ void RegisterWidget::PopulateTable()
|
||||
m_table->resizeColumnsToContents();
|
||||
}
|
||||
|
||||
void RegisterWidget::AddRegister(int row, int column, RegisterType type, std::string register_name,
|
||||
std::function<u64()> get_reg, std::function<void(u64)> set_reg)
|
||||
void RegisterWidget::AddRegister(int row, int column, RegisterType type,
|
||||
const std::string& register_name, std::function<u64()> get_reg,
|
||||
std::function<void(u64)> set_reg)
|
||||
{
|
||||
auto* value = new RegisterColumn(type, std::move(get_reg), std::move(set_reg));
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ private:
|
||||
void OnItemChanged(QTableWidgetItem* item);
|
||||
void OnDebugFontChanged(const QFont& font);
|
||||
|
||||
void AddRegister(int row, int column, RegisterType type, std::string register_name,
|
||||
void AddRegister(int row, int column, RegisterType type, const std::string& register_name,
|
||||
std::function<u64()> get_reg, std::function<void(u64)> set_reg);
|
||||
|
||||
void AutoStep(const std::string& reg) const;
|
||||
|
||||
@@ -518,7 +518,7 @@ void WatchWidget::ShowInMemory(int row)
|
||||
emit ShowMemory(m_system.GetPowerPC().GetDebugInterface().GetWatch(row).address);
|
||||
}
|
||||
|
||||
void WatchWidget::AddWatch(QString name, u32 addr)
|
||||
void WatchWidget::AddWatch(const QString& name, u32 addr)
|
||||
{
|
||||
m_system.GetPowerPC().GetDebugInterface().SetWatch(addr, name.toStdString());
|
||||
Update();
|
||||
|
||||
@@ -27,7 +27,7 @@ public:
|
||||
explicit WatchWidget(QWidget* parent = nullptr);
|
||||
~WatchWidget() override;
|
||||
|
||||
void AddWatch(QString name, u32 addr);
|
||||
void AddWatch(const QString& name, u32 addr);
|
||||
signals:
|
||||
void RequestMemoryBreakpoint(u32 addr);
|
||||
void ShowMemory(u32 addr);
|
||||
|
||||
Reference in new issue
Block a user