David Blaikie | a32165c | 2013-06-24 06:47:30 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -emit-llvm -g %s -o - | FileCheck %s |
Devang Patel | 6a9bb30 | 2010-08-10 20:01:51 +0000 | [diff] [blame] | 2 | |
David Blaikie | a32165c | 2013-06-24 06:47:30 +0000 | [diff] [blame] | 3 | // CHECK: [[ENUMS:![0-9]*]], {{[^,]*}}, {{[^,]*}}, {{[^,]*}}, {{[^,]*}}, {{[^,]*}}} ; [ DW_TAG_compile_unit ] |
David Blaikie | ac8f43c | 2013-06-24 07:13:13 +0000 | [diff] [blame] | 4 | // CHECK: [[ENUMS]] = metadata !{metadata [[E1:![0-9]*]], metadata [[E2:![0-9]*]], metadata [[E3:![0-9]*]]} |
David Blaikie | a32165c | 2013-06-24 06:47:30 +0000 | [diff] [blame] | 5 | |
| 6 | namespace test1 { |
Manman Ren | f1acc31 | 2013-08-29 18:51:51 +0000 | [diff] [blame] | 7 | // CHECK: [[E1]] = metadata !{i32 {{[^,]*}}, {{[^,]*}}, metadata [[TEST1:![0-9]*]], {{.*}}, metadata [[TEST1_ENUMS:![0-9]*]], {{[^,]*}}, null, null, metadata !"_ZTSN5test11eE"} ; [ DW_TAG_enumeration_type ] [e] |
David Blaikie | a32165c | 2013-06-24 06:47:30 +0000 | [diff] [blame] | 8 | // 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] |
| 11 | enum e { E }; |
| 12 | void foo() { |
| 13 | int v = E; |
| 14 | } |
| 15 | } |
| 16 | |
| 17 | namespace test2 { |
| 18 | // rdar://8195980 |
Manman Ren | f1acc31 | 2013-08-29 18:51:51 +0000 | [diff] [blame] | 19 | // CHECK: [[E2]] = metadata !{i32 {{[^,]*}}, {{[^,]*}}, metadata [[TEST2:![0-9]*]], {{.*}}, metadata [[TEST1_ENUMS]], {{[^,]*}}, null, null, metadata !"_ZTSN5test21eE"} ; [ DW_TAG_enumeration_type ] [e] |
David Blaikie | a32165c | 2013-06-24 06:47:30 +0000 | [diff] [blame] | 20 | // CHECK: [[TEST2]] = {{.*}} ; [ DW_TAG_namespace ] [test2] |
| 21 | enum e { E }; |
| 22 | bool func(int i) { |
| 23 | return i == E; |
| 24 | } |
Devang Patel | 6a9bb30 | 2010-08-10 20:01:51 +0000 | [diff] [blame] | 25 | } |
David Blaikie | ac8f43c | 2013-06-24 07:13:13 +0000 | [diff] [blame] | 26 | |
| 27 | namespace test3 { |
Manman Ren | f1acc31 | 2013-08-29 18:51:51 +0000 | [diff] [blame] | 28 | // CHECK: [[E3]] = metadata !{i32 {{[^,]*}}, {{[^,]*}}, metadata [[TEST3:![0-9]*]], {{.*}}, metadata [[TEST3_ENUMS:![0-9]*]], {{[^,]*}}, null, null, metadata !"_ZTSN5test31eE"} ; [ DW_TAG_enumeration_type ] [e] |
David Blaikie | ac8f43c | 2013-06-24 07:13:13 +0000 | [diff] [blame] | 29 | // 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] |
| 32 | enum e { E = -1 }; |
| 33 | void func() { |
| 34 | e x; |
| 35 | } |
| 36 | } |