diff options
Diffstat (limited to 'clang/lib/CodeGen')
| -rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index e766ccc203b..9d12130376f 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -2492,9 +2492,12 @@ llvm::DIType *CGDebugInfo::CreateTypeDefinition(const EnumType *Ty) { // Create elements for each enumerator. SmallVector<llvm::Metadata *, 16> Enumerators; ED = ED->getDefinition(); + bool IsSigned = ED->getIntegerType()->isSignedIntegerType(); for (const auto *Enum : ED->enumerators()) { - Enumerators.push_back(DBuilder.createEnumerator( - Enum->getName(), Enum->getInitVal().getSExtValue())); + const auto &InitVal = Enum->getInitVal(); + auto Value = IsSigned ? InitVal.getSExtValue() : InitVal.getZExtValue(); + Enumerators.push_back( + DBuilder.createEnumerator(Enum->getName(), Value, !IsSigned)); } // Return a CompositeType for the enum itself. @@ -2503,11 +2506,10 @@ llvm::DIType *CGDebugInfo::CreateTypeDefinition(const EnumType *Ty) { llvm::DIFile *DefUnit = getOrCreateFile(ED->getLocation()); unsigned Line = getLineNumber(ED->getLocation()); llvm::DIScope *EnumContext = getDeclContextDescriptor(ED); - llvm::DIType *ClassTy = - ED->isFixed() ? getOrCreateType(ED->getIntegerType(), DefUnit) : nullptr; + llvm::DIType *ClassTy = getOrCreateType(ED->getIntegerType(), DefUnit); return DBuilder.createEnumerationType(EnumContext, ED->getName(), DefUnit, Line, Size, Align, EltArray, ClassTy, - FullName); + FullName, ED->isFixed()); } llvm::DIMacro *CGDebugInfo::CreateMacro(llvm::DIMacroFile *Parent, |

