diff options
author | Aaron Smith <aaron.smith@microsoft.com> | 2018-01-11 06:42:11 +0000 |
---|---|---|
committer | Aaron Smith <aaron.smith@microsoft.com> | 2018-01-11 06:42:11 +0000 |
commit | a73fa2a0ed1e5a08e81545145b31c29104e4558e (patch) | |
tree | 22ca4584a548d6d43432ed056cde69fe62d1a756 /llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp | |
parent | 17850f67fff8cf60a3468ee35bda21a4cc43aeff (diff) | |
download | bcm5719-llvm-a73fa2a0ed1e5a08e81545145b31c29104e4558e.tar.gz bcm5719-llvm-a73fa2a0ed1e5a08e81545145b31c29104e4558e.zip |
[CodeView] Fix the type for a variadic argument
Summary:
- MSVC uses the none type for a variadic argument in CodeView
- Add a unit test
Reviewers: zturner, llvm-commits
Reviewed By: zturner
Differential Revision: https://reviews.llvm.org/D41931
llvm-svn: 322257
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp index 1d0a003dc50..11c28ba6d9a 100644 --- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp @@ -1281,6 +1281,8 @@ TypeIndex CodeViewDebug::lowerType(const DIType *Ty, const DIType *ClassTy) { return lowerTypeClass(cast<DICompositeType>(Ty)); case dwarf::DW_TAG_union_type: return lowerTypeUnion(cast<DICompositeType>(Ty)); + case dwarf::DW_TAG_unspecified_type: + return TypeIndex::None(); default: // Use the null type index. return TypeIndex(); @@ -1573,6 +1575,11 @@ TypeIndex CodeViewDebug::lowerTypeFunction(const DISubroutineType *Ty) { for (DITypeRef ArgTypeRef : Ty->getTypeArray()) ReturnAndArgTypeIndices.push_back(getTypeIndex(ArgTypeRef)); + // MSVC uses type none for variadic argument. + if (ReturnAndArgTypeIndices.size() > 1 && + ReturnAndArgTypeIndices.back() == TypeIndex::Void()) { + ReturnAndArgTypeIndices.back() = TypeIndex::None(); + } TypeIndex ReturnTypeIndex = TypeIndex::Void(); ArrayRef<TypeIndex> ArgTypeIndices = None; if (!ReturnAndArgTypeIndices.empty()) { @@ -1602,6 +1609,11 @@ TypeIndex CodeViewDebug::lowerTypeMemberFunction(const DISubroutineType *Ty, for (DITypeRef ArgTypeRef : Ty->getTypeArray()) ReturnAndArgTypeIndices.push_back(getTypeIndex(ArgTypeRef)); + // MSVC uses type none for variadic argument. + if (ReturnAndArgTypeIndices.size() > 1 && + ReturnAndArgTypeIndices.back() == TypeIndex::Void()) { + ReturnAndArgTypeIndices.back() = TypeIndex::None(); + } TypeIndex ReturnTypeIndex = TypeIndex::Void(); ArrayRef<TypeIndex> ArgTypeIndices = None; if (!ReturnAndArgTypeIndices.empty()) { |