[lldb] Remove the user-defined copy-ctor in ConstString

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.

This also fixes two unused variable warnings now that the compiler knows
that the constructor has no side-effects.

Differential revision: https://reviews.llvm.org/D84440
This commit is contained in:
Jonas Devlieghere 2020-07-23 13:06:51 -07:00
parent ac375c2fe3
commit cee60bbf41
2 changed files with 2 additions and 33 deletions

View File

@ -42,15 +42,7 @@ public:
/// Default constructor
///
/// 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) {}
ConstString() = default;
explicit ConstString(const llvm::StringRef &s);
@ -86,12 +78,6 @@ public:
/// 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 @@ public:
/// 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
@ -445,8 +417,7 @@ protected:
return s;
};
// Member variables
const char *m_string;
const char *m_string = nullptr;
};
/// Stream the string value \a str to the stream \a s

View File

@ -1189,9 +1189,7 @@ public:
ListenerSP listener_sp(
Listener::MakeListener("lldb.IOHandler.curses.Application"));
ConstString broadcaster_class_target(Target::GetStaticBroadcasterClass());
ConstString broadcaster_class_process(Process::GetStaticBroadcasterClass());
ConstString broadcaster_class_thread(Thread::GetStaticBroadcasterClass());
debugger.EnableForwardEvents(listener_sp);
bool update = true;