Skip to content

Commit b4d85d1

Browse files
committed
[PP-EXT] Add tests for ctors
1 parent ab65c50 commit b4d85d1

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

clang/test/CodeGen/pp-generalization.c

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,36 @@
1919
// CHECK-LL: %struct.__pp_struct_Generalization__Base1 = type { %struct.Generalization, %struct.Base1 }
2020
// CHECK-LL: %struct.__pp_struct_Generalization__Base2 = type { %struct.Generalization, %struct.Base2 }
2121

22+
// CHECK-LL: @__pp_tags_Figure = dso_local global i32 0, align 4
23+
// CHECK-LL: @__pp_tag__pp_struct_Figure__Circle = dso_local global i32 0, align 4
24+
// CHECK-LL: @__pp_tag__pp_struct_Figure__Rectangle = dso_local global i32 0, align 4
25+
// CHECK-LL: @llvm.global_ctors = appending global [2 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 101, ptr @__pp_tag__pp_struct_Figure__Circle, ptr null }, { i32, ptr, ptr } { i32 101, ptr @__pp_tag__pp_struct_Figure__Rectangle, ptr null }]
26+
2227
// CHECK-LL: double @check_gen_b1(ptr noundef byval(%struct.__pp_struct_Generalization__Base1) align 8 %gb)
2328
// CHECK-LL: double @check_gen_b2(ptr noundef byval(%struct.__pp_struct_Generalization__Base2) align 8 %gb)
2429

30+
// CHECK-LL: ; Function Attrs: noinline nounwind optnone uwtable
31+
// CHECK-LL: define dso_local void @__pp_tag__pp_struct_Figure__Circle() #0 {
32+
// CHECK-LL: entry:
33+
// CHECK-LL: %0 = load i32, ptr @__pp_tags_Figure, align 4
34+
// CHECK-LL: %inc = add nsw i32 %0, 1
35+
// CHECK-LL: store i32 %inc, ptr @__pp_tags_Figure, align 4
36+
// CHECK-LL: %1 = load i32, ptr @__pp_tags_Figure, align 4
37+
// CHECK-LL: store i32 %1, ptr @__pp_tag__pp_struct_Figure__Circle, align 4
38+
// CHECK-LL: ret void
39+
// CHECK-LL: }
40+
41+
// CHECK-LL: ; Function Attrs: noinline nounwind optnone uwtable
42+
// CHECK-LL: define dso_local void @__pp_tag__pp_struct_Figure__Rectangle() #0 {
43+
// CHECK-LL: entry:
44+
// CHECK-LL: %0 = load i32, ptr @__pp_tags_Figure, align 4
45+
// CHECK-LL: %inc = add nsw i32 %0, 1
46+
// CHECK-LL: store i32 %inc, ptr @__pp_tags_Figure, align 4
47+
// CHECK-LL: %1 = load i32, ptr @__pp_tags_Figure, align 4
48+
// CHECK-LL: store i32 %1, ptr @__pp_tag__pp_struct_Figure__Rectangle, align 4
49+
// CHECK-LL: ret void
50+
// CHECK-LL: }
51+
2552
// CHECK-AST: |-RecordDecl {{.*}} struct Base1 definition
2653
// CHECK-AST-NEXT:| `-FieldDecl {{.*}} i 'int'
2754
// CHECK-AST-NEXT:|-RecordDecl {{.*}} struct Base2 definition

0 commit comments

Comments
 (0)