[Lldb-commits] [lldb] 6953dc9 - [lldb][NFC] Use move instead of copy

Michael Buch via lldb-commits lldb-commits at lists.llvm.org
Wed Feb 1 07:52:03 PST 2023


Author: Chris Cotter
Date: 2023-02-01T15:51:24Z
New Revision: 6953dc95a9761768cad3c329ebac35927df126ab

URL: https://github.com/llvm/llvm-project/commit/6953dc95a9761768cad3c329ebac35927df126ab
DIFF: https://github.com/llvm/llvm-project/commit/6953dc95a9761768cad3c329ebac35927df126ab.diff

LOG: [lldb][NFC] Use move instead of copy

Summary: For functions that accept an rvalue reference type
parameter, use move to avoid copying the parameter.

These were found when implementing CppCoreGuideline F.18 in
clang-tidy.

Committed on behalf of ccotter (Chris Cotter)

Reviewers: Michael137

Differential Revision: https://reviews.llvm.org/D142824

Added: 
    

Modified: 
    lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
    lldb/source/Plugins/TraceExporter/common/TraceHTR.cpp
    lldb/source/Target/Process.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
index bdb6480ff4d90..4ffa7faa49424 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
@@ -559,7 +559,7 @@ Status GDBRemoteCommunicationServerPlatform::LaunchProcess() {
 }
 
 void GDBRemoteCommunicationServerPlatform::SetPortMap(PortMap &&port_map) {
-  m_port_map = port_map;
+  m_port_map = std::move(port_map);
 }
 
 const FileSpec &GDBRemoteCommunicationServerPlatform::GetDomainSocketDir() {

diff  --git a/lldb/source/Plugins/TraceExporter/common/TraceHTR.cpp b/lldb/source/Plugins/TraceExporter/common/TraceHTR.cpp
index 13c63f2f7e37c..abe1581682685 100644
--- a/lldb/source/Plugins/TraceExporter/common/TraceHTR.cpp
+++ b/lldb/source/Plugins/TraceExporter/common/TraceHTR.cpp
@@ -69,7 +69,7 @@ size_t IHTRLayer::GetLayerId() const { return m_layer_id; }
 
 void HTRBlockLayer::AppendNewBlock(size_t block_id, HTRBlock &&block) {
   m_block_id_trace.emplace_back(block_id);
-  m_block_defs.emplace(block_id, block);
+  m_block_defs.emplace(block_id, std::move(block));
 }
 
 void HTRBlockLayer::AppendRepeatedBlock(size_t block_id) {

diff  --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index e0cca0595ee30..f6c53e6d4c2d0 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -3352,7 +3352,7 @@ Status Process::Signal(int signal) {
 
 void Process::SetUnixSignals(UnixSignalsSP &&signals_sp) {
   assert(signals_sp && "null signals_sp");
-  m_unix_signals_sp = signals_sp;
+  m_unix_signals_sp = std::move(signals_sp);
 }
 
 const lldb::UnixSignalsSP &Process::GetUnixSignals() {


        


More information about the lldb-commits mailing list