summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2014-05-11 17:04:05 +0000
committerDavid Blaikie <dblaikie@gmail.com>2014-05-11 17:04:05 +0000
commite0f14743c0cd92abdce9e04916170c5f02614b33 (patch)
tree9e1a83272bf3096b624479c5f903813183b9c663 /llvm/lib
parentc4c6c8766657cdec2fd30b23a5b3890f12f1f2be (diff)
downloadbcm5719-llvm-e0f14743c0cd92abdce9e04916170c5f02614b33.tar.gz
bcm5719-llvm-e0f14743c0cd92abdce9e04916170c5f02614b33.zip
DwarfUnit: Make explicit a limitation/bug in enumeration constant emission.
Filed as PR19712, LLVM fails to detect the right type of an enum constant when a frontend does not provide an underlying type for the enumeration type. llvm-svn: 208502
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
index 7e1a9879c67..7797ff4273a 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
@@ -748,12 +748,17 @@ void DwarfUnit::addBlockByrefAddress(const DbgVariable &DV, DIE &Die,
/// Return true if type encoding is unsigned.
static bool isUnsignedDIType(DwarfDebug *DD, DIType Ty) {
DIDerivedType DTy(Ty);
- if (DTy.isDerivedType())
- return isUnsignedDIType(DD, DD->resolve(DTy.getTypeDerivedFrom()));
+ if (DTy.isDerivedType()) {
+ if (DIType Deriv = DD->resolve(DTy.getTypeDerivedFrom()))
+ return isUnsignedDIType(DD, Deriv);
+ // FIXME: Enums without a fixed underlying type have unknown signedness
+ // here, leading to incorrectly emitted constants.
+ assert(DTy.getTag() == dwarf::DW_TAG_enumeration_type);
+ return false;
+ }
DIBasicType BTy(Ty);
- if (!BTy.isBasicType())
- return false;
+ assert(BTy.isBasicType());
unsigned Encoding = BTy.getEncoding();
assert(Encoding == dwarf::DW_ATE_unsigned ||
Encoding == dwarf::DW_ATE_unsigned_char ||
OpenPOWER on IntegriCloud