2015-10-08 12:24:12 +08:00
|
|
|
// RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited -triple x86_64-apple-darwin -std=c++11 %s -o - | FileCheck %s
|
2012-05-23 08:09:47 +08:00
|
|
|
|
|
|
|
enum class A { A1=1 }; // underlying type is int by default
|
|
|
|
enum class B: unsigned long { B1=1 }; // underlying type is unsigned long
|
|
|
|
enum C { C1 = 1 };
|
2012-06-01 08:22:57 +08:00
|
|
|
enum D : short; // enum forward declaration
|
2016-03-25 08:20:35 +08:00
|
|
|
enum Z : int;
|
2012-05-23 08:09:47 +08:00
|
|
|
A a;
|
|
|
|
B b;
|
|
|
|
C c;
|
2012-06-01 08:22:57 +08:00
|
|
|
D d;
|
2012-05-23 08:09:47 +08:00
|
|
|
|
2015-04-30 00:40:08 +08:00
|
|
|
// CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, name: "A"
|
2015-03-04 01:25:55 +08:00
|
|
|
// CHECK-SAME: line: 3
|
|
|
|
// CHECK-SAME: baseType: ![[INT:[0-9]+]]
|
|
|
|
// CHECK-SAME: size: 32, align: 32
|
|
|
|
// CHECK-NOT: offset:
|
|
|
|
// CHECK-NOT: flags:
|
|
|
|
// CHECK-SAME: ){{$}}
|
2015-04-30 00:40:08 +08:00
|
|
|
// CHECK: ![[INT]] = !DIBasicType(name: "int"
|
|
|
|
// CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, name: "B"
|
2015-03-04 01:25:55 +08:00
|
|
|
// CHECK-SAME: line: 4
|
|
|
|
// CHECK-SAME: baseType: ![[ULONG:[0-9]+]]
|
|
|
|
// CHECK-SAME: size: 64, align: 64
|
|
|
|
// CHECK-NOT: offset:
|
|
|
|
// CHECK-NOT: flags:
|
|
|
|
// CHECK-SAME: ){{$}}
|
2015-04-30 00:40:08 +08:00
|
|
|
// CHECK: ![[ULONG]] = !DIBasicType(name: "long unsigned int"
|
|
|
|
// CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, name: "C"
|
2015-03-04 01:25:55 +08:00
|
|
|
// CHECK-SAME: line: 5
|
|
|
|
// CHECK-NOT: baseType:
|
|
|
|
// CHECK-SAME: size: 32, align: 32
|
|
|
|
// CHECK-NOT: offset:
|
|
|
|
// CHECK-NOT: flags:
|
|
|
|
// CHECK-SAME: ){{$}}
|
2012-10-05 09:49:33 +08:00
|
|
|
|
|
|
|
namespace PR14029 {
|
|
|
|
// Make sure this doesn't crash/assert.
|
|
|
|
template <typename T> struct Test {
|
|
|
|
enum class Tag {
|
|
|
|
test = 0
|
|
|
|
};
|
|
|
|
Test() {
|
|
|
|
auto t = Tag::test;
|
|
|
|
}
|
|
|
|
Tag tag() const { return static_cast<Tag>(1); }
|
|
|
|
};
|
|
|
|
Test<int> t;
|
|
|
|
}
|
2014-05-07 02:35:21 +08:00
|
|
|
|
|
|
|
namespace test2 {
|
|
|
|
// FIXME: this should just be a declaration under -fno-standalone-debug
|
2015-04-30 00:40:08 +08:00
|
|
|
// CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, name: "E"
|
2015-03-04 01:25:55 +08:00
|
|
|
// CHECK-SAME: scope: [[TEST2:![0-9]+]]
|
|
|
|
// CHECK-SAME: elements: [[TEST_ENUMS:![0-9]+]]
|
|
|
|
// CHECK-SAME: identifier: "_ZTSN5test21EE"
|
2015-04-30 00:40:08 +08:00
|
|
|
// CHECK: [[TEST2]] = !DINamespace(name: "test2"
|
2014-12-16 03:10:08 +08:00
|
|
|
// CHECK: [[TEST_ENUMS]] = !{[[TEST_E:![0-9]*]]}
|
2015-04-30 00:40:08 +08:00
|
|
|
// CHECK: [[TEST_E]] = !DIEnumerator(name: "e", value: 0)
|
2014-05-07 02:35:21 +08:00
|
|
|
enum E : int;
|
|
|
|
void func(E *) {
|
|
|
|
}
|
|
|
|
enum E : int { e };
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace test3 {
|
|
|
|
// FIXME: this should just be a declaration under -fno-standalone-debug
|
2015-04-30 00:40:08 +08:00
|
|
|
// CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, name: "E"
|
2015-03-04 01:25:55 +08:00
|
|
|
// CHECK-SAME: scope: [[TEST3:![0-9]+]]
|
|
|
|
// CHECK-SAME: elements: [[TEST_ENUMS]]
|
|
|
|
// CHECK-SAME: identifier: "_ZTSN5test31EE"
|
2015-04-30 00:40:08 +08:00
|
|
|
// CHECK: [[TEST3]] = !DINamespace(name: "test3"
|
2014-05-07 02:35:21 +08:00
|
|
|
enum E : int { e };
|
|
|
|
void func(E *) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace test4 {
|
2015-04-30 00:40:08 +08:00
|
|
|
// CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, name: "E"
|
2015-03-04 01:25:55 +08:00
|
|
|
// CHECK-SAME: scope: [[TEST4:![0-9]+]]
|
|
|
|
// CHECK-SAME: elements: [[TEST_ENUMS]]
|
|
|
|
// CHECK-SAME: identifier: "_ZTSN5test41EE"
|
2015-04-30 00:40:08 +08:00
|
|
|
// CHECK: [[TEST4]] = !DINamespace(name: "test4"
|
2014-05-07 02:35:21 +08:00
|
|
|
enum E : int;
|
|
|
|
void f1(E *) {
|
|
|
|
}
|
|
|
|
enum E : int { e };
|
|
|
|
void f2(E) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-04-30 00:40:08 +08:00
|
|
|
// CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, name: "D"
|
2015-03-04 01:25:55 +08:00
|
|
|
// CHECK-SAME: line: 6
|
|
|
|
// CHECK-SAME: size: 16, align: 16
|
|
|
|
// CHECK-NOT: offset:
|
|
|
|
// CHECK-SAME: flags: DIFlagFwdDecl
|
2014-05-07 02:35:21 +08:00
|
|
|
|
2016-03-25 08:20:35 +08:00
|
|
|
// CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, name: "Z"
|
|
|
|
// CHECK-NOT: scope:
|
|
|
|
// CHECK-SAME: flags: DIFlagFwdDecl
|
|
|
|
void fz() { Z z; }
|
|
|
|
|
2014-05-07 02:35:21 +08:00
|
|
|
namespace test5 {
|
2016-04-24 05:08:27 +08:00
|
|
|
// CHECK: [[TEST5:![0-9]+]] = !DINamespace(name: "test5"
|
2015-04-30 00:40:08 +08:00
|
|
|
// CHECK: !DICompositeType(tag: DW_TAG_enumeration_type, name: "E"
|
2016-04-24 05:08:27 +08:00
|
|
|
// CHECK-SAME: scope: [[TEST5]]
|
2015-03-04 01:25:55 +08:00
|
|
|
// CHECK-SAME: flags: DIFlagFwdDecl
|
|
|
|
// CHECK-SAME: identifier: "_ZTSN5test51EE"
|
2014-05-07 02:35:21 +08:00
|
|
|
enum E : int;
|
|
|
|
void f1(E *) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace test6 {
|
|
|
|
// Ensure typedef'd enums aren't manifest by debug info generation.
|
|
|
|
// This could cause "typedef changes linkage of anonymous type, but linkage was
|
|
|
|
// already computed" errors.
|
2015-03-04 01:25:55 +08:00
|
|
|
// CHECK-NOT: test6
|
2014-05-07 02:35:21 +08:00
|
|
|
typedef enum {
|
|
|
|
} E;
|
|
|
|
}
|