8
8
9
9
#include " DWARFASTParserD.h"
10
10
#include " DWARFASTParserClang.h"
11
+ #include " DWARFASTParser.h"
11
12
#include " DWARFDebugInfo.h"
12
13
#include " DWARFDeclContext.h"
13
14
#include " DWARFDefines.h"
@@ -69,6 +70,8 @@ TypeSP DWARFASTParserD::ParseTypeFromDWARF(const SymbolContext &sc,
69
70
type_sp = ParseSimpleType (sc, die, attrs);
70
71
break ;
71
72
case DW_TAG_typedef:
73
+ type_sp = ParseDerivedType (sc, die, attrs);
74
+ break ;
72
75
case DW_TAG_pointer_type:
73
76
case DW_TAG_reference_type:
74
77
case DW_TAG_rvalue_reference_type:
@@ -94,22 +97,52 @@ DWARFASTParserD::ParseSimpleType(const lldb_private::SymbolContext &sc,
94
97
{
95
98
SymbolFileDWARF *dwarf = die.GetDWARF ();
96
99
CompilerType cp_type;
97
- Type::ResolveState resolve_state = Type::ResolveState::Unresolved;
98
- Type::EncodingDataType encoding_data_type = Type::eEncodingIsUID;
99
100
101
+ cp_type = m_ast.GetBuiltinTypeForDWARFEncodingAndBitSize (
102
+ attrs.name .GetStringRef (),
103
+ attrs.encoding , attrs.byte_size .getValueOr (0 ) * 8 );
104
+
105
+ return std::make_shared<Type>(
106
+ die.GetID (), dwarf, attrs.name , attrs.byte_size , nullptr ,
107
+ dwarf->GetUID (attrs.type .Reference ()), Type::eEncodingIsUID, &attrs.decl ,
108
+ cp_type, Type::ResolveState::Full);
109
+ }
110
+
111
+
112
+ TypeSP
113
+ DWARFASTParserD::ParseTypeFromModule (const lldb_private::SymbolContext &sc,
114
+ const DWARFDIE &die) {
115
+ return TypeSP ();
116
+ }
117
+
118
+ lldb::TypeSP
119
+ DWARFASTParserD::ParseDerivedType (const lldb_private::SymbolContext &sc,
120
+ const DWARFDIE &die,
121
+ ParsedDWARFTypeAttributes &attrs) {
122
+ SymbolFileDWARF *dwarf = die.GetDWARF ();
100
123
const dw_tag_t tag = die.Tag ();
101
- switch (tag)
102
- {
103
- case DW_TAG_base_type:
104
- cp_type = m_ast.GetBuiltinTypeForDWARFEncodingAndBitSize (
105
- attrs.name .GetStringRef (),
106
- attrs.encoding , attrs.byte_size .getValueOr (0 ) * 8 );
124
+ CompilerType cp_type;
125
+ Type::ResolveState resolve_state = Type::ResolveState::Unresolved;
126
+
127
+ switch (tag) {
128
+ case DW_TAG_typedef: {
129
+ const DWARFDIE encoding_die = attrs.type .Reference ();
130
+ if (encoding_die &&
131
+ encoding_die.GetAttributeValueAsUnsigned (DW_AT_declaration, 0 ) == 1 ) {
132
+ TypeSP type_sp = ParseTypeFromModule (sc, die);
133
+ if (type_sp)
134
+ return type_sp;
135
+ }
136
+
137
+ break ;
138
+ }
139
+ default :
107
140
break ;
108
- default : break ;
109
141
}
142
+
110
143
return std::make_shared<Type>(
111
144
die.GetID (), dwarf, attrs.name , attrs.byte_size , nullptr ,
112
- dwarf->GetUID (attrs.type .Reference ()), encoding_data_type , &attrs.decl ,
145
+ dwarf->GetUID (attrs.type .Reference ()), GetEncodingFromDWARFTypeTag (tag) , &attrs.decl ,
113
146
cp_type, resolve_state);
114
147
}
115
148
0 commit comments