Skip to content

Commit 2113df4

Browse files
committed
Improve testcase
This patch makes BoundGenericEnum more robust by splitting it into three separately executed FileCheck invocation. It further corrects an error in case (1) were the wrong variable was being checked. Finally, by enabling optimizations, it is easier to follow why the generic arguments have different sizes.
1 parent b826b3c commit 2113df4

File tree

1 file changed

+28
-31
lines changed

1 file changed

+28
-31
lines changed

test/DebugInfo/BoundGenericEnum.swift

Lines changed: 28 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
// RUN: %target-swift-frontend %s -Onone -emit-ir -g -o - -module-name a \
2-
// RUN: -disable-debugger-shadow-copies | %FileCheck %s
1+
// RUN: %target-swift-frontend %s -O -emit-ir -g -o %t.ll -module-name a
2+
// RUN: cat %t.ll | %FileCheck %s --check-prefix=CASE_0
3+
// RUN: cat %t.ll | %FileCheck %s --check-prefix=CASE_1
4+
// RUN: cat %t.ll | %FileCheck %s --check-prefix=CASE_2
35
public enum Result<Value> {
46
case success(Value)
57
case failure(Error)
@@ -16,7 +18,9 @@ extension Result {
1618
}
1719
}
1820

21+
@inline(never)
1922
func use<T>(_ t : T) {
23+
print(t)
2024
}
2125

2226
public class SomeClass {
@@ -52,36 +56,29 @@ y.g()
5256
// identifier.
5357

5458
// (0) unsized.
55-
// CHECK: !DISubprogram(name: "map", {{.*}}line: 9, type: ![[SBTY:[0-9]+]]
56-
// CHECK: ![[SBTY]] = !DISubroutineType(types: ![[SBTYS:[0-9]+]])
57-
// CHECK: ![[SBTYS]] = !{!{{[0-9]+}}, !{{[0-9]+}}, ![[SELFTY:[0-9]+]]}
58-
// CHECK: ![[SELFTY]] =
59-
// CHECK-SAME: !DICompositeType(tag: DW_TAG_structure_type, {{.*}}line: 3,
60-
// CHECK-SAME: elements: ![[UNSIZED_ELTS:[0-9]+]]
61-
// CHECK: ![[UNSIZED_ELTS]] = !{![[UNSIZED_MEM:[0-9]+]]}
62-
// CHECK: ![[UNSIZED_MEM]] = !DIDerivedType(tag: DW_TAG_member,
63-
// CHECK-SAME: baseType: ![[UNIQ:[0-9]+]]
59+
// CASE_0-DAG: !DISubprogram(name: "map", {{.*}}line: 11, type: ![[SBTY:[0-9]+]]
60+
// CASE_0-DAG: ![[SBTY]] = !DISubroutineType(types: ![[SBTYS:[0-9]+]])
61+
// CASE_0-DAG: ![[SBTYS]] = !{!{{[0-9]+}}, !{{[0-9]+}}, ![[SELFTY:[0-9]+]]}
62+
// CASE_0-DAG: ![[SELFTY]] = !DICompositeType(tag: DW_TAG_structure_type, {{.*}}line: 5, {{.*}}elements: ![[UNSIZED_ELTS:[0-9]+]]
63+
// CASE_0-DAG: ![[UNSIZED_ELTS]] = !{![[UNSIZED_MEM:[0-9]+]]}
64+
// CASE_0-DAG: ![[UNSIZED_MEM]] = !DIDerivedType(tag: DW_TAG_member, {{.*}} baseType: ![[UNIQ:[0-9]+]]
6465

6566
// The unique unsized type.
66-
// CHECK: ![[UNIQ]] = !DICompositeType(
67-
// CHECK-SAME: tag: DW_TAG_structure_type, name: "Result",
68-
// CHECK-SAME: line: 3,
69-
// CHECK-NOT: size:
70-
// CHECK-SAME: runtimeLang: DW_LANG_Swift,
71-
// CHECK-SAME: identifier: "$s1a6ResultOyxGD")
72-
73-
// (2)
74-
// CHECK: !DILocalVariable(name: "self", arg: 2, {{.*}}line: 9,
75-
// CHECK-SAME: type: ![[C_TUP:[0-9]+]]
76-
// CHECK: ![[C_TUP]] = !DIDerivedType(tag: DW_TAG_const_type,
77-
// CHECK-SAME: baseType: ![[TUP:[0-9]+]])
78-
// CHECK: ![[TUP]] = !DICompositeType(tag: DW_TAG_structure_type,
79-
// CHECK-SAME: line: 3, size: {{256|512}},
67+
// CASE_0: ![[UNIQ]] = !DICompositeType(
68+
// CASE_0-SAME: tag: DW_TAG_structure_type, name: "Result",
69+
// CASE_0-SAME: line: 5,
70+
// CASE_0-NOT: size:
71+
// CASE_0-SAME: runtimeLang: DW_LANG_Swift,
72+
// CASE_0-SAME: identifier: "$s1a6ResultOyxGD")
8073

8174
// (1)
82-
// CHECK: !DILocalVariable(name: "self", arg: 1, {{.*}}line: 27,
83-
// CHECK-SAME: type: ![[C_CLASS:[0-9]+]]
84-
// CHECK: ![[C_CLASS]] = !DIDerivedType(tag: DW_TAG_const_type,
85-
// CHECK-SAME: baseType: ![[CLASS:[0-9]+]])
86-
// CHECK: ![[CLASS]] = !DICompositeType(tag: DW_TAG_structure_type,
87-
// CHECK-SAME: line: 3, size:
75+
// CASE_1-DAG: ![[F:[0-9]+]] = distinct !DISubprogram(name: "f",
76+
// CASE_1-DAG: !DILocalVariable(name: "self", arg: 1, scope: ![[F]],{{.*}} line: 31,{{.*}} type: ![[C_CLASS:[0-9]+]]
77+
// CASE_1-DAG: ![[C_CLASS]] = !DIDerivedType(tag: DW_TAG_const_type,{{.*}} baseType: ![[CLASS:[0-9]+]])
78+
// CASE_1-DAG: ![[CLASS]] = !DICompositeType(tag: DW_TAG_structure_type,{{.*}} line: 5, size: {{40|72}}
79+
80+
// (2)
81+
// CASE_2-DAG: ![[G:[0-9]+]] = distinct !DISubprogram(name: "g",
82+
// CASE_2-DAG: !DILocalVariable(name: "self", arg: 1, scope: ![[G]],{{.*}} line: 38,{{.*}} type: ![[C_TUP:[0-9]+]]
83+
// CASE_2-DAG: ![[C_TUP]] = !DIDerivedType(tag: DW_TAG_const_type,{{.*}} baseType: ![[TUP:[0-9]+]])
84+
// CASE_2-DAG: ![[TUP]] = !DICompositeType(tag: DW_TAG_structure_type,{{.*}} line: 5, size: {{264|512}},

0 commit comments

Comments
 (0)