Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h =================================================================== --- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h +++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h @@ -16,6 +16,7 @@ #include "lldb/Utility/ConstString.h" #include "lldb/Core/PluginInterface.h" #include "lldb/Symbol/SymbolFile.h" +#include "lldb/Symbol/Type.h" #include "lldb/Symbol/CompilerDecl.h" #include "lldb/Symbol/CompilerDeclContext.h" #include "lldb/lldb-enumerations.h" @@ -62,6 +63,8 @@ static lldb::AccessType GetAccessTypeFromDWARF(uint32_t dwarf_accessibility); + static lldb_private::Type::EncodingDataType GetEncodingFromDWARFTypeTag(dw_tag_t tag); + /// If \p type_sp is valid, calculate and set its symbol context scope, and /// update the type list for its backing symbol file. /// Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp =================================================================== --- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp +++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp @@ -287,3 +287,27 @@ dwarf->GetDIEToType()[die.GetDIE()] = type_sp.get(); return type_sp; } + +lldb_private::Type::EncodingDataType DWARFASTParser::GetEncodingFromDWARFTypeTag(dw_tag_t tag) +{ + switch(tag) { + case DW_TAG_pointer_type: + return Type::eEncodingIsPointerUID; + case DW_TAG_reference_type: + return Type::eEncodingIsLValueReferenceUID; + case DW_TAG_rvalue_reference_type: + return Type::eEncodingIsRValueReferenceUID; + case DW_TAG_typedef: + return Type::eEncodingIsTypedefUID; + case DW_TAG_const_type: + return Type::eEncodingIsConstUID; + case DW_TAG_restrict_type: + return Type::eEncodingIsRestrictUID; + case DW_TAG_volatile_type: + return Type::eEncodingIsVolatileUID; + case DW_TAG_atomic_type: + return Type::eEncodingIsAtomicUID; + default: + return Type::eEncodingIsUID; + } +} Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp =================================================================== --- lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp +++ lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp @@ -412,7 +412,7 @@ const dw_tag_t tag = die.Tag(); LanguageType cu_language = SymbolFileDWARF::GetLanguage(*die.GetCU()); Type::ResolveState resolve_state = Type::ResolveState::Unresolved; - Type::EncodingDataType encoding_data_type = Type::eEncodingIsUID; + Type::EncodingDataType encoding_data_type = GetEncodingFromDWARFTypeTag(tag); TypeSP type_sp; CompilerType clang_type; @@ -488,31 +488,6 @@ attrs.name.GetStringRef(), attrs.encoding, attrs.byte_size.getValueOr(0) * 8); break; - - case DW_TAG_pointer_type: - encoding_data_type = Type::eEncodingIsPointerUID; - break; - case DW_TAG_reference_type: - encoding_data_type = Type::eEncodingIsLValueReferenceUID; - break; - case DW_TAG_rvalue_reference_type: - encoding_data_type = Type::eEncodingIsRValueReferenceUID; - break; - case DW_TAG_typedef: - encoding_data_type = Type::eEncodingIsTypedefUID; - break; - case DW_TAG_const_type: - encoding_data_type = Type::eEncodingIsConstUID; - break; - case DW_TAG_restrict_type: - encoding_data_type = Type::eEncodingIsRestrictUID; - break; - case DW_TAG_volatile_type: - encoding_data_type = Type::eEncodingIsVolatileUID; - break; - case DW_TAG_atomic_type: - encoding_data_type = Type::eEncodingIsAtomicUID; - break; } if (!clang_type && (encoding_data_type == Type::eEncodingIsPointerUID ||