summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp12
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h1
2 files changed, 13 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
index dec6770537e..7c167ba0c43 100644
--- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
@@ -731,6 +731,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_typedef:
+ return lowerTypeAlias(cast<DIDerivedType>(Ty));
case dwarf::DW_TAG_base_type:
return lowerTypeBasic(cast<DIBasicType>(Ty));
case dwarf::DW_TAG_pointer_type:
@@ -748,6 +750,16 @@ TypeIndex CodeViewDebug::lowerType(const DIType *Ty) {
}
}
+TypeIndex CodeViewDebug::lowerTypeAlias(const DIDerivedType *Ty) {
+ // TODO: MSVC emits a S_UDT record.
+ DITypeRef UnderlyingTypeRef = Ty->getBaseType();
+ TypeIndex UnderlyingTypeIndex = getTypeIndex(UnderlyingTypeRef);
+ if (UnderlyingTypeIndex == TypeIndex(SimpleTypeKind::Int32Long) &&
+ Ty->getName() == "HRESULT")
+ return TypeIndex(SimpleTypeKind::HResult);
+ return UnderlyingTypeIndex;
+}
+
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 41350d42f7e..24d785b8d4b 100644
--- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h
+++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h
@@ -190,6 +190,7 @@ class LLVM_LIBRARY_VISIBILITY CodeViewDebug : public DebugHandlerBase {
codeview::TypeIndex getTypeIndex(DITypeRef Ty);
codeview::TypeIndex lowerType(const DIType *Ty);
+ codeview::TypeIndex lowerTypeAlias(const DIDerivedType *Ty);
codeview::TypeIndex lowerTypeBasic(const DIBasicType *Ty);
codeview::TypeIndex lowerTypePointer(const DIDerivedType *Ty);
codeview::TypeIndex lowerTypeMemberPointer(const DIDerivedType *Ty);
OpenPOWER on IntegriCloud