blob: f0e2608db856ae5b3fd0dbe328e866a002638a76 [file] [log] [blame]
David Blaikiea32165c2013-06-24 06:47:30 +00001// RUN: %clang_cc1 -emit-llvm -g %s -o - | FileCheck %s
Devang Patel6a9bb302010-08-10 20:01:51 +00002
David Blaikiea32165c2013-06-24 06:47:30 +00003// CHECK: [[ENUMS:![0-9]*]], {{[^,]*}}, {{[^,]*}}, {{[^,]*}}, {{[^,]*}}, {{[^,]*}}} ; [ DW_TAG_compile_unit ]
David Blaikieac8f43c2013-06-24 07:13:13 +00004// CHECK: [[ENUMS]] = metadata !{metadata [[E1:![0-9]*]], metadata [[E2:![0-9]*]], metadata [[E3:![0-9]*]]}
David Blaikiea32165c2013-06-24 06:47:30 +00005
6namespace test1 {
Manman Renf1acc312013-08-29 18:51:51 +00007// CHECK: [[E1]] = metadata !{i32 {{[^,]*}}, {{[^,]*}}, metadata [[TEST1:![0-9]*]], {{.*}}, metadata [[TEST1_ENUMS:![0-9]*]], {{[^,]*}}, null, null, metadata !"_ZTSN5test11eE"} ; [ DW_TAG_enumeration_type ] [e]
David Blaikiea32165c2013-06-24 06:47:30 +00008// CHECK: [[TEST1]] = {{.*}} ; [ DW_TAG_namespace ] [test1]
9// CHECK: [[TEST1_ENUMS]] = metadata !{metadata [[TEST1_E:![0-9]*]]}
10// CHECK: [[TEST1_E]] = {{.*}}, metadata !"E", i64 0} ; [ DW_TAG_enumerator ] [E :: 0]
11enum e { E };
12void foo() {
13 int v = E;
14}
15}
16
17namespace test2 {
18// rdar://8195980
Manman Renf1acc312013-08-29 18:51:51 +000019// CHECK: [[E2]] = metadata !{i32 {{[^,]*}}, {{[^,]*}}, metadata [[TEST2:![0-9]*]], {{.*}}, metadata [[TEST1_ENUMS]], {{[^,]*}}, null, null, metadata !"_ZTSN5test21eE"} ; [ DW_TAG_enumeration_type ] [e]
David Blaikiea32165c2013-06-24 06:47:30 +000020// CHECK: [[TEST2]] = {{.*}} ; [ DW_TAG_namespace ] [test2]
21enum e { E };
22bool func(int i) {
23 return i == E;
24}
Devang Patel6a9bb302010-08-10 20:01:51 +000025}
David Blaikieac8f43c2013-06-24 07:13:13 +000026
27namespace test3 {
Manman Renf1acc312013-08-29 18:51:51 +000028// CHECK: [[E3]] = metadata !{i32 {{[^,]*}}, {{[^,]*}}, metadata [[TEST3:![0-9]*]], {{.*}}, metadata [[TEST3_ENUMS:![0-9]*]], {{[^,]*}}, null, null, metadata !"_ZTSN5test31eE"} ; [ DW_TAG_enumeration_type ] [e]
David Blaikieac8f43c2013-06-24 07:13:13 +000029// CHECK: [[TEST3]] = {{.*}} ; [ DW_TAG_namespace ] [test3]
30// CHECK: [[TEST3_ENUMS]] = metadata !{metadata [[TEST3_E:![0-9]*]]}
31// CHECK: [[TEST3_E]] = {{.*}}, metadata !"E", i64 -1} ; [ DW_TAG_enumerator ] [E :: -1]
32enum e { E = -1 };
33void func() {
34 e x;
35}
36}