Skip to content

Commit c4701c9

Browse files
committed
[lldb] Add missings moves where appropiate (NFC)
Manually curated list of things found by clang-tidy's performance-unnecessary-value-param.
1 parent 02af25d commit c4701c9

File tree

13 files changed

+24
-23
lines changed

13 files changed

+24
-23
lines changed

lldb/include/lldb/Breakpoint/Breakpoint.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ class Breakpoint : public std::enable_shared_from_this<Breakpoint>,
545545
/// if the condition says to stop and false otherwise.
546546
///
547547
void SetPrecondition(lldb::BreakpointPreconditionSP precondition_sp) {
548-
m_precondition_sp = precondition_sp;
548+
m_precondition_sp = std::move(precondition_sp);
549549
}
550550

551551
bool EvaluatePrecondition(StoppointCallbackContext &context);

lldb/include/lldb/Core/ValueObject.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -702,12 +702,12 @@ class ValueObject : public UserID {
702702
}
703703

704704
void SetSummaryFormat(lldb::TypeSummaryImplSP format) {
705-
m_type_summary_sp = format;
705+
m_type_summary_sp = std::move(format);
706706
ClearUserVisibleData(eClearUserVisibleDataItemsSummary);
707707
}
708708

709709
void SetValueFormat(lldb::TypeFormatImplSP format) {
710-
m_type_format_sp = format;
710+
m_type_format_sp = std::move(format);
711711
ClearUserVisibleData(eClearUserVisibleDataItemsValue);
712712
}
713713

lldb/include/lldb/DataFormatters/FormattersContainer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class TypeMatcher {
7474
: m_type_name(type_name), m_is_regex(false) {}
7575
/// Creates a matcher that accepts any type matching the given regex.
7676
TypeMatcher(RegularExpression regex)
77-
: m_type_name_regex(regex), m_is_regex(true) {}
77+
: m_type_name_regex(std::move(regex)), m_is_regex(true) {}
7878

7979
/// True iff this matches the given type name.
8080
bool Matches(ConstString type_name) const {

lldb/include/lldb/DataFormatters/StringPrinter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ class StringPrinter {
109109

110110
uint64_t GetLocation() const { return m_location; }
111111

112-
void SetProcessSP(lldb::ProcessSP p) { m_process_sp = p; }
112+
void SetProcessSP(lldb::ProcessSP p) { m_process_sp = std::move(p); }
113113

114114
lldb::ProcessSP GetProcessSP() const { return m_process_sp; }
115115

lldb/include/lldb/DataFormatters/TypeCategory.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,52 +91,52 @@ class TypeCategoryImpl {
9191
template <typename U = TypeFormatImpl>
9292
typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type
9393
SetExact(FormatContainer::ExactMatchForEachCallback callback) {
94-
m_format_exact = callback;
94+
m_format_exact = std::move(callback);
9595
return *this;
9696
}
9797
template <typename U = TypeFormatImpl>
9898
typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type
9999
SetWithRegex(FormatContainer::RegexMatchForEachCallback callback) {
100-
m_format_regex = callback;
100+
m_format_regex = std::move(callback);
101101
return *this;
102102
}
103103

104104
template <typename U = TypeSummaryImpl>
105105
typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type
106106
SetExact(SummaryContainer::ExactMatchForEachCallback callback) {
107-
m_summary_exact = callback;
107+
m_summary_exact = std::move(callback);
108108
return *this;
109109
}
110110
template <typename U = TypeSummaryImpl>
111111
typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type
112112
SetWithRegex(SummaryContainer::RegexMatchForEachCallback callback) {
113-
m_summary_regex = callback;
113+
m_summary_regex = std::move(callback);
114114
return *this;
115115
}
116116

117117
template <typename U = TypeFilterImpl>
118118
typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type
119119
SetExact(FilterContainer::ExactMatchForEachCallback callback) {
120-
m_filter_exact = callback;
120+
m_filter_exact = std::move(callback);
121121
return *this;
122122
}
123123
template <typename U = TypeFilterImpl>
124124
typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type
125125
SetWithRegex(FilterContainer::RegexMatchForEachCallback callback) {
126-
m_filter_regex = callback;
126+
m_filter_regex = std::move(callback);
127127
return *this;
128128
}
129129

130130
template <typename U = SyntheticChildren>
131131
typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type
132132
SetExact(SynthContainer::ExactMatchForEachCallback callback) {
133-
m_synth_exact = callback;
133+
m_synth_exact = std::move(callback);
134134
return *this;
135135
}
136136
template <typename U = SyntheticChildren>
137137
typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type
138138
SetWithRegex(SynthContainer::RegexMatchForEachCallback callback) {
139-
m_synth_regex = callback;
139+
m_synth_regex = std::move(callback);
140140
return *this;
141141
}
142142

lldb/include/lldb/DataFormatters/TypeCategoryMap.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ class TypeCategoryMap {
8484
lldb::TypeCategoryImplSP ptr;
8585

8686
public:
87-
delete_matching_categories(lldb::TypeCategoryImplSP p) : ptr(p) {}
87+
delete_matching_categories(lldb::TypeCategoryImplSP p)
88+
: ptr(std::move(p)) {}
8889

8990
bool operator()(const lldb::TypeCategoryImplSP &other) {
9091
return ptr.get() == other.get();

lldb/include/lldb/DataFormatters/TypeSummary.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ struct CXXFunctionSummaryFormat : public TypeSummaryImpl {
322322

323323
const char *GetTextualInfo() const { return m_description.c_str(); }
324324

325-
void SetBackendFunction(Callback cb_func) { m_impl = cb_func; }
325+
void SetBackendFunction(Callback cb_func) { m_impl = std::move(cb_func); }
326326

327327
void SetTextualInfo(const char *descr) {
328328
if (descr)

lldb/include/lldb/DataFormatters/TypeSynthetic.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ class CXXSyntheticChildren : public SyntheticChildren {
362362
CreateFrontEndCallback;
363363
CXXSyntheticChildren(const SyntheticChildren::Flags &flags,
364364
const char *description, CreateFrontEndCallback callback)
365-
: SyntheticChildren(flags), m_create_callback(callback),
365+
: SyntheticChildren(flags), m_create_callback(std::move(callback)),
366366
m_description(description ? description : "") {}
367367

368368
bool IsScripted() override { return false; }

lldb/include/lldb/Host/FileSystem.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ class FileSystem {
3535
: m_fs(llvm::vfs::getRealFileSystem()), m_collector(nullptr),
3636
m_mapped(false) {}
3737
FileSystem(std::shared_ptr<llvm::FileCollector> collector)
38-
: m_fs(llvm::vfs::getRealFileSystem()), m_collector(collector),
38+
: m_fs(llvm::vfs::getRealFileSystem()), m_collector(std::move(collector)),
3939
m_mapped(false) {}
4040
FileSystem(llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> fs,
4141
bool mapped = false)
42-
: m_fs(fs), m_collector(nullptr), m_mapped(mapped) {}
42+
: m_fs(std::move(fs)), m_collector(nullptr), m_mapped(mapped) {}
4343

4444
FileSystem(const FileSystem &fs) = delete;
4545
FileSystem &operator=(const FileSystem &fs) = delete;

lldb/include/lldb/Target/InstrumentationRuntime.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class InstrumentationRuntime
5353
lldb::ModuleSP GetRuntimeModuleSP() { return m_runtime_module; }
5454

5555
void SetRuntimeModuleSP(lldb::ModuleSP module_sp) {
56-
m_runtime_module = module_sp;
56+
m_runtime_module = std::move(module_sp);
5757
}
5858

5959
lldb::user_id_t GetBreakpointID() const { return m_breakpoint_id; }

lldb/include/lldb/Target/Process.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ class ProcessModID {
327327
}
328328

329329
void SetStopEventForLastNaturalStopID(lldb::EventSP event_sp) {
330-
m_last_natural_stop_event = event_sp;
330+
m_last_natural_stop_event = std::move(event_sp);
331331
}
332332

333333
lldb::EventSP GetStopEventForStopID(uint32_t stop_id) const {
@@ -2164,7 +2164,7 @@ class Process : public std::enable_shared_from_this<Process>,
21642164
public:
21652165
ProcessEventHijacker(Process &process, lldb::ListenerSP listener_sp)
21662166
: m_process(process) {
2167-
m_process.HijackProcessEvents(listener_sp);
2167+
m_process.HijackProcessEvents(std::move(listener_sp));
21682168
}
21692169

21702170
~ProcessEventHijacker() { m_process.RestoreProcessEvents(); }

lldb/source/Core/Debugger.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,7 @@ repro::DataRecorder *Debugger::GetInputRecorder() { return m_input_recorder; }
776776
void Debugger::SetInputFile(FileSP file_sp, repro::DataRecorder *recorder) {
777777
assert(file_sp && file_sp->IsValid());
778778
m_input_recorder = recorder;
779-
m_input_file_sp = file_sp;
779+
m_input_file_sp = std::move(file_sp);
780780
// Save away the terminal state if that is relevant, so that we can restore
781781
// it in RestoreInputState.
782782
SaveInputTerminalState();

lldb/source/Core/ValueObjectSyntheticFilter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class DummySyntheticFrontEnd : public SyntheticChildrenFrontEnd {
4646

4747
ValueObjectSynthetic::ValueObjectSynthetic(ValueObject &parent,
4848
lldb::SyntheticChildrenSP filter)
49-
: ValueObject(parent), m_synth_sp(filter), m_children_byindex(),
49+
: ValueObject(parent), m_synth_sp(std::move(filter)), m_children_byindex(),
5050
m_name_toindex(), m_synthetic_children_cache(),
5151
m_synthetic_children_count(UINT32_MAX),
5252
m_parent_type_name(parent.GetTypeName()),

0 commit comments

Comments
 (0)