Debian Codegraph @

clang/test/AST/attr-swift_attr.m

raw
1 // RUN: %clang_cc1 -fblocks -ast-dump %s | FileCheck %s
2
3 __attribute__((swift_attr("@actor")))
4 @interface View
5 @end
6
7 // CHECK-LABEL: InterfaceDecl {{.*}} View
8 // CHECK-NEXT: SwiftAttrAttr {{.*}} "@actor"
9
10 #pragma clang attribute push(__attribute__((swift_attr("@sendable"))), apply_to=objc_interface)
11 @interface Contact
12 @end
13 #pragma clang attribute pop
14
15 // CHECK-LABEL: InterfaceDecl {{.*}} Contact
16 // CHECK-NEXT: SwiftAttrAttr {{.*}} "@sendable"
17
18 #define SWIFT_SENDABLE __attribute__((swift_attr("@Sendable")))
19
20 @interface InTypeContext
21 - (nullable id)test:(nullable SWIFT_SENDABLE id)obj SWIFT_SENDABLE;
22 @end
23
24 // CHECK-LABEL: InterfaceDecl {{.*}} InTypeContext
25 // CHECK-NEXT: MethodDecl {{.*}} - test: 'id _Nullable':'id'
26 // CHECK-NEXT: ParmVarDecl {{.*}} obj 'SWIFT_SENDABLE id _Nullable':'id'
27 // CHECK-NEXT: SwiftAttrAttr {{.*}} "@Sendable"
28
29 @interface Generic<T: SWIFT_SENDABLE id>
30 @end
31
32 // CHECK-LABEL: InterfaceDecl {{.*}} Generic
33 // CHECK-NEXT: TypeParamDecl {{.*}} T bounded 'SWIFT_SENDABLE id':'id'
34
35 typedef SWIFT_SENDABLE Generic<id> Alias;
36
37 // CHECK-LABEL: TypedefDecl {{.*}} Alias 'Generic<id>'
38 // CHECK-NEXT: ObjectType {{.*}} 'Generic<id>'
39 // CHECK-NEXT: SwiftAttrAttr {{.*}} "@Sendable"
40
41 SWIFT_SENDABLE
42 typedef struct {
43 void *ptr;
44 } SendableStruct;
45
46 // CHECK-LABEL: TypedefDecl {{.*}} SendableStruct 'struct SendableStruct'
47 // CHECK: SwiftAttrAttr {{.*}} "@Sendable"
48
49 @interface TestAttrPlacementInBlock1
50 -(void) withHandler: (void (SWIFT_SENDABLE ^)(id)) handler;
51 @end
52
53 // CHECK-LABEL: ObjCInterfaceDecl {{.*}} TestAttrPlacementInBlock1
54 // CHECK: handler 'SWIFT_SENDABLE void (^)(id)':'void (^)(id)'
55
56 @interface TestAttrPlacementInBlock2
57 -(void) withHandler: (void (^ SWIFT_SENDABLE)(id)) handler;
58 @end
59
60 // CHECK-LABEL: ObjCInterfaceDecl {{.*}} TestAttrPlacementInBlock2
61 // CHECK: handler 'SWIFT_SENDABLE void (^)(id)':'void (^)(id)'