diff --git a/lldb/include/lldb/Utility/ConstString.h b/lldb/include/lldb/Utility/ConstString.h --- a/lldb/include/lldb/Utility/ConstString.h +++ b/lldb/include/lldb/Utility/ConstString.h @@ -44,7 +44,7 @@ /// Initializes the string to an empty string. ConstString() = default; - explicit ConstString(const llvm::StringRef &s); + explicit ConstString(llvm::StringRef s); /// Construct with C String value /// @@ -328,7 +328,7 @@ /// A NULL terminated C string to add to the string pool. void SetCString(const char *cstr); - void SetString(const llvm::StringRef &s); + void SetString(llvm::StringRef s); /// Set the C string value and its mangled counterpart. /// diff --git a/lldb/source/Utility/ConstString.cpp b/lldb/source/Utility/ConstString.cpp --- a/lldb/source/Utility/ConstString.cpp +++ b/lldb/source/Utility/ConstString.cpp @@ -98,7 +98,7 @@ return nullptr; } - const char *GetConstCStringWithStringRef(const llvm::StringRef &string_ref) { + const char *GetConstCStringWithStringRef(llvm::StringRef string_ref) { if (string_ref.data()) { const uint8_t h = hash(string_ref); @@ -171,7 +171,7 @@ } protected: - uint8_t hash(const llvm::StringRef &s) const { + uint8_t hash(llvm::StringRef s) const { uint32_t h = llvm::djbHash(s); return ((h >> 24) ^ (h >> 16) ^ (h >> 8) ^ h) & 0xff; } @@ -208,7 +208,7 @@ ConstString::ConstString(const char *cstr, size_t cstr_len) : m_string(StringPool().GetConstCStringWithLength(cstr, cstr_len)) {} -ConstString::ConstString(const llvm::StringRef &s) +ConstString::ConstString(llvm::StringRef s) : m_string(StringPool().GetConstCStringWithStringRef(s)) {} bool ConstString::operator<(ConstString rhs) const { @@ -302,8 +302,8 @@ m_string = StringPool().GetConstCString(cstr); } -void ConstString::SetString(const llvm::StringRef &s) { - m_string = StringPool().GetConstCStringWithLength(s.data(), s.size()); +void ConstString::SetString(llvm::StringRef s) { + m_string = StringPool().GetConstCStringWithStringRef(s); } void ConstString::SetStringWithMangledCounterpart(llvm::StringRef demangled,