diff options
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp | 14 | ||||
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h | 1 |
2 files changed, 15 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp index db1dc519ed5..530b1febeae 100644 --- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp @@ -726,6 +726,8 @@ void CodeViewDebug::beginFunction(const MachineFunction *MF) { TypeIndex CodeViewDebug::lowerType(const DIType *Ty) { // Generic dispatch for lowering an unknown type. switch (Ty->getTag()) { + case dwarf::DW_TAG_array_type: + return lowerTypeArray(cast<DICompositeType>(Ty)); case dwarf::DW_TAG_typedef: return lowerTypeAlias(cast<DIDerivedType>(Ty)); case dwarf::DW_TAG_base_type: @@ -765,6 +767,18 @@ TypeIndex CodeViewDebug::lowerTypeAlias(const DIDerivedType *Ty) { return UnderlyingTypeIndex; } +TypeIndex CodeViewDebug::lowerTypeArray(const DICompositeType *Ty) { + DITypeRef ElementTypeRef = Ty->getBaseType(); + TypeIndex ElementTypeIndex = getTypeIndex(ElementTypeRef); + // IndexType is size_t, which depends on the bitness of the target. + TypeIndex IndexType = Asm->MAI->getPointerSize() == 8 + ? TypeIndex(SimpleTypeKind::UInt64Quad) + : TypeIndex(SimpleTypeKind::UInt32Long); + uint64_t Size = Ty->getSizeInBits() / 8; + ArrayRecord Record(ElementTypeIndex, IndexType, Size, Ty->getName()); + return TypeTable.writeArray(Record); +} + TypeIndex CodeViewDebug::lowerTypeBasic(const DIBasicType *Ty) { TypeIndex Index; dwarf::TypeKind Kind; diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h index 69c9c966f93..6029243bcf4 100644 --- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h +++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h @@ -201,6 +201,7 @@ class LLVM_LIBRARY_VISIBILITY CodeViewDebug : public DebugHandlerBase { codeview::TypeIndex lowerType(const DIType *Ty); codeview::TypeIndex lowerTypeAlias(const DIDerivedType *Ty); + codeview::TypeIndex lowerTypeArray(const DICompositeType *Ty); codeview::TypeIndex lowerTypeBasic(const DIBasicType *Ty); codeview::TypeIndex lowerTypePointer(const DIDerivedType *Ty); codeview::TypeIndex lowerTypeMemberPointer(const DIDerivedType *Ty); |