summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon/ControllerInterface
diff options
context:
space:
mode:
authorMartino Fontana <tinozzo123@gmail.com>2026-04-06 11:37:26 +0200
committerMartino Fontana <tinozzo123@gmail.com>2026-04-17 12:39:46 +0200
commit95dec132030e72b74da6bc46966e4fe5e4e239c0 (patch)
treef4340655ebc036425e69048651ee49dec16ddc12 /Source/Core/InputCommon/ControllerInterface
parent33f62b0f9f36a3dfccc3ecfc13358899d0cc8036 (diff)
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.
Diffstat (limited to 'Source/Core/InputCommon/ControllerInterface')
-rw-r--r--Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp2
-rw-r--r--Source/Core/InputCommon/ControllerInterface/ControllerInterface.h2
-rw-r--r--Source/Core/InputCommon/ControllerInterface/CoreDevice.cpp4
-rw-r--r--Source/Core/InputCommon/ControllerInterface/DualShockUDPClient/DualShockUDPClient.cpp2
-rw-r--r--Source/Core/InputCommon/ControllerInterface/Pipes/Pipes.cpp3
-rw-r--r--Source/Core/InputCommon/ControllerInterface/Pipes/Pipes.h2
-rw-r--r--Source/Core/InputCommon/ControllerInterface/Wiimote/WiimoteController.cpp2
7 files changed, 10 insertions, 7 deletions
diff --git a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp
index 7393de9950..9dd8cdb6a9 100644
--- a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp
+++ b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp
@@ -166,7 +166,7 @@ void ControllerInterface::RefreshDevices(RefreshReason reason)
InvokeDevicesChangedCallbacks();
}
-void ControllerInterface::PlatformPopulateDevices(std::function<void()> callback)
+void ControllerInterface::PlatformPopulateDevices(const std::function<void()>& callback)
{
if (!m_is_init)
return;
diff --git a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.h b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.h
index 05a3a99a05..8f7f4baf40 100644
--- a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.h
+++ b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.h
@@ -97,7 +97,7 @@ public:
// This is mandatory to use on device populations functions that can be called concurrently by
// more than one thread, or that are called by a single other thread.
// Without this, our devices list might end up in a mixed state.
- void PlatformPopulateDevices(std::function<void()> callback);
+ void PlatformPopulateDevices(const std::function<void()>& callback);
bool IsInit() const { return m_is_init; }
void UpdateInput();
diff --git a/Source/Core/InputCommon/ControllerInterface/CoreDevice.cpp b/Source/Core/InputCommon/ControllerInterface/CoreDevice.cpp
index 7197aa1fed..a10edd13c9 100644
--- a/Source/Core/InputCommon/ControllerInterface/CoreDevice.cpp
+++ b/Source/Core/InputCommon/ControllerInterface/CoreDevice.cpp
@@ -9,6 +9,7 @@
#include <sstream>
#include <string>
#include <tuple>
+#include <utility>
#include <fmt/format.h>
@@ -25,7 +26,8 @@ class CombinedInput final : public Device::Input
public:
using Inputs = std::pair<Device::Input*, Device::Input*>;
- CombinedInput(std::string name, const Inputs& inputs) : m_name(std::move(name)), m_inputs(inputs)
+ CombinedInput(std::string name, Inputs inputs)
+ : m_name(std::move(name)), m_inputs(std::move(inputs))
{
}
ControlState GetState() const override
diff --git a/Source/Core/InputCommon/ControllerInterface/DualShockUDPClient/DualShockUDPClient.cpp b/Source/Core/InputCommon/ControllerInterface/DualShockUDPClient/DualShockUDPClient.cpp
index dad0844beb..b22ace19f2 100644
--- a/Source/Core/InputCommon/ControllerInterface/DualShockUDPClient/DualShockUDPClient.cpp
+++ b/Source/Core/InputCommon/ControllerInterface/DualShockUDPClient/DualShockUDPClient.cpp
@@ -179,7 +179,7 @@ struct Server
m_description = std::move(other.m_description);
m_address = std::move(other.m_address);
m_port = other.m_port;
- m_port_info = std::move(other.m_port_info);
+ m_port_info = other.m_port_info;
}
Server& operator=(const Server&) = delete;
diff --git a/Source/Core/InputCommon/ControllerInterface/Pipes/Pipes.cpp b/Source/Core/InputCommon/ControllerInterface/Pipes/Pipes.cpp
index 20baa74be9..ce0ddb3314 100644
--- a/Source/Core/InputCommon/ControllerInterface/Pipes/Pipes.cpp
+++ b/Source/Core/InputCommon/ControllerInterface/Pipes/Pipes.cpp
@@ -13,6 +13,7 @@
#include <sstream>
#include <string>
#include <unistd.h>
+#include <utility>
#include <vector>
#include "Common/FileUtil.h"
@@ -73,7 +74,7 @@ void InputBackend::PopulateDevices()
}
}
-PipeDevice::PipeDevice(int fd, const std::string& name) : m_fd(fd), m_name(name)
+PipeDevice::PipeDevice(int fd, std::string name) : m_fd(fd), m_name(std::move(name))
{
for (const auto& tok : s_button_tokens)
{
diff --git a/Source/Core/InputCommon/ControllerInterface/Pipes/Pipes.h b/Source/Core/InputCommon/ControllerInterface/Pipes/Pipes.h
index 857d5e8128..d9e2d7b4b7 100644
--- a/Source/Core/InputCommon/ControllerInterface/Pipes/Pipes.h
+++ b/Source/Core/InputCommon/ControllerInterface/Pipes/Pipes.h
@@ -26,7 +26,7 @@ std::unique_ptr<ciface::InputBackend> CreateInputBackend(ControllerInterface* co
class PipeDevice : public Core::Device
{
public:
- PipeDevice(int fd, const std::string& name);
+ PipeDevice(int fd, std::string name);
~PipeDevice();
Core::DeviceRemoval UpdateInput() override;
diff --git a/Source/Core/InputCommon/ControllerInterface/Wiimote/WiimoteController.cpp b/Source/Core/InputCommon/ControllerInterface/Wiimote/WiimoteController.cpp
index b062684100..e7724c1840 100644
--- a/Source/Core/InputCommon/ControllerInterface/Wiimote/WiimoteController.cpp
+++ b/Source/Core/InputCommon/ControllerInterface/Wiimote/WiimoteController.cpp
@@ -505,7 +505,7 @@ void Device::RunTasks()
{
static constexpr u16 MPLUS_POLL_ADDR = WiimoteEmu::MotionPlus::PASSTHROUGH_MODE_OFFSET;
ReadData(AddressSpace::I2CBus, WiimoteEmu::MotionPlus::INACTIVE_DEVICE_ADDR, MPLUS_POLL_ADDR, 1,
- [this](ReadResponse response) {
+ [this](const ReadResponse& response) {
if (!response)
{
DEBUG_LOG_FMT(WIIMOTE, "WiiRemote: M+ poll failed.");