[Lldb-commits] [lldb] 6dc2a6a - Remove some unnecessary explicit defaulted copy ctors to cleanup -Wdeprecated-copy

David Blaikie via lldb-commits lldb-commits at lists.llvm.org
Mon May 10 14:31:21 PDT 2021


Author: David Blaikie
Date: 2021-05-10T14:31:11-07:00
New Revision: 6dc2a6a8c9a0e4f8b46a0ba05430b77229789b8e

URL: https://github.com/llvm/llvm-project/commit/6dc2a6a8c9a0e4f8b46a0ba05430b77229789b8e
DIFF: https://github.com/llvm/llvm-project/commit/6dc2a6a8c9a0e4f8b46a0ba05430b77229789b8e.diff

LOG: Remove some unnecessary explicit defaulted copy ctors to cleanup -Wdeprecated-copy

These types also wanted to be/were copy assignable, and using the
implicit copy ctor is deprecated in the presence of an explicit copy
ctor.

Removing the explicit copy ctor provides the desired behavior - both
ctor and assignment operator are available implicitly.

Also while I was nearby there were some missing std::moves on shared
pointer parameters.

Added: 
    

Modified: 
    lldb/include/lldb/DataFormatters/DumpValueObjectOptions.h
    lldb/include/lldb/Symbol/UnwindPlan.h
    lldb/include/lldb/Utility/Timeout.h
    lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp
    lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/include/lldb/DataFormatters/DumpValueObjectOptions.h b/lldb/include/lldb/DataFormatters/DumpValueObjectOptions.h
index 2f3bdf80a6f17..4d54f03a2e03c 100644
--- a/lldb/include/lldb/DataFormatters/DumpValueObjectOptions.h
+++ b/lldb/include/lldb/DataFormatters/DumpValueObjectOptions.h
@@ -62,8 +62,6 @@ class DumpValueObjectOptions {
 
   DumpValueObjectOptions();
 
-  DumpValueObjectOptions(const DumpValueObjectOptions &rhs) = default;
-
   DumpValueObjectOptions(ValueObject &valobj);
 
   DumpValueObjectOptions &

diff  --git a/lldb/include/lldb/Symbol/UnwindPlan.h b/lldb/include/lldb/Symbol/UnwindPlan.h
index 06c76ca80796b..f8d23d7b7f231 100644
--- a/lldb/include/lldb/Symbol/UnwindPlan.h
+++ b/lldb/include/lldb/Symbol/UnwindPlan.h
@@ -322,8 +322,6 @@ class UnwindPlan {
 
     Row();
 
-    Row(const UnwindPlan::Row &rhs) = default;
-
     bool operator==(const Row &rhs) const;
 
     bool GetRegisterInfo(uint32_t reg_num,

diff  --git a/lldb/include/lldb/Utility/Timeout.h b/lldb/include/lldb/Utility/Timeout.h
index 80e2015155770..29f8c1bbee380 100644
--- a/lldb/include/lldb/Utility/Timeout.h
+++ b/lldb/include/lldb/Utility/Timeout.h
@@ -37,7 +37,6 @@ class Timeout : public llvm::Optional<std::chrono::duration<int64_t, Ratio>> {
 
 public:
   Timeout(llvm::NoneType none) : Base(none) {}
-  Timeout(const Timeout &other) = default;
 
   template <typename Ratio2,
             typename = typename EnableIf<int64_t, Ratio2>::type>

diff  --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp
index 0d5ae16a0b295..47c6634ed65e6 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp
@@ -27,8 +27,7 @@ namespace {
 class ListEntry {
 public:
   ListEntry() = default;
-  ListEntry(ValueObjectSP entry_sp) : m_entry_sp(entry_sp) {}
-  ListEntry(const ListEntry &rhs) = default;
+  ListEntry(ValueObjectSP entry_sp) : m_entry_sp(std::move(entry_sp)) {}
   ListEntry(ValueObject *entry)
       : m_entry_sp(entry ? entry->GetSP() : ValueObjectSP()) {}
 
@@ -73,9 +72,8 @@ class ListEntry {
 class ListIterator {
 public:
   ListIterator() = default;
-  ListIterator(ListEntry entry) : m_entry(entry) {}
-  ListIterator(ValueObjectSP entry) : m_entry(entry) {}
-  ListIterator(const ListIterator &rhs) = default;
+  ListIterator(ListEntry entry) : m_entry(std::move(entry)) {}
+  ListIterator(ValueObjectSP entry) : m_entry(std::move(entry)) {}
   ListIterator(ValueObject *entry) : m_entry(entry) {}
 
   ValueObjectSP value() { return m_entry.GetEntry(); }

diff  --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp
index 64a199e24e4a5..25c2bfd9387bb 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp
@@ -26,7 +26,6 @@ class MapEntry {
 public:
   MapEntry() = default;
   explicit MapEntry(ValueObjectSP entry_sp) : m_entry_sp(entry_sp) {}
-  MapEntry(const MapEntry &rhs) = default;
   explicit MapEntry(ValueObject *entry)
       : m_entry_sp(entry ? entry->GetSP() : ValueObjectSP()) {}
 
@@ -86,9 +85,9 @@ class MapIterator {
 public:
   MapIterator() = default;
   MapIterator(MapEntry entry, size_t depth = 0)
-      : m_entry(entry), m_max_depth(depth), m_error(false) {}
+      : m_entry(std::move(entry)), m_max_depth(depth), m_error(false) {}
   MapIterator(ValueObjectSP entry, size_t depth = 0)
-      : m_entry(entry), m_max_depth(depth), m_error(false) {}
+      : m_entry(std::move(entry)), m_max_depth(depth), m_error(false) {}
   MapIterator(const MapIterator &rhs)
       : m_entry(rhs.m_entry), m_max_depth(rhs.m_max_depth), m_error(false) {}
   MapIterator(ValueObject *entry, size_t depth = 0)
@@ -138,7 +137,7 @@ class MapIterator {
   }
 
 private:
-  MapEntry tree_min(MapEntry &&x) {
+  MapEntry tree_min(MapEntry x) {
     if (x.null())
       return MapEntry();
     MapEntry left(x.left());


        


More information about the lldb-commits mailing list