diff options
Diffstat (limited to 'lldb/source/Symbol')
| -rw-r--r-- | lldb/source/Symbol/ClangASTContext.cpp | 69 | ||||
| -rw-r--r-- | lldb/source/Symbol/GoASTContext.cpp | 34 | ||||
| -rw-r--r-- | lldb/source/Symbol/Symtab.cpp | 44 |
3 files changed, 73 insertions, 74 deletions
diff --git a/lldb/source/Symbol/ClangASTContext.cpp b/lldb/source/Symbol/ClangASTContext.cpp index ba7ce0d19cc..61f037d0a26 100644 --- a/lldb/source/Symbol/ClangASTContext.cpp +++ b/lldb/source/Symbol/ClangASTContext.cpp @@ -952,72 +952,75 @@ ClangASTContext::GetBasicTypeEnumeration(const ConstString &name) { static std::once_flag g_once_flag; std::call_once(g_once_flag, []() { // "void" - g_type_map.Append(ConstString("void").GetCString(), eBasicTypeVoid); + g_type_map.Append(ConstString("void").GetStringRef(), eBasicTypeVoid); // "char" - g_type_map.Append(ConstString("char").GetCString(), eBasicTypeChar); - g_type_map.Append(ConstString("signed char").GetCString(), + g_type_map.Append(ConstString("char").GetStringRef(), eBasicTypeChar); + g_type_map.Append(ConstString("signed char").GetStringRef(), eBasicTypeSignedChar); - g_type_map.Append(ConstString("unsigned char").GetCString(), + g_type_map.Append(ConstString("unsigned char").GetStringRef(), eBasicTypeUnsignedChar); - g_type_map.Append(ConstString("wchar_t").GetCString(), eBasicTypeWChar); - g_type_map.Append(ConstString("signed wchar_t").GetCString(), + g_type_map.Append(ConstString("wchar_t").GetStringRef(), eBasicTypeWChar); + g_type_map.Append(ConstString("signed wchar_t").GetStringRef(), eBasicTypeSignedWChar); - g_type_map.Append(ConstString("unsigned wchar_t").GetCString(), + g_type_map.Append(ConstString("unsigned wchar_t").GetStringRef(), eBasicTypeUnsignedWChar); // "short" - g_type_map.Append(ConstString("short").GetCString(), eBasicTypeShort); - g_type_map.Append(ConstString("short int").GetCString(), eBasicTypeShort); - g_type_map.Append(ConstString("unsigned short").GetCString(), + g_type_map.Append(ConstString("short").GetStringRef(), eBasicTypeShort); + g_type_map.Append(ConstString("short int").GetStringRef(), + eBasicTypeShort); + g_type_map.Append(ConstString("unsigned short").GetStringRef(), eBasicTypeUnsignedShort); - g_type_map.Append(ConstString("unsigned short int").GetCString(), + g_type_map.Append(ConstString("unsigned short int").GetStringRef(), eBasicTypeUnsignedShort); // "int" - g_type_map.Append(ConstString("int").GetCString(), eBasicTypeInt); - g_type_map.Append(ConstString("signed int").GetCString(), eBasicTypeInt); - g_type_map.Append(ConstString("unsigned int").GetCString(), + g_type_map.Append(ConstString("int").GetStringRef(), eBasicTypeInt); + g_type_map.Append(ConstString("signed int").GetStringRef(), + eBasicTypeInt); + g_type_map.Append(ConstString("unsigned int").GetStringRef(), eBasicTypeUnsignedInt); - g_type_map.Append(ConstString("unsigned").GetCString(), + g_type_map.Append(ConstString("unsigned").GetStringRef(), eBasicTypeUnsignedInt); // "long" - g_type_map.Append(ConstString("long").GetCString(), eBasicTypeLong); - g_type_map.Append(ConstString("long int").GetCString(), eBasicTypeLong); - g_type_map.Append(ConstString("unsigned long").GetCString(), + g_type_map.Append(ConstString("long").GetStringRef(), eBasicTypeLong); + g_type_map.Append(ConstString("long int").GetStringRef(), eBasicTypeLong); + g_type_map.Append(ConstString("unsigned long").GetStringRef(), eBasicTypeUnsignedLong); - g_type_map.Append(ConstString("unsigned long int").GetCString(), + g_type_map.Append(ConstString("unsigned long int").GetStringRef(), eBasicTypeUnsignedLong); // "long long" - g_type_map.Append(ConstString("long long").GetCString(), + g_type_map.Append(ConstString("long long").GetStringRef(), eBasicTypeLongLong); - g_type_map.Append(ConstString("long long int").GetCString(), + g_type_map.Append(ConstString("long long int").GetStringRef(), eBasicTypeLongLong); - g_type_map.Append(ConstString("unsigned long long").GetCString(), + g_type_map.Append(ConstString("unsigned long long").GetStringRef(), eBasicTypeUnsignedLongLong); - g_type_map.Append(ConstString("unsigned long long int").GetCString(), + g_type_map.Append(ConstString("unsigned long long int").GetStringRef(), eBasicTypeUnsignedLongLong); // "int128" - g_type_map.Append(ConstString("__int128_t").GetCString(), + g_type_map.Append(ConstString("__int128_t").GetStringRef(), eBasicTypeInt128); - g_type_map.Append(ConstString("__uint128_t").GetCString(), + g_type_map.Append(ConstString("__uint128_t").GetStringRef(), eBasicTypeUnsignedInt128); // Miscellaneous - g_type_map.Append(ConstString("bool").GetCString(), eBasicTypeBool); - g_type_map.Append(ConstString("float").GetCString(), eBasicTypeFloat); - g_type_map.Append(ConstString("double").GetCString(), eBasicTypeDouble); - g_type_map.Append(ConstString("long double").GetCString(), + g_type_map.Append(ConstString("bool").GetStringRef(), eBasicTypeBool); + g_type_map.Append(ConstString("float").GetStringRef(), eBasicTypeFloat); + g_type_map.Append(ConstString("double").GetStringRef(), eBasicTypeDouble); + g_type_map.Append(ConstString("long double").GetStringRef(), eBasicTypeLongDouble); - g_type_map.Append(ConstString("id").GetCString(), eBasicTypeObjCID); - g_type_map.Append(ConstString("SEL").GetCString(), eBasicTypeObjCSel); - g_type_map.Append(ConstString("nullptr").GetCString(), eBasicTypeNullPtr); + g_type_map.Append(ConstString("id").GetStringRef(), eBasicTypeObjCID); + g_type_map.Append(ConstString("SEL").GetStringRef(), eBasicTypeObjCSel); + g_type_map.Append(ConstString("nullptr").GetStringRef(), + eBasicTypeNullPtr); g_type_map.Sort(); }); - return g_type_map.Find(name.GetCString(), eBasicTypeInvalid); + return g_type_map.Find(name.GetStringRef(), eBasicTypeInvalid); } return eBasicTypeInvalid; } diff --git a/lldb/source/Symbol/GoASTContext.cpp b/lldb/source/Symbol/GoASTContext.cpp index 0c69007f4e0..0393691f45c 100644 --- a/lldb/source/Symbol/GoASTContext.cpp +++ b/lldb/source/Symbol/GoASTContext.cpp @@ -596,33 +596,33 @@ GoASTContext::GetBasicTypeEnumeration(lldb::opaque_compiler_type_t type) { static std::once_flag g_once_flag; std::call_once(g_once_flag, []() { // "void" - g_type_map.Append(ConstString("void").GetCString(), eBasicTypeVoid); + g_type_map.Append(ConstString("void").GetStringRef(), eBasicTypeVoid); // "int" - g_type_map.Append(ConstString("int").GetCString(), eBasicTypeInt); - g_type_map.Append(ConstString("uint").GetCString(), + g_type_map.Append(ConstString("int").GetStringRef(), eBasicTypeInt); + g_type_map.Append(ConstString("uint").GetStringRef(), eBasicTypeUnsignedInt); // Miscellaneous - g_type_map.Append(ConstString("bool").GetCString(), eBasicTypeBool); + g_type_map.Append(ConstString("bool").GetStringRef(), eBasicTypeBool); // Others. Should these map to C types? - g_type_map.Append(ConstString("byte").GetCString(), eBasicTypeOther); - g_type_map.Append(ConstString("uint8").GetCString(), eBasicTypeOther); - g_type_map.Append(ConstString("uint16").GetCString(), eBasicTypeOther); - g_type_map.Append(ConstString("uint32").GetCString(), eBasicTypeOther); - g_type_map.Append(ConstString("uint64").GetCString(), eBasicTypeOther); - g_type_map.Append(ConstString("int8").GetCString(), eBasicTypeOther); - g_type_map.Append(ConstString("int16").GetCString(), eBasicTypeOther); - g_type_map.Append(ConstString("int32").GetCString(), eBasicTypeOther); - g_type_map.Append(ConstString("int64").GetCString(), eBasicTypeOther); - g_type_map.Append(ConstString("float32").GetCString(), eBasicTypeOther); - g_type_map.Append(ConstString("float64").GetCString(), eBasicTypeOther); - g_type_map.Append(ConstString("uintptr").GetCString(), eBasicTypeOther); + g_type_map.Append(ConstString("byte").GetStringRef(), eBasicTypeOther); + g_type_map.Append(ConstString("uint8").GetStringRef(), eBasicTypeOther); + g_type_map.Append(ConstString("uint16").GetStringRef(), eBasicTypeOther); + g_type_map.Append(ConstString("uint32").GetStringRef(), eBasicTypeOther); + g_type_map.Append(ConstString("uint64").GetStringRef(), eBasicTypeOther); + g_type_map.Append(ConstString("int8").GetStringRef(), eBasicTypeOther); + g_type_map.Append(ConstString("int16").GetStringRef(), eBasicTypeOther); + g_type_map.Append(ConstString("int32").GetStringRef(), eBasicTypeOther); + g_type_map.Append(ConstString("int64").GetStringRef(), eBasicTypeOther); + g_type_map.Append(ConstString("float32").GetStringRef(), eBasicTypeOther); + g_type_map.Append(ConstString("float64").GetStringRef(), eBasicTypeOther); + g_type_map.Append(ConstString("uintptr").GetStringRef(), eBasicTypeOther); g_type_map.Sort(); }); - return g_type_map.Find(name.GetCString(), eBasicTypeInvalid); + return g_type_map.Find(name.GetStringRef(), eBasicTypeInvalid); } return eBasicTypeInvalid; } diff --git a/lldb/source/Symbol/Symtab.cpp b/lldb/source/Symbol/Symtab.cpp index 5b16ba569b4..09cfd8ead88 100644 --- a/lldb/source/Symbol/Symtab.cpp +++ b/lldb/source/Symbol/Symtab.cpp @@ -262,17 +262,16 @@ void Symtab::InitNameIndexes() { continue; const Mangled &mangled = symbol->GetMangled(); - entry.cstring = mangled.GetMangledName().GetCString(); - if (entry.cstring && entry.cstring[0]) { + entry.cstring = mangled.GetMangledName().GetStringRef(); + if (!entry.cstring.empty()) { m_name_to_index.Append(entry); if (symbol->ContainsLinkerAnnotations()) { // If the symbol has linker annotations, also add the version without - // the - // annotations. + // the annotations. entry.cstring = ConstString(m_objfile->StripLinkerSymbolAnnotations( entry.cstring)) - .GetCString(); + .GetStringRef(); m_name_to_index.Append(entry); } @@ -290,8 +289,9 @@ void Symtab::InitNameIndexes() { { CPlusPlusLanguage::MethodName cxx_method( mangled.GetDemangledName(lldb::eLanguageTypeC_plus_plus)); - entry.cstring = ConstString(cxx_method.GetBasename()).GetCString(); - if (entry.cstring && entry.cstring[0]) { + entry.cstring = + ConstString(cxx_method.GetBasename()).GetStringRef(); + if (!entry.cstring.empty()) { // ConstString objects permanently store the string in the pool so // calling // GetCString() on the value gets us a const char * that will @@ -336,17 +336,16 @@ void Symtab::InitNameIndexes() { } entry.cstring = - mangled.GetDemangledName(symbol->GetLanguage()).GetCString(); - if (entry.cstring && entry.cstring[0]) { + mangled.GetDemangledName(symbol->GetLanguage()).GetStringRef(); + if (!entry.cstring.empty()) { m_name_to_index.Append(entry); if (symbol->ContainsLinkerAnnotations()) { // If the symbol has linker annotations, also add the version without - // the - // annotations. + // the annotations. entry.cstring = ConstString(m_objfile->StripLinkerSymbolAnnotations( entry.cstring)) - .GetCString(); + .GetStringRef(); m_name_to_index.Append(entry); } } @@ -356,13 +355,13 @@ void Symtab::InitNameIndexes() { // too. ObjCLanguage::MethodName objc_method(entry.cstring, true); if (objc_method.IsValid(true)) { - entry.cstring = objc_method.GetSelector().GetCString(); + entry.cstring = objc_method.GetSelector().GetStringRef(); m_selector_to_index.Append(entry); ConstString objc_method_no_category( objc_method.GetFullNameWithoutCategory(true)); if (objc_method_no_category) { - entry.cstring = objc_method_no_category.GetCString(); + entry.cstring = objc_method_no_category.GetStringRef(); m_name_to_index.Append(entry); } } @@ -440,14 +439,14 @@ void Symtab::AppendSymbolNamesToMap(const IndexCollection &indexes, const Mangled &mangled = symbol->GetMangled(); if (add_demangled) { entry.cstring = - mangled.GetDemangledName(symbol->GetLanguage()).GetCString(); - if (entry.cstring && entry.cstring[0]) + mangled.GetDemangledName(symbol->GetLanguage()).GetStringRef(); + if (!entry.cstring.empty()) name_to_index_map.Append(entry); } if (add_mangled) { - entry.cstring = mangled.GetMangledName().GetCString(); - if (entry.cstring && entry.cstring[0]) + entry.cstring = mangled.GetMangledName().GetStringRef(); + if (!entry.cstring.empty()) name_to_index_map.Append(entry); } } @@ -617,11 +616,10 @@ uint32_t Symtab::AppendSymbolIndexesWithName(const ConstString &symbol_name, Timer scoped_timer(LLVM_PRETTY_FUNCTION, "%s", LLVM_PRETTY_FUNCTION); if (symbol_name) { - const char *symbol_cstr = symbol_name.GetCString(); if (!m_name_indexes_computed) InitNameIndexes(); - return m_name_to_index.GetValues(symbol_cstr, indexes); + return m_name_to_index.GetValues(symbol_name.GetStringRef(), indexes); } return 0; } @@ -638,11 +636,9 @@ uint32_t Symtab::AppendSymbolIndexesWithName(const ConstString &symbol_name, if (!m_name_indexes_computed) InitNameIndexes(); - const char *symbol_cstr = symbol_name.GetCString(); - std::vector<uint32_t> all_name_indexes; const size_t name_match_count = - m_name_to_index.GetValues(symbol_cstr, all_name_indexes); + m_name_to_index.GetValues(symbol_name.GetStringRef(), all_name_indexes); for (size_t i = 0; i < name_match_count; ++i) { if (CheckSymbolAtIndex(all_name_indexes[i], symbol_debug_type, symbol_visibility)) @@ -1066,7 +1062,7 @@ size_t Symtab::FindFunctionSymbols(const ConstString &name, size_t count = 0; std::vector<uint32_t> symbol_indexes; - const char *name_cstr = name.GetCString(); + llvm::StringRef name_cstr = name.GetStringRef(); // eFunctionNameTypeAuto should be pre-resolved by a call to // Module::LookupInfo::LookupInfo() |

