diff options
author | Zachary Turner <zturner@google.com> | 2016-10-06 21:22:44 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2016-10-06 21:22:44 +0000 |
commit | 4fa098a5c0223dab6ae10da6f01541e943cc0bbf (patch) | |
tree | f22c6bf0e5f05bc7b0c405fbbb81a7f444a3364f /lldb/source/Interpreter | |
parent | 60fb35b20a0fc335e5f626c44006eed3a49d3bd7 (diff) | |
download | bcm5719-llvm-4fa098a5c0223dab6ae10da6f01541e943cc0bbf.tar.gz bcm5719-llvm-4fa098a5c0223dab6ae10da6f01541e943cc0bbf.zip |
Convert UniqueCStringMap to use StringRef.
llvm-svn: 283494
Diffstat (limited to 'lldb/source/Interpreter')
-rw-r--r-- | lldb/source/Interpreter/OptionValueEnumeration.cpp | 13 | ||||
-rw-r--r-- | lldb/source/Interpreter/OptionValueProperties.cpp | 13 |
2 files changed, 14 insertions, 12 deletions
diff --git a/lldb/source/Interpreter/OptionValueEnumeration.cpp b/lldb/source/Interpreter/OptionValueEnumeration.cpp index 88b7f16d64b..026ac385e1e 100644 --- a/lldb/source/Interpreter/OptionValueEnumeration.cpp +++ b/lldb/source/Interpreter/OptionValueEnumeration.cpp @@ -59,7 +59,7 @@ Error OptionValueEnumeration::SetValueFromString(llvm::StringRef value, ConstString const_enumerator_name(value.trim()); const EnumerationMapEntry *enumerator_entry = m_enumerations.FindFirstValueForName( - const_enumerator_name.GetCString()); + const_enumerator_name.GetStringRef()); if (enumerator_entry) { m_current_value = enumerator_entry->value.value; NotifyValueChanged(); @@ -69,9 +69,10 @@ Error OptionValueEnumeration::SetValueFromString(llvm::StringRef value, const size_t count = m_enumerations.GetSize(); if (count) { error_strm.Printf(", valid values are: %s", - m_enumerations.GetCStringAtIndex(0)); + m_enumerations.GetCStringAtIndex(0).str().c_str()); for (size_t i = 1; i < count; ++i) { - error_strm.Printf(", %s", m_enumerations.GetCStringAtIndex(i)); + error_strm.Printf(", %s", + m_enumerations.GetCStringAtIndex(i).str().c_str()); } } error.SetErrorString(error_strm.GetData()); @@ -98,7 +99,7 @@ void OptionValueEnumeration::SetEnumerations( ConstString const_enumerator_name(enumerators[i].string_value); EnumeratorInfo enumerator_info = {enumerators[i].value, enumerators[i].usage}; - m_enumerations.Append(const_enumerator_name.GetCString(), + m_enumerations.Append(const_enumerator_name.GetStringRef(), enumerator_info); } m_enumerations.Sort(); @@ -119,8 +120,8 @@ size_t OptionValueEnumeration::AutoComplete( if (s && s[0]) { const size_t s_len = strlen(s); for (size_t i = 0; i < num_enumerators; ++i) { - const char *name = m_enumerations.GetCStringAtIndex(i); - if (::strncmp(s, name, s_len) == 0) + llvm::StringRef name = m_enumerations.GetCStringAtIndex(i); + if (name.startswith(s)) matches.AppendString(name); } } else { diff --git a/lldb/source/Interpreter/OptionValueProperties.cpp b/lldb/source/Interpreter/OptionValueProperties.cpp index a6fed486c5a..ab9a9d18954 100644 --- a/lldb/source/Interpreter/OptionValueProperties.cpp +++ b/lldb/source/Interpreter/OptionValueProperties.cpp @@ -59,7 +59,7 @@ void OptionValueProperties::Initialize(const PropertyDefinition *defs) { for (size_t i = 0; defs[i].name; ++i) { Property property(defs[i]); assert(property.IsValid()); - m_name_to_index.Append(property.GetName().GetCString(), + m_name_to_index.Append(property.GetName().GetStringRef(), m_properties.size()); property.GetValue()->SetParent(shared_from_this()); m_properties.push_back(property); @@ -79,7 +79,7 @@ void OptionValueProperties::AppendProperty(const ConstString &name, bool is_global, const OptionValueSP &value_sp) { Property property(name, desc, is_global, value_sp); - m_name_to_index.Append(name.GetCString(), m_properties.size()); + m_name_to_index.Append(name.GetStringRef(), m_properties.size()); m_properties.push_back(property); value_sp->SetParent(shared_from_this()); m_name_to_index.Sort(); @@ -109,7 +109,7 @@ OptionValueProperties::GetValueForKey(const ExecutionContext *exe_ctx, const ConstString &key, bool will_modify) const { lldb::OptionValueSP value_sp; - size_t idx = m_name_to_index.Find(key.GetCString(), SIZE_MAX); + size_t idx = m_name_to_index.Find(key.GetStringRef(), SIZE_MAX); if (idx < m_properties.size()) value_sp = GetPropertyAtIndex(exe_ctx, will_modify, idx)->GetValue(); return value_sp; @@ -234,15 +234,16 @@ OptionValueProperties::GetPropertyDescriptionAtIndex(uint32_t idx) const { uint32_t OptionValueProperties::GetPropertyIndex(const ConstString &name) const { - return m_name_to_index.Find(name.GetCString(), SIZE_MAX); + return m_name_to_index.Find(name.GetStringRef(), SIZE_MAX); } const Property * OptionValueProperties::GetProperty(const ExecutionContext *exe_ctx, bool will_modify, const ConstString &name) const { - return GetPropertyAtIndex(exe_ctx, will_modify, - m_name_to_index.Find(name.GetCString(), SIZE_MAX)); + return GetPropertyAtIndex( + exe_ctx, will_modify, + m_name_to_index.Find(name.GetStringRef(), SIZE_MAX)); } const Property *OptionValueProperties::GetPropertyAtIndex( |