Skip to content

Commit 92f782c

Browse files
committed
[test] Stabilize IRGen/trap-function.swift a bit
1 parent 2966dce commit 92f782c

File tree

2 files changed

+29
-25
lines changed

2 files changed

+29
-25
lines changed

test/IRGen/trap-function-clang.swift

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: %build-irgen-test-overlays
3+
// RUN: %target-swift-frontend -sdk %S/Inputs -primary-file %s -trap-function oopsie -enable-objc-interop -emit-ir -module-name trap_function -I %t | %FileCheck %s -check-prefix=TRAPFN
4+
// RUN: %target-swift-frontend -O -sdk %S/Inputs -primary-file %s -trap-function oopsie -enable-objc-interop -emit-ir -module-name trap_function -I %t | %FileCheck %s -check-prefix=TRAPFN_OPT
5+
// RUN: %target-swift-frontend -sdk %S/Inputs -primary-file %s -enable-objc-interop -emit-ir -module-name trap_function -I %t | %FileCheck %s -check-prefix=NOTRAPFN
6+
7+
import gizmo
8+
9+
// TRAPFN-LABEL: define hidden swiftcc void @"$s13trap_function18checkClangImporteryyF"
10+
// TRAPFN: call void @llvm.trap() [[ATTR0:#[0-9]+]]
11+
12+
// TRAPFN_OPT-LABEL: define hidden swiftcc void @"$s13trap_function18checkClangImporteryyF"
13+
// TRAPFN_OPT: call void @llvm.trap() [[ATTR0:#[0-9]+]]
14+
15+
// NOTRAPFN-LABEL: define hidden swiftcc void @"$s13trap_function18checkClangImporteryyF"
16+
// NOTRAPFN: call void @llvm.trap(){{$}}
17+
func checkClangImporter() {
18+
ackbar()
19+
}
20+
21+
// TRAPFN: attributes [[ATTR0]] = { {{.*}}"trap-func-name"="oopsie" }
22+
// NOTRAPFN-NOT: attributes {{.*}} = { {{.*}}"trap-func-name"="oopsie" }

test/IRGen/trap-function.swift

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %build-irgen-test-overlays
3-
// RUN: %target-swift-frontend -sdk %S/Inputs -primary-file %s -trap-function oopsie -enable-objc-interop -emit-ir -module-name trap_function -I %t | %FileCheck %s -check-prefix=TRAPFN
4-
// RUN: %target-swift-frontend -O -sdk %S/Inputs -primary-file %s -trap-function oopsie -enable-objc-interop -emit-ir -module-name trap_function -I %t | %FileCheck %s -check-prefix=TRAPFN_OPT
5-
// RUN: %target-swift-frontend -sdk %S/Inputs -primary-file %s -enable-objc-interop -emit-ir -module-name trap_function -I %t | %FileCheck %s -check-prefix=NOTRAPFN
6-
7-
import gizmo
3+
// RUN: %target-swift-frontend -primary-file %s -trap-function oopsie -emit-ir -module-name trap_function -I %t | %FileCheck %s -check-prefix=TRAPFN
4+
// RUN: %target-swift-frontend -O -primary-file %s -trap-function oopsie -emit-ir -module-name trap_function -I %t | %FileCheck %s -check-prefix=TRAPFN_OPT
5+
// RUN: %target-swift-frontend -primary-file %s -emit-ir -module-name trap_function -I %t | %FileCheck %s -check-prefix=NOTRAPFN
86

97
// TRAPFN-LABEL: define hidden swiftcc {{.*}} @"$s13trap_function14checkOverflow1yS2i_SitF"
108
// TRAPFN: call void @llvm.trap() [[ATTR0:#[0-9]+]]
@@ -58,27 +56,11 @@ func checkPreconditionFailure(_ a: Int) {
5856
}
5957
}
6058

61-
// TRAPFN-LABEL: define hidden swiftcc void @"$s13trap_function18checkClangImporteryyF"
62-
// TRAPFN: call {{.*}} @ackbar()
63-
64-
// TRAPFN_OPT-LABEL: define hidden swiftcc void @"$s13trap_function18checkClangImporteryyF"
65-
// TRAPFN_OPT: call {{.*}} @ackbar()
66-
67-
// NOTRAPFN-LABEL: define hidden swiftcc void @"$s13trap_function18checkClangImporteryyF"
68-
// NOTRAPFN: call {{.*}} @ackbar()
69-
func checkClangImporter() {
70-
ackbar()
59+
// TRAPFN-LABEL: define hidden swiftcc void @"$s13trap_function10terminatoryyF"
60+
// TRAPFN_OPT-LABEL: define hidden swiftcc void @"$s13trap_function10terminatoryyF"
61+
// NOTRAPFN-LABEL: define hidden swiftcc void @"$s13trap_function10terminatoryyF"
62+
func terminator() {
7163
}
7264

73-
// TRAPFN-LABEL: define internal {{.*}} @ackbar()
74-
// TRAPFN: call void @llvm.trap() [[ATTR0]]
75-
76-
// TRAPFN_OPT-LABEL: define internal {{.*}} @ackbar()
77-
// TRAPFN_OPT: call void @llvm.trap() [[ATTR0]]
78-
79-
// NOTRAPFN-LABEL: define internal {{.*}} @ackbar()
80-
// NOTRAPFN: call void @llvm.trap(){{$}}
81-
82-
8365
// TRAPFN: attributes [[ATTR0]] = { {{.*}}"trap-func-name"="oopsie" }
8466
// NOTRAPFN-NOT: attributes {{.*}} = { {{.*}}"trap-func-name"="oopsie" }

0 commit comments

Comments
 (0)