summaryrefslogtreecommitdiffstats
path: root/lldb/source/Utility/ConstString.cpp
diff options
context:
space:
mode:
authorRaphael Isemann <teemperor@gmail.com>2019-04-14 14:01:49 +0000
committerRaphael Isemann <teemperor@gmail.com>2019-04-14 14:01:49 +0000
commit12886f04eae965b2a40df3f8e4ef6cb1a2c67605 (patch)
tree38f37dccd2b462d5c7efe9eb13135579d921a420 /lldb/source/Utility/ConstString.cpp
parent065480daf2e902f06641183060404beb2a80c369 (diff)
downloadbcm5719-llvm-12886f04eae965b2a40df3f8e4ef6cb1a2c67605.tar.gz
bcm5719-llvm-12886f04eae965b2a40df3f8e4ef6cb1a2c67605.zip
Prevent unnecessary conversion from StringRef to C-string [NFC]
There is an alternative method to GetConstCStringWithLength that takes a StringRef. GetConstCStringWithLength also calls this method in the end, so directly calling the StringRef saves us from a unnecessary conversion to a C-string. llvm-svn: 358357
Diffstat (limited to 'lldb/source/Utility/ConstString.cpp')
-rw-r--r--lldb/source/Utility/ConstString.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/lldb/source/Utility/ConstString.cpp b/lldb/source/Utility/ConstString.cpp
index 277a3ce1e8b..46b7ab25938 100644
--- a/lldb/source/Utility/ConstString.cpp
+++ b/lldb/source/Utility/ConstString.cpp
@@ -200,7 +200,7 @@ ConstString::ConstString(const char *cstr, size_t cstr_len)
: m_string(StringPool().GetConstCStringWithLength(cstr, cstr_len)) {}
ConstString::ConstString(const llvm::StringRef &s)
- : m_string(StringPool().GetConstCStringWithLength(s.data(), s.size())) {}
+ : m_string(StringPool().GetConstCStringWithStringRef(s)) {}
bool ConstString::operator<(ConstString rhs) const {
if (m_string == rhs.m_string)
OpenPOWER on IntegriCloud