aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2021-09-19 21:03:20 -0700
committerDavid Blaikie <dblaikie@gmail.com>2021-09-24 17:02:55 -0700
commit5cb210862be45da1025fa8a9db4f52388340eade (patch)
treeac40d80e8155ca2ed013eef44ca4d85c53a11c6b /llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp
parentef764eeeb99a62f29d0a20c424328e7be2f5bfb8 (diff)
downloadllvm-5cb210862be45da1025fa8a9db4f52388340eade.zip
llvm-5cb210862be45da1025fa8a9db4f52388340eade.tar.gz
llvm-5cb210862be45da1025fa8a9db4f52388340eade.tar.bz2
DebugInfo: Use the signedness of the underlying enum when encoding enum non-type-template-parameters
This improves the accuracy of the debug info and improves round tripping through -gsimple-template-names.
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp b/llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp
index c957ca8..4df34d2 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp
@@ -185,14 +185,15 @@ bool DebugHandlerBase::isUnsignedDIType(const DIType *Ty) {
}
if (auto *CTy = dyn_cast<DICompositeType>(Ty)) {
- // FIXME: Enums without a fixed underlying type have unknown signedness
- // here, leading to incorrectly emitted constants.
- if (CTy->getTag() == dwarf::DW_TAG_enumeration_type)
- return false;
-
- // (Pieces of) aggregate types that get hacked apart by SROA may be
- // represented by a constant. Encode them as unsigned bytes.
- return true;
+ if (CTy->getTag() == dwarf::DW_TAG_enumeration_type) {
+ if (!(Ty = CTy->getBaseType()))
+ // FIXME: Enums without a fixed underlying type have unknown signedness
+ // here, leading to incorrectly emitted constants.
+ return false;
+ } else
+ // (Pieces of) aggregate types that get hacked apart by SROA may be
+ // represented by a constant. Encode them as unsigned bytes.
+ return true;
}
if (auto *DTy = dyn_cast<DIDerivedType>(Ty)) {