<rdar://problem/13341472>
LLDB wasn't printing the names for negative enums. Fixed the signed extraction of enumerators and how they were registered with clang's type system.
llvm-svn: 176533
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index 603d824..bb10ed7 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -2385,7 +2385,9 @@
if (die->HasChildren())
{
SymbolContext sc(GetCompUnitForDWARFCompUnit(dwarf_cu));
- ParseChildEnumerators(sc, clang_type, type->GetByteSize(), dwarf_cu, die);
+ bool is_signed = false;
+ ast.IsIntegerType(clang_type, is_signed);
+ ParseChildEnumerators(sc, clang_type, is_signed, type->GetByteSize(), dwarf_cu, die);
}
ast.CompleteTagDeclarationDefinition (clang_type);
return clang_type;
@@ -4051,7 +4053,8 @@
SymbolFileDWARF::ParseChildEnumerators
(
const SymbolContext& sc,
- clang_type_t enumerator_clang_type,
+ clang_type_t enumerator_clang_type,
+ bool is_signed,
uint32_t enumerator_byte_size,
DWARFCompileUnit* dwarf_cu,
const DWARFDebugInfoEntry *parent_die
@@ -4089,7 +4092,10 @@
{
case DW_AT_const_value:
got_value = true;
- enum_value = form_value.Unsigned();
+ if (is_signed)
+ enum_value = form_value.Signed();
+ else
+ enum_value = form_value.Unsigned();
break;
case DW_AT_name:
@@ -6074,7 +6080,9 @@
if (die->HasChildren())
{
SymbolContext cu_sc(GetCompUnitForDWARFCompUnit(dwarf_cu));
- ParseChildEnumerators(cu_sc, clang_type, type_sp->GetByteSize(), dwarf_cu, die);
+ bool is_signed = false;
+ ast.IsIntegerType(clang_type, is_signed);
+ ParseChildEnumerators(cu_sc, clang_type, is_signed, type_sp->GetByteSize(), dwarf_cu, die);
}
ast.CompleteTagDeclarationDefinition (clang_type);
}
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
index 31fb4cc..f4703e8 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -368,6 +368,7 @@
size_t ParseChildEnumerators(
const lldb_private::SymbolContext& sc,
lldb::clang_type_t enumerator_qual_type,
+ bool is_signed,
uint32_t enumerator_byte_size,
DWARFCompileUnit* dwarf_cu,
const DWARFDebugInfoEntry *enum_die);
diff --git a/lldb/source/Symbol/ClangASTContext.cpp b/lldb/source/Symbol/ClangASTContext.cpp
index 71e183c..1853c30 100644
--- a/lldb/source/Symbol/ClangASTContext.cpp
+++ b/lldb/source/Symbol/ClangASTContext.cpp
@@ -5502,6 +5502,8 @@
assert (identifier_table != NULL);
QualType enum_qual_type (QualType::getFromOpaquePtr(enum_clang_type));
+ bool is_signed = false;
+ IsIntegerType (enumerator_clang_type, is_signed);
const clang::Type *clang_type = enum_qual_type.getTypePtr();
if (clang_type)
{
@@ -5509,7 +5511,7 @@
if (enum_type)
{
- llvm::APSInt enum_llvm_apsint(enum_value_bit_size, false);
+ llvm::APSInt enum_llvm_apsint(enum_value_bit_size, is_signed);
enum_llvm_apsint = enum_value;
EnumConstantDecl *enumerator_decl =
EnumConstantDecl::Create (*ast,