xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenCXX/debug-info-enum.cpp (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1 // RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm -g %s -o - | FileCheck %s
2 
3 // CHECK: !"0x11\00{{.*}}", {{[^,]*}}, [[ENUMS:![0-9]*]], {{.*}}} ; [ DW_TAG_compile_unit ]
4 // CHECK: [[ENUMS]] = !{[[E1:![0-9]*]], [[E2:![0-9]*]], [[E3:![0-9]*]]}
5 
6 namespace test1 {
7 // CHECK: [[E1]] = !{!"0x4\00{{.*}}", {{[^,]*}}, [[TEST1:![0-9]*]], {{.*}}, [[TEST1_ENUMS:![0-9]*]], null, null, !"_ZTSN5test11eE"} ; [ DW_TAG_enumeration_type ] [e]
8 // CHECK: [[TEST1]] = {{.*}} ; [ DW_TAG_namespace ] [test1]
9 // CHECK: [[TEST1_ENUMS]] = !{[[TEST1_E:![0-9]*]]}
10 // CHECK: [[TEST1_E]] = !{!"0x28\00E\000"} ; [ DW_TAG_enumerator ] [E :: 0]
11 enum e { E };
foo()12 void foo() {
13   int v = E;
14 }
15 }
16 
17 namespace test2 {
18 // rdar://8195980
19 // CHECK: [[E2]] = !{!"0x4\00{{.*}}", {{[^,]*}}, [[TEST2:![0-9]*]], {{.*}}, [[TEST1_ENUMS]], null, null, !"_ZTSN5test21eE"} ; [ DW_TAG_enumeration_type ] [e]
20 // CHECK: [[TEST2]] = {{.*}} ; [ DW_TAG_namespace ] [test2]
21 enum e { E };
func(int i)22 bool func(int i) {
23   return i == E;
24 }
25 }
26 
27 namespace test3 {
28 // CHECK: [[E3]] = !{!"0x4\00{{.*}}", {{[^,]*}}, [[TEST3:![0-9]*]], {{.*}}, [[TEST3_ENUMS:![0-9]*]], null, null, !"_ZTSN5test31eE"} ; [ DW_TAG_enumeration_type ] [e]
29 // CHECK: [[TEST3]] = {{.*}} ; [ DW_TAG_namespace ] [test3]
30 // CHECK: [[TEST3_ENUMS]] = !{[[TEST3_E:![0-9]*]]}
31 // CHECK: [[TEST3_E]] = !{!"0x28\00E\00-1"} ; [ DW_TAG_enumerator ] [E :: -1]
32 enum e { E = -1 };
func()33 void func() {
34   e x;
35 }
36 }
37 
38 namespace test4 {
39 // Don't try to build debug info for a dependent enum.
40 // CHECK-NOT: test4
41 template <typename T>
42 struct S {
43   enum e { E = T::v };
44 };
45 }
46