summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 87f4cf7)
raw | patch | inline | side by side (parent: 87f4cf7)
author | David Blaikie <dblaikie@gmail.com> | |
Sun, 11 May 2014 17:04:05 +0000 (17:04 +0000) | ||
committer | David Blaikie <dblaikie@gmail.com> | |
Sun, 11 May 2014 17:04:05 +0000 (17:04 +0000) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208502 91177308-0d34-0410-b5e6-96231b3b80d8
constant when a frontend does not provide an underlying type for the
enumeration type.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208502 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/AsmPrinter/DwarfUnit.cpp | patch | blob | history |
index 7e1a9879c67757f5e3c0f354bc72a91a6c577afd..7797ff4273a69c2a31f083591e53449e2c62de9f 100644 (file)
/// 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 ||