diff options
author | David Majnemer <david.majnemer@gmail.com> | 2016-06-02 06:21:37 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2016-06-02 06:21:37 +0000 |
commit | d065e23dac4ccf233dee643594c0ec35dba7da03 (patch) | |
tree | 3704a72c02c974d13a2984e79dca0e06fc5de8ca /llvm/lib | |
parent | 6128fcf868038bbe9736d058a5782899d288bf70 (diff) | |
download | bcm5719-llvm-d065e23dac4ccf233dee643594c0ec35dba7da03.tar.gz bcm5719-llvm-d065e23dac4ccf233dee643594c0ec35dba7da03.zip |
[codeview] Return type indices for typedefs
Use the type index of the underlying type unless we have a typedef from
long to HRESULT; HRESULT typedefs are translated to T_HRESULT.
llvm-svn: 271494
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp | 12 | ||||
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h | 1 |
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); |