[lldb][NFC] Modernize string handling in DWARFASTParserClang::ParseTypeModifier

This commit is contained in:
Raphael Isemann 2019-11-26 14:23:32 +01:00
parent 290e43ddb6
commit 16144d2b21
1 changed files with 16 additions and 22 deletions

View File

@ -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,8 +704,8 @@ 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")) {
llvm::StringRef struct_name = encoding_die.GetName();
if (struct_name == "objc_object") {
if (log)
dwarf->GetObjectFile()->GetModule()->LogMessage(
log,
@ -727,7 +722,6 @@ DWARFASTParserClang::ParseTypeModifier(const SymbolContext &sc,
}
}
}
}
type_sp = std::make_shared<Type>(
die.GetID(), dwarf, attrs.name, attrs.byte_size, nullptr,