Skip to content

Commit 78369ca

Browse files
committed
fixup! add missing test file
1 parent e5bc858 commit 78369ca

File tree

1 file changed

+108
-0
lines changed

1 file changed

+108
-0
lines changed
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
// RUN: %clangxx -target arm64-apple-macosx11.0.0 -g -debug-info-kind=standalone %s -emit-llvm -S -o - | FileCheck --check-prefixes=CHECK %s
2+
// RUN: %clangxx -target arm64-apple-macosx11.0.0 -g -debug-info-kind=limited %s -emit-llvm -S -o - | FileCheck --check-prefixes=CHECK %s
3+
4+
enum class Enum : int {
5+
VAL = -1
6+
};
7+
8+
struct Empty {};
9+
struct Fwd;
10+
11+
constexpr auto func() { return 25; }
12+
13+
struct Foo {
14+
static constexpr int cexpr_int_with_addr = func();
15+
static constexpr int cexpr_int2 = func() + 1;
16+
static constexpr float cexpr_float = 2.0 + 1.0;
17+
static constexpr Enum cexpr_enum = Enum::VAL;
18+
static constexpr Empty cexpr_struct_with_addr{};
19+
static inline Enum inline_enum = Enum::VAL;
20+
21+
template<typename T, unsigned V>
22+
static constexpr auto cexpr_template = V;
23+
24+
static const auto empty_templated = cexpr_template<Fwd, 1>;
25+
};
26+
27+
int main() {
28+
Foo f;
29+
//Bar b;
30+
31+
// Force global variable definitions to be emitted.
32+
(void)&Foo::cexpr_int_with_addr;
33+
(void)&Foo::cexpr_struct_with_addr;
34+
35+
return Foo::cexpr_int_with_addr + Foo::cexpr_float
36+
+ (int)Foo::cexpr_enum + Foo::cexpr_template<short, 5>
37+
+ Foo::empty_templated;
38+
}
39+
40+
// CHECK: @{{.*}}cexpr_int_with_addr{{.*}} =
41+
// CHECK-SAME: !dbg ![[INT_GLOBAL:[0-9]+]]
42+
43+
// CHECK: @{{.*}}cexpr_struct_with_addr{{.*}} =
44+
// CHECK-SAME !dbg ![[EMPTY_GLOBAL:[0-9]+]]
45+
46+
// CHECK: !DIGlobalVariableExpression(var: ![[INT_VAR:[0-9]+]], expr: !DIExpression())
47+
// CHECK: ![[INT_VAR]] = distinct !DIGlobalVariable(name: "cexpr_int_with_addr", linkageName:
48+
// CHECK-SAME: isLocal: false, isDefinition: true, declaration: ![[INT_DECL:[0-9]+]])
49+
50+
// CHECK: ![[INT_DECL]] = !DIDerivedType(tag: DW_TAG_member, name: "cexpr_int_with_addr",
51+
// CHECK-SAME: flags: DIFlagStaticMember
52+
// CHECK-NOT: extraData:
53+
54+
// CHECK: ![[INT_DECL2:[0-9]+]] = !DIDerivedType(tag: DW_TAG_member, name: "cexpr_int2",
55+
// CHECK-SAME: flags: DIFlagStaticMember
56+
// CHECK-NOT: extraData:
57+
58+
// CHECK: ![[FLOAT_DECL:[0-9]+]] = !DIDerivedType(tag: DW_TAG_member, name: "cexpr_float",
59+
// CHECK-SAME: flags: DIFlagStaticMember
60+
// CHECK-NOT: extraData:
61+
62+
// CHECK: ![[ENUM_DECL:[0-9]+]] = !DIDerivedType(tag: DW_TAG_member, name: "cexpr_enum",
63+
// CHECK-SAME: flags: DIFlagStaticMember
64+
// CHECK-NOT: extraData:
65+
66+
// CHECK: ![[EMPTY_DECL:[0-9]+]] = !DIDerivedType(tag: DW_TAG_member, name: "cexpr_struct_with_addr",
67+
// CHECK-SAME: flags: DIFlagStaticMember
68+
// CHECK-NOT: extraData:
69+
70+
// CHECK: ![[IENUM_DECL:[0-9]+]] = !DIDerivedType(tag: DW_TAG_member, name: "inline_enum",
71+
// CHECK-SAME: flags: DIFlagStaticMember
72+
// CHECK-NOT: extraData:
73+
74+
// CHECK: ![[EMPTY_TEMPLATED_DECL:[0-9]+]] = !DIDerivedType(tag: DW_TAG_member, name: "empty_templated",
75+
// CHECK-SAME: flags: DIFlagStaticMember
76+
// CHECK-NOT: extraData:
77+
78+
// CHECK: ![[TEMPLATE_DECL:[0-9]+]] = !DIDerivedType(tag: DW_TAG_member, name: "cexpr_template",
79+
// CHECK-SAME: flags: DIFlagStaticMember
80+
// CHECK-NOT: extraData:
81+
82+
// CHECK: !DIGlobalVariableExpression(var: ![[EMPTY_VAR:[0-9]+]], expr: !DIExpression())
83+
// CHECK: ![[EMPTY_VAR]] = distinct !DIGlobalVariable(name: "cexpr_struct_with_addr", linkageName:
84+
// CHECK-SAME: isLocal: false, isDefinition: true, declaration: ![[EMPTY_DECL]])
85+
86+
// CHECK: !DIGlobalVariableExpression(var: ![[INT_VAR2:[0-9]+]], expr: !DIExpression(DW_OP_constu, 26, DW_OP_stack_value))
87+
// CHECK: ![[INT_VAR2]] = distinct !DIGlobalVariable(name: "cexpr_int2", linkageName:
88+
// CHECK-SAME: isLocal: true, isDefinition: true, declaration: ![[INT_DECL2]])
89+
90+
// CHECK: !DIGlobalVariableExpression(var: ![[FLOAT_VAR:[0-9]+]], expr: !DIExpression(DW_OP_constu, {{.*}}, DW_OP_stack_value))
91+
// CHECK: ![[FLOAT_VAR]] = distinct !DIGlobalVariable(name: "cexpr_float", linkageName:
92+
// CHECK-SAME: isLocal: true, isDefinition: true, declaration: ![[FLOAT_DECL]])
93+
94+
// CHECK: !DIGlobalVariableExpression(var: ![[ENUM_VAR:[0-9]+]], expr: !DIExpression(DW_OP_constu, {{.*}}, DW_OP_stack_value))
95+
// CHECK: ![[ENUM_VAR]] = distinct !DIGlobalVariable(name: "cexpr_enum", linkageName:
96+
// CHECK-SAME: isLocal: true, isDefinition: true, declaration: ![[ENUM_DECL]])
97+
98+
// CHECK: !DIGlobalVariableExpression(var: ![[IENUM_VAR:[0-9]+]], expr: !DIExpression(DW_OP_constu, {{.*}}, DW_OP_stack_value))
99+
// CHECK: ![[IENUM_VAR]] = distinct !DIGlobalVariable(name: "inline_enum", linkageName:
100+
// CHECK-SAME: isLocal: true, isDefinition: true, declaration: ![[IENUM_DECL]])
101+
102+
// CHECK: !DIGlobalVariableExpression(var: ![[EMPTY_TEMPLATED_VAR:[0-9]+]], expr: !DIExpression(DW_OP_constu, 1, DW_OP_stack_value))
103+
// CHECK: ![[EMPTY_TEMPLATED_VAR]] = distinct !DIGlobalVariable(name: "empty_templated", linkageName:
104+
// CHECK-SAME: isLocal: true, isDefinition: true, declaration: ![[EMPTY_TEMPLATED_DECL]])
105+
106+
// CHECK: !DIGlobalVariableExpression(var: ![[TEMPLATE_VAR:[0-9]+]], expr: !DIExpression(DW_OP_constu, 5, DW_OP_stack_value))
107+
// CHECK: ![[TEMPLATE_VAR]] = distinct !DIGlobalVariable(name: "cexpr_template", linkageName:
108+
// CHECK-SAME: isLocal: true, isDefinition: true, declaration: ![[TEMPLATE_DECL]], templateParams: ![[TEMPLATE_PARMS_2:[0-9]+]])

0 commit comments

Comments
 (0)