[Lldb-commits] [lldb] a14eb8f - lldb: Fix some -Wdeprecated-copy warnings

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Mon Nov 11 08:54:40 PST 2019


Author: Pavel Labath
Date: 2019-11-11T17:55:49+01:00
New Revision: a14eb8f47d43c701651ad59f49167a614a8c9773

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

LOG: lldb: Fix some -Wdeprecated-copy warnings

gcc-9 started warning when a class defined a copy constructor without a
copy assignment operator (or vice-versa).

This fixes those warnings by deleting the other special member too
(after verifying it doesn't do anything non-trivial).

Added: 
    

Modified: 
    lldb/include/lldb/Interpreter/OptionValue.h
    lldb/include/lldb/Symbol/Declaration.h
    lldb/include/lldb/Symbol/SymbolContext.h
    lldb/include/lldb/Utility/ArchSpec.h
    lldb/include/lldb/Utility/Broadcaster.h
    lldb/include/lldb/Utility/FileSpec.h
    lldb/include/lldb/Utility/Flags.h
    lldb/include/lldb/Utility/Scalar.h
    lldb/include/lldb/Utility/Status.h
    lldb/source/Symbol/SymbolContext.cpp
    lldb/source/Utility/ArchSpec.cpp
    lldb/source/Utility/Broadcaster.cpp
    lldb/source/Utility/FileSpec.cpp
    lldb/source/Utility/Scalar.cpp
    lldb/source/Utility/Status.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/include/lldb/Interpreter/OptionValue.h b/lldb/include/lldb/Interpreter/OptionValue.h
index 9fc18551c26a..734c92b4bcad 100644
--- a/lldb/include/lldb/Interpreter/OptionValue.h
+++ b/lldb/include/lldb/Interpreter/OptionValue.h
@@ -61,10 +61,6 @@ class OptionValue {
   OptionValue()
       : m_callback(nullptr), m_baton(nullptr), m_value_was_set(false) {}
 
-  OptionValue(const OptionValue &rhs)
-      : m_callback(rhs.m_callback), m_baton(rhs.m_baton),
-        m_value_was_set(rhs.m_value_was_set) {}
-
   virtual ~OptionValue() = default;
 
   // Subclasses should override these functions

diff  --git a/lldb/include/lldb/Symbol/Declaration.h b/lldb/include/lldb/Symbol/Declaration.h
index 63798f883e5f..4b8ece02f9c7 100644
--- a/lldb/include/lldb/Symbol/Declaration.h
+++ b/lldb/include/lldb/Symbol/Declaration.h
@@ -55,16 +55,6 @@ class Declaration {
   {
   }
 
-  /// Construct with a reference to another Declaration object.
-  Declaration(const Declaration &rhs)
-      : m_file(rhs.m_file), m_line(rhs.m_line)
-#ifdef LLDB_ENABLE_DECLARATION_COLUMNS
-        ,
-        m_column(rhs.m_column)
-#endif
-  {
-  }
-
   /// Construct with a pointer to another Declaration object.
   Declaration(const Declaration *decl_ptr)
       : m_file(), m_line(0)

diff  --git a/lldb/include/lldb/Symbol/SymbolContext.h b/lldb/include/lldb/Symbol/SymbolContext.h
index 76ec1a7de68e..34735ab95578 100644
--- a/lldb/include/lldb/Symbol/SymbolContext.h
+++ b/lldb/include/lldb/Symbol/SymbolContext.h
@@ -84,18 +84,6 @@ class SymbolContext {
 
   ~SymbolContext();
 
-  /// Assignment operator.
-  ///
-  /// Copies the address value from another SymbolContext object \a rhs into
-  /// \a this object.
-  ///
-  /// \param[in] rhs
-  ///     A const SymbolContext object reference to copy.
-  ///
-  /// \return
-  ///     A const SymbolContext object reference to \a this.
-  const SymbolContext &operator=(const SymbolContext &rhs);
-
   /// Clear the object's state.
   ///
   /// Resets all pointer members to nullptr, and clears any class objects to

diff  --git a/lldb/include/lldb/Utility/ArchSpec.h b/lldb/include/lldb/Utility/ArchSpec.h
index 3bfc988abf0b..bd8c421c3bfc 100644
--- a/lldb/include/lldb/Utility/ArchSpec.h
+++ b/lldb/include/lldb/Utility/ArchSpec.h
@@ -258,13 +258,6 @@ class ArchSpec {
   /// Destructor.
   ~ArchSpec();
 
-  /// Assignment operator.
-  ///
-  /// \param[in] rhs another ArchSpec object to copy.
-  ///
-  /// \return A const reference to this object.
-  const ArchSpec &operator=(const ArchSpec &rhs);
-
   /// Returns true if the OS, vendor and environment fields of the triple are
   /// unset. The triple is expected to be normalized
   /// (llvm::Triple::normalize).

diff  --git a/lldb/include/lldb/Utility/Broadcaster.h b/lldb/include/lldb/Utility/Broadcaster.h
index fe4d1ca479b8..ead597d626d7 100644
--- a/lldb/include/lldb/Utility/Broadcaster.h
+++ b/lldb/include/lldb/Utility/Broadcaster.h
@@ -65,7 +65,6 @@ class BroadcastEventSpec {
   }
 
   bool operator<(const BroadcastEventSpec &rhs) const;
-  BroadcastEventSpec &operator=(const BroadcastEventSpec &rhs);
 
 private:
   ConstString m_broadcaster_class;

diff  --git a/lldb/include/lldb/Utility/FileSpec.h b/lldb/include/lldb/Utility/FileSpec.h
index 50ad1f1600d8..53b0a9c08699 100644
--- a/lldb/include/lldb/Utility/FileSpec.h
+++ b/lldb/include/lldb/Utility/FileSpec.h
@@ -91,17 +91,6 @@ class FileSpec {
 
   bool FileEquals(const FileSpec &other) const;
 
-  /// Assignment operator.
-  ///
-  /// Makes a copy of the uniqued directory and filename strings from \a rhs.
-  ///
-  /// \param[in] rhs
-  ///     A const FileSpec object reference to assign to this object.
-  ///
-  /// \return
-  ///     A const reference to this object.
-  const FileSpec &operator=(const FileSpec &rhs);
-
   /// Equal to operator
   ///
   /// Tests if this object is equal to \a rhs.

diff  --git a/lldb/include/lldb/Utility/Flags.h b/lldb/include/lldb/Utility/Flags.h
index aa869eca0c6e..254a5ec443c3 100644
--- a/lldb/include/lldb/Utility/Flags.h
+++ b/lldb/include/lldb/Utility/Flags.h
@@ -33,17 +33,6 @@ class Flags {
   ///     The initial value for all flags.
   Flags(ValueType flags = 0) : m_flags(flags) {}
 
-  /// Copy constructor.
-  ///
-  /// Construct and copy the flags from \a rhs.
-  ///
-  /// \param[in] rhs
-  ///     A const Flags object reference to copy.
-  Flags(const Flags &rhs) : m_flags(rhs.m_flags) {}
-
-  /// Destructor.
-  ~Flags() {}
-
   /// Get accessor for all flags.
   ///
   /// \return

diff  --git a/lldb/include/lldb/Utility/Scalar.h b/lldb/include/lldb/Utility/Scalar.h
index 72f153ff97cd..69c948ec6222 100644
--- a/lldb/include/lldb/Utility/Scalar.h
+++ b/lldb/include/lldb/Utility/Scalar.h
@@ -172,7 +172,6 @@ class Scalar {
   Scalar &operator=(double v);
   Scalar &operator=(long double v);
   Scalar &operator=(llvm::APInt v);
-  Scalar &operator=(const Scalar &rhs); // Assignment operator
   Scalar &operator+=(const Scalar &rhs);
   Scalar &operator<<=(const Scalar &rhs); // Shift left
   Scalar &operator>>=(const Scalar &rhs); // Shift right (arithmetic)

diff  --git a/lldb/include/lldb/Utility/Status.h b/lldb/include/lldb/Utility/Status.h
index e6a0a8e7fce1..36f52922c9bc 100644
--- a/lldb/include/lldb/Utility/Status.h
+++ b/lldb/include/lldb/Utility/Status.h
@@ -64,8 +64,6 @@ class Status {
   explicit Status(const char *format, ...)
       __attribute__((format(printf, 2, 3)));
 
-  const Status &operator=(const Status &rhs);
-
   ~Status();
 
   // llvm::Error support

diff  --git a/lldb/source/Symbol/SymbolContext.cpp b/lldb/source/Symbol/SymbolContext.cpp
index 31e0c89eed94..7828ca613359 100644
--- a/lldb/source/Symbol/SymbolContext.cpp
+++ b/lldb/source/Symbol/SymbolContext.cpp
@@ -55,20 +55,6 @@ SymbolContext::SymbolContext(SymbolContextScope *sc_scope)
 
 SymbolContext::~SymbolContext() {}
 
-const SymbolContext &SymbolContext::operator=(const SymbolContext &rhs) {
-  if (this != &rhs) {
-    target_sp = rhs.target_sp;
-    module_sp = rhs.module_sp;
-    comp_unit = rhs.comp_unit;
-    function = rhs.function;
-    block = rhs.block;
-    line_entry = rhs.line_entry;
-    symbol = rhs.symbol;
-    variable = rhs.variable;
-  }
-  return *this;
-}
-
 void SymbolContext::Clear(bool clear_target) {
   if (clear_target)
     target_sp.reset();

diff  --git a/lldb/source/Utility/ArchSpec.cpp b/lldb/source/Utility/ArchSpec.cpp
index 40cc4a092b0d..a8781251ef8a 100644
--- a/lldb/source/Utility/ArchSpec.cpp
+++ b/lldb/source/Utility/ArchSpec.cpp
@@ -564,20 +564,6 @@ ArchSpec::ArchSpec(ArchitectureType arch_type, uint32_t cpu, uint32_t subtype) {
 
 ArchSpec::~ArchSpec() = default;
 
-//===----------------------------------------------------------------------===//
-// Assignment and initialization.
-
-const ArchSpec &ArchSpec::operator=(const ArchSpec &rhs) {
-  if (this != &rhs) {
-    m_triple = rhs.m_triple;
-    m_core = rhs.m_core;
-    m_byte_order = rhs.m_byte_order;
-    m_distribution_id = rhs.m_distribution_id;
-    m_flags = rhs.m_flags;
-  }
-  return *this;
-}
-
 void ArchSpec::Clear() {
   m_triple = llvm::Triple();
   m_core = kCore_invalid;

diff  --git a/lldb/source/Utility/Broadcaster.cpp b/lldb/source/Utility/Broadcaster.cpp
index 148fdf7ba5b1..aeb72ce2685d 100644
--- a/lldb/source/Utility/Broadcaster.cpp
+++ b/lldb/source/Utility/Broadcaster.cpp
@@ -318,9 +318,6 @@ bool BroadcastEventSpec::operator<(const BroadcastEventSpec &rhs) const {
   return GetBroadcasterClass() < rhs.GetBroadcasterClass();
 }
 
-BroadcastEventSpec &BroadcastEventSpec::
-operator=(const BroadcastEventSpec &rhs) = default;
-
 BroadcasterManager::BroadcasterManager() : m_manager_mutex() {}
 
 lldb::BroadcasterManagerSP BroadcasterManager::MakeBroadcasterManager() {

diff  --git a/lldb/source/Utility/FileSpec.cpp b/lldb/source/Utility/FileSpec.cpp
index f22ab4d84e40..88966843072b 100644
--- a/lldb/source/Utility/FileSpec.cpp
+++ b/lldb/source/Utility/FileSpec.cpp
@@ -173,16 +173,6 @@ bool needsNormalization(const llvm::StringRef &path) {
 }
 
 
-}
-// Assignment operator.
-const FileSpec &FileSpec::operator=(const FileSpec &rhs) {
-  if (this != &rhs) {
-    m_directory = rhs.m_directory;
-    m_filename = rhs.m_filename;
-    m_is_resolved = rhs.m_is_resolved;
-    m_style = rhs.m_style;
-  }
-  return *this;
 }
 
 void FileSpec::SetFile(llvm::StringRef pathname) { SetFile(pathname, m_style); }

diff  --git a/lldb/source/Utility/Scalar.cpp b/lldb/source/Utility/Scalar.cpp
index e9aec17b6650..aefa8c744905 100644
--- a/lldb/source/Utility/Scalar.cpp
+++ b/lldb/source/Utility/Scalar.cpp
@@ -305,15 +305,6 @@ const char *Scalar::GetTypeAsCString() const {
   return "<invalid Scalar type>";
 }
 
-Scalar &Scalar::operator=(const Scalar &rhs) {
-  if (this != &rhs) {
-    m_type = rhs.m_type;
-    m_integer = llvm::APInt(rhs.m_integer);
-    m_float = rhs.m_float;
-  }
-  return *this;
-}
-
 Scalar &Scalar::operator=(const int v) {
   m_type = e_sint;
   m_integer = llvm::APInt(sizeof(int) * 8, v, true);

diff  --git a/lldb/source/Utility/Status.cpp b/lldb/source/Utility/Status.cpp
index 3d64fb810abf..3b5094d64b75 100644
--- a/lldb/source/Utility/Status.cpp
+++ b/lldb/source/Utility/Status.cpp
@@ -93,16 +93,6 @@ llvm::Error Status::ToError() const {
                                              llvm::inconvertibleErrorCode());
 }
 
-// Assignment operator
-const Status &Status::operator=(const Status &rhs) {
-  if (this != &rhs) {
-    m_code = rhs.m_code;
-    m_type = rhs.m_type;
-    m_string = rhs.m_string;
-  }
-  return *this;
-}
-
 Status::~Status() = default;
 
 #ifdef _WIN32


        


More information about the lldb-commits mailing list