diff options
author | Reid Kleckner <rnk@google.com> | 2018-12-11 23:07:39 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2018-12-11 23:07:39 +0000 |
commit | 9571c806c52caba508842c414d3a3ac3f8fd1338 (patch) | |
tree | 4abffb99c4524c61ebc5951df83bad806e99653e /llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp | |
parent | c67768fe2365e4759c54a26a9e8af987ee0bd09b (diff) | |
download | bcm5719-llvm-9571c806c52caba508842c414d3a3ac3f8fd1338.tar.gz bcm5719-llvm-9571c806c52caba508842c414d3a3ac3f8fd1338.zip |
[codeview] Look through typedefs in getCompleteTypeIndex
Summary:
Any time a symbol record, whether it's S_UDT, S_LOCAL, or S_[GL]DATA32,
references a record type, it should use the complete type index, even if
there's a typedef in the way.
Fixes the compiler part of PR39853.
Reviewers: zturner, aganea
Subscribers: hiraditya, arphaman, llvm-commits
Differential Revision: https://reviews.llvm.org/D55236
llvm-svn: 348902
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp index 0ef90bc52e5..03d8777217a 100644 --- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp @@ -2486,6 +2486,14 @@ TypeIndex CodeViewDebug::getCompleteTypeIndex(DITypeRef TypeRef) { if (!Ty) return TypeIndex::Void(); + // Look through typedefs when getting the complete type index. Call + // getTypeIndex on the typdef to ensure that any UDTs are accumulated and are + // emitted only once. + if (Ty->getTag() == dwarf::DW_TAG_typedef) + (void)getTypeIndex(Ty); + while (Ty->getTag() == dwarf::DW_TAG_typedef) + Ty = cast<DIDerivedType>(Ty)->getBaseType().resolve(); + // If this is a non-record type, the complete type index is the same as the // normal type index. Just call getTypeIndex. switch (Ty->getTag()) { |