llvm-project
38 строк · 1.9 Кб
1// RUN: rm -rf %t && mkdir -p %t
2// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/ModulesCache -fapinotes-modules -fdisable-module-hash -fsyntax-only -F %S/Inputs/Frameworks %s
3// RUN: %clang_cc1 -ast-print %t/ModulesCache/SimpleKit.pcm | FileCheck %s
4// RUN: %clang_cc1 -ast-dump -ast-dump-filter 'DUMP' %t/ModulesCache/SimpleKit.pcm | FileCheck -check-prefix CHECK-DUMP %s
5
6#import <SimpleKit/SimpleKit.h>
7
8// CHECK: __attribute__((cf_returns_not_retained)) void *getCFOwnedToUnowned(void);
9// CHECK: __attribute__((cf_returns_retained)) void *getCFUnownedToOwned(void);
10// CHECK: __attribute__((cf_unknown_transfer)) void *getCFOwnedToNone(void);
11// CHECK: __attribute__((ns_returns_not_retained)) id getObjCOwnedToUnowned(void);
12// CHECK: __attribute__((ns_returns_retained)) id getObjCUnownedToOwned(void);
13// CHECK: int indirectGetCFOwnedToUnowned(__attribute__((cf_returns_not_retained)) void * _Nullable *out);
14// CHECK: int indirectGetCFUnownedToOwned(__attribute__((cf_returns_retained)) void * _Nullable *out);
15// CHECK: int indirectGetCFOwnedToNone(void * _Nullable *out);
16// CHECK: int indirectGetCFNoneToOwned(__attribute__((cf_returns_not_retained)) void **out);
17
18// CHECK-LABEL: @interface MethodTest
19// CHECK: - (id)getOwnedToUnowned __attribute__((ns_returns_not_retained));
20// CHECK: - (id)getUnownedToOwned __attribute__((ns_returns_retained));
21// CHECK: @end
22
23// CHECK-DUMP-LABEL: Dumping getCFAuditedToUnowned_DUMP:
24// CHECK-DUMP-NEXT: FunctionDecl
25// CHECK-DUMP-NEXT: CFReturnsNotRetainedAttr
26// CHECK-DUMP-NEXT: CFAuditedTransferAttr
27// CHECK-DUMP-NOT: Attr
28
29// CHECK-DUMP-LABEL: Dumping getCFAuditedToOwned_DUMP:
30// CHECK-DUMP-NEXT: FunctionDecl
31// CHECK-DUMP-NEXT: CFReturnsRetainedAttr
32// CHECK-DUMP-NEXT: CFAuditedTransferAttr
33// CHECK-DUMP-NOT: Attr
34
35// CHECK-DUMP-LABEL: Dumping getCFAuditedToNone_DUMP:
36// CHECK-DUMP-NEXT: FunctionDecl
37// CHECK-DUMP-NEXT: CFUnknownTransferAttr
38// CHECK-DUMP-NOT: Attr
39