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
This commit is contained in:
Raphael Isemann 2019-04-14 14:01:49 +00:00
parent 065480daf2
commit 12886f04ea

View File

@ -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)