diff options
| author | David Blaikie <dblaikie@gmail.com> | 2013-06-24 07:13:13 +0000 |
|---|---|---|
| committer | David Blaikie <dblaikie@gmail.com> | 2013-06-24 07:13:13 +0000 |
| commit | ce1ae387d658f872c8495bf51b6823b1d6aa1fa9 (patch) | |
| tree | a93fadba1849e8a66dd07e61e57c91806ad66472 | |
| parent | 62251374706ce37a554b8bd90f76c88466590077 (diff) | |
| download | bcm5719-llvm-ce1ae387d658f872c8495bf51b6823b1d6aa1fa9.tar.gz bcm5719-llvm-ce1ae387d658f872c8495bf51b6823b1d6aa1fa9.zip | |
DebugInfo: ensure negative enumerators are emitted as such
There's still a problem here - since we're not appropriately using the
signedness/range of the enum to chooset the encoding and emission of
enumerators, but GCC has some bugs around this too so I assume that's
not /such/ a high priority though I may get to it soon out of
completeness.
llvm-svn: 184695
| -rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.cpp | 2 | ||||
| -rw-r--r-- | clang/test/CodeGenCXX/debug-info-enum.cpp | 13 |
2 files changed, 13 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index fd75a9a3a3e..e38327a9270 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -1803,7 +1803,7 @@ llvm::DIType CGDebugInfo::CreateEnumType(const EnumDecl *ED) { Enum != EnumEnd; ++Enum) { Enumerators.push_back( DBuilder.createEnumerator(Enum->getName(), - Enum->getInitVal().getZExtValue())); + Enum->getInitVal().getSExtValue())); } // Return a CompositeType for the enum itself. diff --git a/clang/test/CodeGenCXX/debug-info-enum.cpp b/clang/test/CodeGenCXX/debug-info-enum.cpp index 2273580158f..f48636d21c9 100644 --- a/clang/test/CodeGenCXX/debug-info-enum.cpp +++ b/clang/test/CodeGenCXX/debug-info-enum.cpp @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -emit-llvm -g %s -o - | FileCheck %s // CHECK: [[ENUMS:![0-9]*]], {{[^,]*}}, {{[^,]*}}, {{[^,]*}}, {{[^,]*}}, {{[^,]*}}} ; [ DW_TAG_compile_unit ] -// CHECK: [[ENUMS]] = metadata !{metadata [[E1:![0-9]*]], metadata [[E2:![0-9]*]]} +// CHECK: [[ENUMS]] = metadata !{metadata [[E1:![0-9]*]], metadata [[E2:![0-9]*]], metadata [[E3:![0-9]*]]} namespace test1 { // CHECK: [[E1]] = metadata !{i32 {{[^,]*}}, {{[^,]*}}, metadata [[TEST1:![0-9]*]], {{.*}}, metadata [[TEST1_ENUMS:![0-9]*]], {{[^,]*}}, {{[^,]*}}} ; [ DW_TAG_enumeration_type ] [e] @@ -23,3 +23,14 @@ bool func(int i) { return i == E; } } + +namespace test3 { +// CHECK: [[E3]] = metadata !{i32 {{[^,]*}}, {{[^,]*}}, metadata [[TEST3:![0-9]*]], {{.*}}, metadata [[TEST3_ENUMS:![0-9]*]], {{[^,]*}}, {{[^,]*}}} ; [ DW_TAG_enumeration_type ] [e] +// CHECK: [[TEST3]] = {{.*}} ; [ DW_TAG_namespace ] [test3] +// CHECK: [[TEST3_ENUMS]] = metadata !{metadata [[TEST3_E:![0-9]*]]} +// CHECK: [[TEST3_E]] = {{.*}}, metadata !"E", i64 -1} ; [ DW_TAG_enumerator ] [E :: -1] +enum e { E = -1 }; +void func() { + e x; +} +} |

