[lldb] Add missings moves where appropiate (NFC)

Manually curated list of things found by clang-tidy's
performance-unnecessary-value-param.
This commit is contained in:
Jonas Devlieghere 2020-08-10 21:01:23 -07:00
parent 02af25df2b
commit c4701c9c62
13 changed files with 24 additions and 23 deletions

View File

@ -545,7 +545,7 @@ public:
/// if the condition says to stop and false otherwise. /// if the condition says to stop and false otherwise.
/// ///
void SetPrecondition(lldb::BreakpointPreconditionSP precondition_sp) { void SetPrecondition(lldb::BreakpointPreconditionSP precondition_sp) {
m_precondition_sp = precondition_sp; m_precondition_sp = std::move(precondition_sp);
} }
bool EvaluatePrecondition(StoppointCallbackContext &context); bool EvaluatePrecondition(StoppointCallbackContext &context);

View File

@ -702,12 +702,12 @@ public:
} }
void SetSummaryFormat(lldb::TypeSummaryImplSP format) { void SetSummaryFormat(lldb::TypeSummaryImplSP format) {
m_type_summary_sp = format; m_type_summary_sp = std::move(format);
ClearUserVisibleData(eClearUserVisibleDataItemsSummary); ClearUserVisibleData(eClearUserVisibleDataItemsSummary);
} }
void SetValueFormat(lldb::TypeFormatImplSP format) { void SetValueFormat(lldb::TypeFormatImplSP format) {
m_type_format_sp = format; m_type_format_sp = std::move(format);
ClearUserVisibleData(eClearUserVisibleDataItemsValue); ClearUserVisibleData(eClearUserVisibleDataItemsValue);
} }

View File

@ -74,7 +74,7 @@ public:
: m_type_name(type_name), m_is_regex(false) {} : m_type_name(type_name), m_is_regex(false) {}
/// Creates a matcher that accepts any type matching the given regex. /// Creates a matcher that accepts any type matching the given regex.
TypeMatcher(RegularExpression regex) TypeMatcher(RegularExpression regex)
: m_type_name_regex(regex), m_is_regex(true) {} : m_type_name_regex(std::move(regex)), m_is_regex(true) {}
/// True iff this matches the given type name. /// True iff this matches the given type name.
bool Matches(ConstString type_name) const { bool Matches(ConstString type_name) const {

View File

@ -109,7 +109,7 @@ public:
uint64_t GetLocation() const { return m_location; } uint64_t GetLocation() const { return m_location; }
void SetProcessSP(lldb::ProcessSP p) { m_process_sp = p; } void SetProcessSP(lldb::ProcessSP p) { m_process_sp = std::move(p); }
lldb::ProcessSP GetProcessSP() const { return m_process_sp; } lldb::ProcessSP GetProcessSP() const { return m_process_sp; }

View File

@ -91,52 +91,52 @@ public:
template <typename U = TypeFormatImpl> template <typename U = TypeFormatImpl>
typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type
SetExact(FormatContainer::ExactMatchForEachCallback callback) { SetExact(FormatContainer::ExactMatchForEachCallback callback) {
m_format_exact = callback; m_format_exact = std::move(callback);
return *this; return *this;
} }
template <typename U = TypeFormatImpl> template <typename U = TypeFormatImpl>
typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type
SetWithRegex(FormatContainer::RegexMatchForEachCallback callback) { SetWithRegex(FormatContainer::RegexMatchForEachCallback callback) {
m_format_regex = callback; m_format_regex = std::move(callback);
return *this; return *this;
} }
template <typename U = TypeSummaryImpl> template <typename U = TypeSummaryImpl>
typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type
SetExact(SummaryContainer::ExactMatchForEachCallback callback) { SetExact(SummaryContainer::ExactMatchForEachCallback callback) {
m_summary_exact = callback; m_summary_exact = std::move(callback);
return *this; return *this;
} }
template <typename U = TypeSummaryImpl> template <typename U = TypeSummaryImpl>
typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type
SetWithRegex(SummaryContainer::RegexMatchForEachCallback callback) { SetWithRegex(SummaryContainer::RegexMatchForEachCallback callback) {
m_summary_regex = callback; m_summary_regex = std::move(callback);
return *this; return *this;
} }
template <typename U = TypeFilterImpl> template <typename U = TypeFilterImpl>
typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type
SetExact(FilterContainer::ExactMatchForEachCallback callback) { SetExact(FilterContainer::ExactMatchForEachCallback callback) {
m_filter_exact = callback; m_filter_exact = std::move(callback);
return *this; return *this;
} }
template <typename U = TypeFilterImpl> template <typename U = TypeFilterImpl>
typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type
SetWithRegex(FilterContainer::RegexMatchForEachCallback callback) { SetWithRegex(FilterContainer::RegexMatchForEachCallback callback) {
m_filter_regex = callback; m_filter_regex = std::move(callback);
return *this; return *this;
} }
template <typename U = SyntheticChildren> template <typename U = SyntheticChildren>
typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type
SetExact(SynthContainer::ExactMatchForEachCallback callback) { SetExact(SynthContainer::ExactMatchForEachCallback callback) {
m_synth_exact = callback; m_synth_exact = std::move(callback);
return *this; return *this;
} }
template <typename U = SyntheticChildren> template <typename U = SyntheticChildren>
typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type
SetWithRegex(SynthContainer::RegexMatchForEachCallback callback) { SetWithRegex(SynthContainer::RegexMatchForEachCallback callback) {
m_synth_regex = callback; m_synth_regex = std::move(callback);
return *this; return *this;
} }

View File

@ -84,7 +84,8 @@ private:
lldb::TypeCategoryImplSP ptr; lldb::TypeCategoryImplSP ptr;
public: public:
delete_matching_categories(lldb::TypeCategoryImplSP p) : ptr(p) {} delete_matching_categories(lldb::TypeCategoryImplSP p)
: ptr(std::move(p)) {}
bool operator()(const lldb::TypeCategoryImplSP &other) { bool operator()(const lldb::TypeCategoryImplSP &other) {
return ptr.get() == other.get(); return ptr.get() == other.get();

View File

@ -322,7 +322,7 @@ struct CXXFunctionSummaryFormat : public TypeSummaryImpl {
const char *GetTextualInfo() const { return m_description.c_str(); } const char *GetTextualInfo() const { return m_description.c_str(); }
void SetBackendFunction(Callback cb_func) { m_impl = cb_func; } void SetBackendFunction(Callback cb_func) { m_impl = std::move(cb_func); }
void SetTextualInfo(const char *descr) { void SetTextualInfo(const char *descr) {
if (descr) if (descr)

View File

@ -362,7 +362,7 @@ public:
CreateFrontEndCallback; CreateFrontEndCallback;
CXXSyntheticChildren(const SyntheticChildren::Flags &flags, CXXSyntheticChildren(const SyntheticChildren::Flags &flags,
const char *description, CreateFrontEndCallback callback) const char *description, CreateFrontEndCallback callback)
: SyntheticChildren(flags), m_create_callback(callback), : SyntheticChildren(flags), m_create_callback(std::move(callback)),
m_description(description ? description : "") {} m_description(description ? description : "") {}
bool IsScripted() override { return false; } bool IsScripted() override { return false; }

View File

@ -35,11 +35,11 @@ public:
: m_fs(llvm::vfs::getRealFileSystem()), m_collector(nullptr), : m_fs(llvm::vfs::getRealFileSystem()), m_collector(nullptr),
m_mapped(false) {} m_mapped(false) {}
FileSystem(std::shared_ptr<llvm::FileCollector> collector) FileSystem(std::shared_ptr<llvm::FileCollector> collector)
: m_fs(llvm::vfs::getRealFileSystem()), m_collector(collector), : m_fs(llvm::vfs::getRealFileSystem()), m_collector(std::move(collector)),
m_mapped(false) {} m_mapped(false) {}
FileSystem(llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> fs, FileSystem(llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> fs,
bool mapped = false) bool mapped = false)
: m_fs(fs), m_collector(nullptr), m_mapped(mapped) {} : m_fs(std::move(fs)), m_collector(nullptr), m_mapped(mapped) {}
FileSystem(const FileSystem &fs) = delete; FileSystem(const FileSystem &fs) = delete;
FileSystem &operator=(const FileSystem &fs) = delete; FileSystem &operator=(const FileSystem &fs) = delete;

View File

@ -53,7 +53,7 @@ protected:
lldb::ModuleSP GetRuntimeModuleSP() { return m_runtime_module; } lldb::ModuleSP GetRuntimeModuleSP() { return m_runtime_module; }
void SetRuntimeModuleSP(lldb::ModuleSP module_sp) { void SetRuntimeModuleSP(lldb::ModuleSP module_sp) {
m_runtime_module = module_sp; m_runtime_module = std::move(module_sp);
} }
lldb::user_id_t GetBreakpointID() const { return m_breakpoint_id; } lldb::user_id_t GetBreakpointID() const { return m_breakpoint_id; }

View File

@ -327,7 +327,7 @@ public:
} }
void SetStopEventForLastNaturalStopID(lldb::EventSP event_sp) { void SetStopEventForLastNaturalStopID(lldb::EventSP event_sp) {
m_last_natural_stop_event = event_sp; m_last_natural_stop_event = std::move(event_sp);
} }
lldb::EventSP GetStopEventForStopID(uint32_t stop_id) const { lldb::EventSP GetStopEventForStopID(uint32_t stop_id) const {
@ -2164,7 +2164,7 @@ public:
public: public:
ProcessEventHijacker(Process &process, lldb::ListenerSP listener_sp) ProcessEventHijacker(Process &process, lldb::ListenerSP listener_sp)
: m_process(process) { : m_process(process) {
m_process.HijackProcessEvents(listener_sp); m_process.HijackProcessEvents(std::move(listener_sp));
} }
~ProcessEventHijacker() { m_process.RestoreProcessEvents(); } ~ProcessEventHijacker() { m_process.RestoreProcessEvents(); }

View File

@ -776,7 +776,7 @@ repro::DataRecorder *Debugger::GetInputRecorder() { return m_input_recorder; }
void Debugger::SetInputFile(FileSP file_sp, repro::DataRecorder *recorder) { void Debugger::SetInputFile(FileSP file_sp, repro::DataRecorder *recorder) {
assert(file_sp && file_sp->IsValid()); assert(file_sp && file_sp->IsValid());
m_input_recorder = recorder; m_input_recorder = recorder;
m_input_file_sp = file_sp; m_input_file_sp = std::move(file_sp);
// Save away the terminal state if that is relevant, so that we can restore // Save away the terminal state if that is relevant, so that we can restore
// it in RestoreInputState. // it in RestoreInputState.
SaveInputTerminalState(); SaveInputTerminalState();

View File

@ -46,7 +46,7 @@ public:
ValueObjectSynthetic::ValueObjectSynthetic(ValueObject &parent, ValueObjectSynthetic::ValueObjectSynthetic(ValueObject &parent,
lldb::SyntheticChildrenSP filter) lldb::SyntheticChildrenSP filter)
: ValueObject(parent), m_synth_sp(filter), m_children_byindex(), : ValueObject(parent), m_synth_sp(std::move(filter)), m_children_byindex(),
m_name_toindex(), m_synthetic_children_cache(), m_name_toindex(), m_synthetic_children_cache(),
m_synthetic_children_count(UINT32_MAX), m_synthetic_children_count(UINT32_MAX),
m_parent_type_name(parent.GetTypeName()), m_parent_type_name(parent.GetTypeName()),