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