1 // RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited -triple x86_64-apple-darwin -std=c++11 %s -o - | FileCheck %s
3 enum class A
{ A1
=1 }; // underlying type is int by default
4 enum class B
: unsigned long { B1
=1 }; // underlying type is unsigned long
6 enum D
: short; // enum forward declaration
13 // CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, name: "A"
14 // CHECK-SAME: line: 3
15 // CHECK-SAME: baseType: ![[INT:[0-9]+]]
16 // CHECK-SAME: size: 32
18 // CHECK-SAME: flags: DIFlagEnumClass
20 // CHECK: ![[INT]] = !DIBasicType(name: "int"
21 // CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, name: "B"
22 // CHECK-SAME: line: 4
23 // CHECK-SAME: baseType: ![[ULONG:[0-9]+]]
24 // CHECK-SAME: size: 64
26 // CHECK-SAME: flags: DIFlagEnumClass
28 // CHECK: ![[ULONG]] = !DIBasicType(name: "unsigned long"
29 // CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, name: "C"
30 // CHECK-SAME: line: 5
31 // CHECK-SAME: baseType: ![[ULONG:[0-9]+]]
32 // CHECK-SAME: size: 32
38 // Make sure this doesn't crash/assert.
39 template <typename T
> struct Test
{
46 Tag
tag() const { return static_cast<Tag
>(1); }
52 // FIXME: this should just be a declaration under -fno-standalone-debug
53 // CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, name: "E"
54 // CHECK-SAME: scope: [[TEST2:![0-9]+]]
55 // CHECK-NOT: DIFlagEnumClass
56 // CHECK-SAME: elements: [[TEST_ENUMS:![0-9]+]]
57 // CHECK-SAME: identifier: "_ZTSN5test21EE"
58 // CHECK: [[TEST2]] = !DINamespace(name: "test2"
59 // CHECK: [[TEST_ENUMS]] = !{[[TEST_E:![0-9]*]]}
60 // CHECK: [[TEST_E]] = !DIEnumerator(name: "e", value: 0)
68 // FIXME: this should just be a declaration under -fno-standalone-debug
69 // CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, name: "E"
70 // CHECK-SAME: scope: [[TEST3:![0-9]+]]
71 // CHECK-NOT: DIFlagEnumClass
72 // CHECK-SAME: elements: [[TEST_ENUMS]]
73 // CHECK-SAME: identifier: "_ZTSN5test31EE"
74 // CHECK: [[TEST3]] = !DINamespace(name: "test3"
81 // CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, name: "E"
82 // CHECK-SAME: scope: [[TEST4:![0-9]+]]
83 // CHECK-NOT: DIFlagEnumClass
84 // CHECK-SAME: elements: [[TEST_ENUMS]]
85 // CHECK-SAME: identifier: "_ZTSN5test41EE"
86 // CHECK: [[TEST4]] = !DINamespace(name: "test4"
95 // CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, name: "D"
96 // CHECK-SAME: line: 6
97 // CHECK-SAME: size: 16
99 // CHECK-SAME: flags: DIFlagFwdDecl
101 // CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, name: "Z"
103 // CHECK-SAME: flags: DIFlagFwdDecl
107 // CHECK: [[TEST5:![0-9]+]] = !DINamespace(name: "test5"
108 // CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, name: "E"
109 // CHECK-SAME: scope: [[TEST5]]
110 // CHECK-SAME: flags: DIFlagFwdDecl
111 // CHECK-SAME: identifier: "_ZTSN5test51EE"
118 // Ensure typedef'd enums aren't manifest by debug info generation.
119 // This could cause "typedef changes linkage of anonymous type, but linkage was
120 // already computed" errors.