File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change
1
+ // RUN: rm -rf %t
2
+ // RUN: split-file %s %t
3
+ // RUN: not %target-swift-frontend -typecheck -I %t/Inputs %t/test.swift -enable-experimental-cxx-interop 2>&1 | %FileCheck %s
4
+
5
+ //--- Inputs/module.modulemap
6
+ module Test {
7
+ header " test.h "
8
+ requires cplusplus
9
+ }
10
+
11
+ //--- Inputs/test.h
12
+ struct Ptr { int * p; } ;
13
+
14
+ struct X {
15
+ int * test( ) { }
16
+ Ptr other( ) { }
17
+ } ;
18
+
19
+ //--- test.swift
20
+
21
+ import Test
22
+
23
+ public func test( x: X ) {
24
+ // CHECK: note: Mark method 'test' as 'safe_to_import' in C++ to make it available in Swift.
25
+ // CHECK: int *test() { }
26
+ // CHECK: ^
27
+ // CHECK: __attribute__((swift_attr("safe_to_import")))
28
+
29
+ x. test ( )
30
+
31
+ // CHECK: note: Mark method 'other' as 'safe_to_import' in C++ to make it available in Swift.
32
+ // CHECK: Ptr other() { }
33
+ // CHECK: ^
34
+ // CHECK: __attribute__((swift_attr("safe_to_import")))
35
+
36
+ // CHECK: note: Mark type 'Ptr' as 'self_contained' in C++ to make methods that use it available in Swift.
37
+ // CHECK: struct X {
38
+ // CHECK: ^
39
+ // CHECK: __attribute__((swift_attr("self_contained")))
40
+ x. other ( )
41
+ }
You can’t perform that action at this time.
0 commit comments