[Lldb-commits] [PATCH] D84440: [llb] Remove the user-defined copy-ctor in ConstString

Jonas Devlieghere via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Jul 23 09:39:07 PDT 2020


JDevlieghere created this revision.
JDevlieghere added reviewers: labath, aprantl.

ConstString is essentially trivially copyable yet it has a user defined copy constructor that copies its one member pointer. Remove it so it qualifies as trivial in the eyes of the compiler.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D84440

Files:
  lldb/include/lldb/Utility/ConstString.h


Index: lldb/include/lldb/Utility/ConstString.h
===================================================================
--- lldb/include/lldb/Utility/ConstString.h
+++ lldb/include/lldb/Utility/ConstString.h
@@ -44,14 +44,6 @@
   /// Initializes the string to an empty string.
   ConstString() : m_string(nullptr) {}
 
-  /// Copy constructor
-  ///
-  /// Copies the string value in \a rhs into this object.
-  ///
-  /// \param[in] rhs
-  ///     Another string object to copy.
-  ConstString(const ConstString &rhs) : m_string(rhs.m_string) {}
-
   explicit ConstString(const llvm::StringRef &s);
 
   /// Construct with C String value
@@ -86,12 +78,6 @@
   ///     from \a cstr.
   explicit ConstString(const char *cstr, size_t max_cstr_len);
 
-  /// Destructor
-  ///
-  /// Since constant string values are currently not reference counted, there
-  /// isn't much to do here.
-  ~ConstString() = default;
-
   /// C string equality binary predicate function object for ConstString
   /// objects.
   struct StringIsEqual {
@@ -124,20 +110,6 @@
   ///     false otherwise.
   explicit operator bool() const { return !IsEmpty(); }
 
-  /// Assignment operator
-  ///
-  /// Assigns the string in this object with the value from \a rhs.
-  ///
-  /// \param[in] rhs
-  ///     Another string object to copy into this object.
-  ///
-  /// \return
-  ///     A const reference to this object.
-  ConstString operator=(ConstString rhs) {
-    m_string = rhs.m_string;
-    return *this;
-  }
-
   /// Equal to operator
   ///
   /// Returns true if this string is equal to the string in \a rhs. This


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D84440.280174.patch
Type: text/x-patch
Size: 1597 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200723/bc84699b/attachment.bin>


More information about the lldb-commits mailing list