[Lldb-commits] [lldb] 16144d2 - [lldb][NFC] Modernize string handling in DWARFASTParserClang::ParseTypeModifier
Raphael Isemann via lldb-commits
lldb-commits at lists.llvm.org
Tue Nov 26 06:05:13 PST 2019
Author: Raphael Isemann
Date: 2019-11-26T15:04:54+01:00
New Revision: 16144d2b21d90a0515be2fc9158cbaf828abd980
URL: https://github.com/llvm/llvm-project/commit/16144d2b21d90a0515be2fc9158cbaf828abd980
DIFF: https://github.com/llvm/llvm-project/commit/16144d2b21d90a0515be2fc9158cbaf828abd980.diff
LOG: [lldb][NFC] Modernize string handling in DWARFASTParserClang::ParseTypeModifier
Added:
Modified:
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
Removed:
################################################################################
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index 89331f7aca6c..fe6ab3064447 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -662,11 +662,7 @@ DWARFASTParserClang::ParseTypeModifier(const SymbolContext &sc,
if (cu_language == eLanguageTypeObjC ||
cu_language == eLanguageTypeObjC_plus_plus) {
if (attrs.name) {
- static ConstString g_objc_type_name_id("id");
- static ConstString g_objc_type_name_Class("Class");
- static ConstString g_objc_type_name_selector("SEL");
-
- if (attrs.name == g_objc_type_name_id) {
+ if (attrs.name == "id") {
if (log)
dwarf->GetObjectFile()->GetModule()->LogMessage(
log,
@@ -677,8 +673,7 @@ DWARFASTParserClang::ParseTypeModifier(const SymbolContext &sc,
encoding_data_type = Type::eEncodingIsUID;
attrs.type.Clear();
resolve_state = Type::ResolveState::Full;
-
- } else if (attrs.name == g_objc_type_name_Class) {
+ } else if (attrs.name == "Class") {
if (log)
dwarf->GetObjectFile()->GetModule()->LogMessage(
log,
@@ -689,7 +684,7 @@ DWARFASTParserClang::ParseTypeModifier(const SymbolContext &sc,
encoding_data_type = Type::eEncodingIsUID;
attrs.type.Clear();
resolve_state = Type::ResolveState::Full;
- } else if (attrs.name == g_objc_type_name_selector) {
+ } else if (attrs.name == "SEL") {
if (log)
dwarf->GetObjectFile()->GetModule()->LogMessage(
log,
@@ -709,20 +704,19 @@ DWARFASTParserClang::ParseTypeModifier(const SymbolContext &sc,
const DWARFDIE encoding_die = attrs.type.Reference();
if (encoding_die && encoding_die.Tag() == DW_TAG_structure_type) {
- if (const char *struct_name = encoding_die.GetName()) {
- if (!strcmp(struct_name, "objc_object")) {
- if (log)
- dwarf->GetObjectFile()->GetModule()->LogMessage(
- log,
- "SymbolFileDWARF::ParseType (die = 0x%8.8x) %s "
- "'%s' is 'objc_object*', which we overrode to "
- "'id'.",
- die.GetOffset(), die.GetTagAsCString(), die.GetName());
- clang_type = m_ast.GetBasicType(eBasicTypeObjCID);
- encoding_data_type = Type::eEncodingIsUID;
- attrs.type.Clear();
- resolve_state = Type::ResolveState::Full;
- }
+ llvm::StringRef struct_name = encoding_die.GetName();
+ if (struct_name == "objc_object") {
+ if (log)
+ dwarf->GetObjectFile()->GetModule()->LogMessage(
+ log,
+ "SymbolFileDWARF::ParseType (die = 0x%8.8x) %s "
+ "'%s' is 'objc_object*', which we overrode to "
+ "'id'.",
+ die.GetOffset(), die.GetTagAsCString(), die.GetName());
+ clang_type = m_ast.GetBasicType(eBasicTypeObjCID);
+ encoding_data_type = Type::eEncodingIsUID;
+ attrs.type.Clear();
+ resolve_state = Type::ResolveState::Full;
}
}
}
More information about the lldb-commits
mailing list