File tree Expand file tree Collapse file tree 4 files changed +41
-0
lines changed Expand file tree Collapse file tree 4 files changed +41
-0
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ Name: SwiftImportAsForObjC
3
+ Classes:
4
+ - Name: MethodTest
5
+ Methods:
6
+ - Selector: getUnowned
7
+ MethodKind: Instance
8
+ SwiftReturnOwnership: unretained
9
+ - Selector: getOwned
10
+ MethodKind: Instance
11
+ SwiftReturnOwnership: retained
12
+
13
+ Functions:
14
+ - Name: getObjCUnowned
15
+ SwiftReturnOwnership: unretained
16
+ - Name: getObjCOwned
17
+ SwiftReturnOwnership: retained
Original file line number Diff line number Diff line change
1
+ struct RefCountedType { int value; };
2
+
3
+ @interface MethodTest
4
+ - (struct RefCountedType *)getUnowned ;
5
+ - (struct RefCountedType *)getOwned ;
6
+ @end
7
+
8
+ struct RefCountedType * getObjCUnowned (void );
9
+ struct RefCountedType * getObjCOwned (void );
Original file line number Diff line number Diff line change @@ -57,3 +57,7 @@ module Templates {
57
57
module SwiftImportAs {
58
58
header "SwiftImportAs.h"
59
59
}
60
+
61
+ module SwiftReturnOwnershipForObjC {
62
+ header "SwiftReturnOwnershipForObjC.h"
63
+ }
Original file line number Diff line number Diff line change
1
+ // RUN: rm -rf %t && mkdir -p %t
2
+ // RUN: %clang_cc1 -fmodules -fblocks -fimplicit-module-maps -fmodules-cache-path=%t/ModulesCache -fdisable-module-hash -fapinotes-modules -fsyntax-only -I %S/Inputs/Headers %s
3
+ // RUN: %clang_cc1 -ast-print %t/ModulesCache/SwiftReturnOwnershipForObjC.pcm | FileCheck %s
4
+ #import < SwiftReturnOwnershipForObjC.h>
5
+
6
+ // CHECK: @interface MethodTest
7
+ // CHECK: - (struct RefCountedType *)getUnowned __attribute__((swift_attr("returns_unretained")));
8
+ // CHECK: - (struct RefCountedType *)getOwned __attribute__((swift_attr("returns_retained")));
9
+ // CHECK: @end
10
+ // CHECK: __attribute__((swift_attr("returns_unretained"))) struct RefCountedType *getObjCUnowned(void);
11
+ // CHECK: __attribute__((swift_attr("returns_retained"))) struct RefCountedType *getObjCOwned(void);
You can’t perform that action at this time.
0 commit comments