Skip to content

Commit 662d88c

Browse files
committed
[lldb] Add type name mapping for DType
1 parent 26d89d6 commit 662d88c

4 files changed

Lines changed: 66 additions & 1 deletion

File tree

lldb/source/Plugins/TypeSystem/D/DType.cpp

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,3 +182,60 @@ llvm::Optional<uint64_t> DType::GetBitSize(DTypeKind kind, llvm::Triple &target_
182182
return llvm::None;
183183
}
184184
}
185+
186+
ConstString DType::GetName(DTypeKind kind)
187+
{
188+
switch(kind)
189+
{
190+
case eDTypeKindVoid:
191+
return ConstString("void");
192+
case eDTypeKindBool:
193+
return ConstString("bool");
194+
case eDTypeKindByte:
195+
return ConstString("byte");
196+
case eDTypeKindUByte:
197+
return ConstString("ubyte");
198+
case eDTypeKindShort:
199+
return ConstString("short");
200+
case eDTypeKindUShort:
201+
return ConstString("ushort");
202+
case eDTypeKindInt:
203+
return ConstString("int");
204+
case eDTypeKindUInt:
205+
return ConstString("uint");
206+
case eDTypeKindLong:
207+
return ConstString("long");
208+
case eDTypeKindULong:
209+
return ConstString("ulong");
210+
case eDTypeKindCent:
211+
return ConstString("cent");
212+
case eDTypeKindUCent:
213+
return ConstString("ucent");
214+
case eDTypeKindChar:
215+
return ConstString("char");
216+
case eDTypeKindWChar:
217+
return ConstString("wchar");
218+
case eDTypeKindDChar:
219+
return ConstString("dchar");
220+
case eDTypeKindFloat:
221+
return ConstString("float");
222+
case eDTypeKindDouble:
223+
return ConstString("double");
224+
case eDTypeKindReal:
225+
return ConstString("real");
226+
case eDTypeKindIFloat:
227+
return ConstString("ifloat");
228+
case eDTypeKindIDouble:
229+
return ConstString("idouble");
230+
case eDTypeKindIReal:
231+
return ConstString("ireal");
232+
case eDTypeKindCFloat:
233+
return ConstString("cfloat");
234+
case eDTypeKindCDouble:
235+
return ConstString("cdouble");
236+
case eDTypeKindCReal:
237+
return ConstString("creal");
238+
default:
239+
return ConstString();
240+
}
241+
}

lldb/source/Plugins/TypeSystem/D/DType.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ class DType {
5656

5757
DTypeKind GetKind() { return m_kind; }
5858
const ConstString &GetName() const { return m_name; }
59+
static ConstString GetName(DTypeKind);
5960

6061
bool IsBuiltIn() const;
6162

lldb/source/Plugins/TypeSystem/D/TypeSystemD.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,12 @@ TypeSystemD::CreateBaseType(DTypeKind kind,
666666
return CompilerType(this, type);
667667
}
668668

669+
CompilerType
670+
TypeSystemD::CreateBaseType(DTypeKind kind) {
671+
DType *type = new DType(kind, DType::GetName(kind));
672+
return CompilerType(this, type);
673+
}
674+
669675
CompilerType
670676
TypeSystemD::GetBuiltinTypeForDWARFEncodingAndBitSize(uint32_t dw_ate, uint32_t bit_size)
671677
{
@@ -674,7 +680,7 @@ TypeSystemD::GetBuiltinTypeForDWARFEncodingAndBitSize(uint32_t dw_ate, uint32_t
674680
switch(dw_ate)
675681
{
676682
case DW_ATE_boolean:
677-
return CreateBaseType(eDTypeKindBool, ConstString("bool"));
683+
return CreateBaseType(eDTypeKindBool);
678684
default:
679685
break;
680686
}

lldb/source/Plugins/TypeSystem/D/TypeSystemD.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,7 @@ class TypeSystemD : public TypeSystem {
342342
private:
343343
CompilerType CreateBaseType(DTypeKind kind,
344344
const lldb_private::ConstString &name);
345+
CompilerType CreateBaseType(DTypeKind kind);
345346

346347
CompilerType GetBuiltinTypeForDWARFEncodingAndBitSize(uint32_t dw_ate, uint32_t bit_size);
347348

0 commit comments

Comments
 (0)