1 // RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm -g %s -o - | FileCheck %s 2 3 // CHECK: !MDCompileUnit( 4 // CHECK-SAME: enums: [[ENUMS:![0-9]*]] 5 // CHECK: [[ENUMS]] = !{[[E1:![0-9]*]], [[E2:![0-9]*]], [[E3:![0-9]*]]} 6 7 namespace test1 { 8 // CHECK: [[E1]] = !MDCompositeType(tag: DW_TAG_enumeration_type, name: "e" 9 // CHECK-SAME: scope: [[TEST1:![0-9]*]] 10 // CHECK-SAME: elements: [[TEST1_ENUMS:![0-9]*]] 11 // CHECK-SAME: identifier: "_ZTSN5test11eE" 12 // CHECK: [[TEST1]] = !MDNamespace(name: "test1" 13 // CHECK: [[TEST1_ENUMS]] = !{[[TEST1_E:![0-9]*]]} 14 // CHECK: [[TEST1_E]] = !MDEnumerator(name: "E", value: 0) 15 enum e { E }; 16 void foo() { 17 int v = E; 18 } 19 } 20 21 namespace test2 { 22 // rdar://8195980 23 // CHECK: [[E2]] = !MDCompositeType(tag: DW_TAG_enumeration_type, name: "e" 24 // CHECK-SAME: scope: [[TEST2:![0-9]+]] 25 // CHECK-SAME: elements: [[TEST1_ENUMS]] 26 // CHECK-SAME: identifier: "_ZTSN5test21eE" 27 // CHECK: [[TEST2]] = !MDNamespace(name: "test2" 28 enum e { E }; 29 bool func(int i) { 30 return i == E; 31 } 32 } 33 34 namespace test3 { 35 // CHECK: [[E3]] = !MDCompositeType(tag: DW_TAG_enumeration_type, name: "e" 36 // CHECK-SAME: scope: [[TEST3:![0-9]*]] 37 // CHECK-SAME: elements: [[TEST3_ENUMS:![0-9]*]] 38 // CHECK-SAME: identifier: "_ZTSN5test31eE" 39 // CHECK: [[TEST3]] = !MDNamespace(name: "test3" 40 // CHECK: [[TEST3_ENUMS]] = !{[[TEST3_E:![0-9]*]]} 41 // CHECK: [[TEST3_E]] = !MDEnumerator(name: "E", value: -1) 42 enum e { E = -1 }; 43 void func() { 44 e x; 45 } 46 } 47 48 namespace test4 { 49 // Don't try to build debug info for a dependent enum. 50 // CHECK-NOT: test4 51 template <typename T> 52 struct S { 53 enum e { E = T::v }; 54 }; 55 } 56