File tree Expand file tree Collapse file tree 4 files changed +50
-9
lines changed
test/Interop/Cxx/exceptions Expand file tree Collapse file tree 4 files changed +50
-9
lines changed Original file line number Diff line number Diff line change 1
1
// RUN: %empty-directory(%t)
2
- // RUN: split-file %S/trap-on-exception-irgen-itanium.swift %t
2
+ // RUN: split-file %s %t
3
3
4
- // RUN: %target-swift-emit-ir %t/test.swift -I %t -enable-experimental-cxx-interop -Xcc -fignore-exceptions | %FileCheck %s
4
+ // RUN: %target-swift-emit-ir %t/test.swift -I %t/Inputs -enable-experimental-cxx-interop -Xcc -fignore-exceptions | %FileCheck %s
5
+ // RUN: %target-swift-emit-ir %t/test.swift -I %t/Inputs -enable-experimental-cxx-interop -Xcc -fno-exceptions -Xcc -fno-objc-exceptions -Xcc -DNOEXCEPTION | %FileCheck %s
5
6
6
- // note: The test sources are in 'trap-on-exception-irgen-itanium.swift'
7
+ //--- Inputs/module.modulemap
8
+ module CxxModule {
9
+ header " cxxHeader.h "
10
+ requires cplusplus
11
+ }
12
+
13
+ //--- Inputs/cxxHeader.h
14
+
15
+ inline int freeFunctionThrows( int x) {
16
+ #ifndef NOEXCEPTION
17
+ if ( x > 0 )
18
+ throw 2 ;
19
+ #endif
20
+ return - x;
21
+ }
22
+
23
+ inline int freeFunctionNoThrow( int x) noexcept {
24
+ return - x;
25
+ }
26
+
27
+ //--- test.swift
28
+
29
+ import CxxModule
30
+
31
+ func makeCInt( ) -> CInt {
32
+ return 42
33
+ }
34
+
35
+ func testFreeFunctionNoThrowOnly( ) -> CInt {
36
+ return freeFunctionNoThrow ( makeCInt ( ) )
37
+ }
38
+
39
+ func testFreeFunctionCalls( ) -> CInt {
40
+ let p = freeFunctionThrows ( 0 )
41
+ freeFunctionNoThrow ( 1 )
42
+ freeFunctionThrows ( makeCInt ( ) )
43
+ return p
44
+ }
45
+
46
+ let _ = testFreeFunctionNoThrowOnly ( )
47
+ let _ = testFreeFunctionCalls ( )
7
48
8
49
// CHECK: define {{.*}} @"$s4test0A23FreeFunctionNoThrowOnlys5Int32VyF"() #[[#SWIFTMETA:]] {
9
50
// CHECK-NEXT: :
Original file line number Diff line number Diff line change 1
1
// RUN: %empty-directory(%t)
2
2
// RUN: split-file %S/trap-on-exception-irgen-itanium.swift %t
3
3
4
- // RUN: %target-build-swift %s -I %t -o %t/trap-exceptions -Xfrontend -enable-experimental-cxx-interop -Xfrontend -validate-tbd-against-ir=none -g
4
+ // RUN: %target-build-swift %s -I %t/Inputs -o %t/trap-exceptions -Xfrontend -enable-experimental-cxx-interop -Xfrontend -validate-tbd-against-ir=none -g
5
5
// RUN: %target-codesign %t/trap-exceptions
6
6
// RUN: %target-run %t/trap-exceptions
7
7
8
- // RUN: %target-build-swift %s -I %t -o %t/trap-exceptions-no-debug -Xfrontend -enable-experimental-cxx-interop -Xfrontend -validate-tbd-against-ir=none
8
+ // RUN: %target-build-swift %s -I %t/Inputs -o %t/trap-exceptions-no-debug -Xfrontend -enable-experimental-cxx-interop -Xfrontend -validate-tbd-against-ir=none
9
9
// RUN: %target-codesign %t/trap-exceptions-no-debug
10
10
// RUN: %target-run %t/trap-exceptions-no-debug
11
11
12
- // RUN: %target-build-swift %s -I %t -o %t/trap-exceptions-opt -Xfrontend -enable-experimental-cxx-interop -Xfrontend -validate-tbd-against-ir=none -O
12
+ // RUN: %target-build-swift %s -I %t/Inputs -o %t/trap-exceptions-opt -Xfrontend -enable-experimental-cxx-interop -Xfrontend -validate-tbd-against-ir=none -O
13
13
// RUN: %target-codesign %t/trap-exceptions-opt
14
14
// RUN: %target-run %t/trap-exceptions-opt
15
15
Original file line number Diff line number Diff line change 1
1
// RUN: %empty-directory(%t)
2
2
// RUN: split-file %s %t
3
3
4
- // RUN: %target-swift-emit-ir %t/test.swift -I %t -enable-experimental-cxx-interop | %FileCheck %s
5
- // RUN: %target-swift-emit-ir %t/test.swift -I %t -enable-experimental-cxx-interop -g | %FileCheck --check-prefix=DEBUG %s
4
+ // RUN: %target-swift-emit-ir %t/test.swift -I %t/Inputs -enable-experimental-cxx-interop | %FileCheck %s
5
+ // RUN: %target-swift-emit-ir %t/test.swift -I %t/Inputs -enable-experimental-cxx-interop -g | %FileCheck --check-prefix=DEBUG %s
6
6
7
7
// UNSUPPORTED: OS=windows-msvc
8
8
Original file line number Diff line number Diff line change 1
1
// RUN: %empty-directory(%t)
2
2
// RUN: split-file %S/trap-on-exception-irgen-itanium.swift %t
3
3
4
- // RUN: %target-swift-emit-ir %t/test.swift -I %t -enable-experimental-cxx-interop | %FileCheck %s
4
+ // RUN: %target-swift-emit-ir %t/test.swift -I %t/Inputs -enable-experimental-cxx-interop | %FileCheck %s
5
5
6
6
// REQUIRES: OS=windows-msvc
7
7
You can’t perform that action at this time.
0 commit comments