Skip to content

Commit 3d14f91

Browse files
authored
Merge pull request #3562 from beccadax/send-me-an-object-1026
[20211026] Allow __attribute__((swift_attr)) in attribute push pragmas
2 parents 4577887 + 3f4c891 commit 3d14f91

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

clang/include/clang/Basic/Attr.td

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2357,6 +2357,7 @@ def SwiftAttr : InheritableAttr {
23572357
let Spellings = [GNU<"swift_attr">];
23582358
let Args = [StringArgument<"Attribute">];
23592359
let Documentation = [SwiftAttrDocs];
2360+
let PragmaAttributeSupport = 1;
23602361
}
23612362

23622363
def SwiftBridge : InheritableAttr {

clang/test/AST/attr-swift_attr.m

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
1-
// RUN: %clang_cc1 -fsyntax-only -ast-dump %s | FileCheck %s
1+
// RUN: not %clang_cc1 -fsyntax-only -ast-dump %s | FileCheck %s
22

33
__attribute__((swift_attr("@actor")))
44
@interface View
55
@end
66

7-
// CHECK: InterfaceDecl {{.*}} View
7+
// CHECK-LABEL: InterfaceDecl {{.*}} View
88
// 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"

clang/test/Misc/pragma-attribute-supported-attributes-list.test

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@
164164
// CHECK-NEXT: SwiftAsyncContext (SubjectMatchRule_variable_is_parameter)
165165
// CHECK-NEXT: SwiftAsyncError (SubjectMatchRule_function, SubjectMatchRule_objc_method)
166166
// CHECK-NEXT: SwiftAsyncName (SubjectMatchRule_objc_method, SubjectMatchRule_function)
167+
// CHECK-NEXT: SwiftAttr ()
167168
// CHECK-NEXT: SwiftBridgedTypedef (SubjectMatchRule_type_alias)
168169
// CHECK-NEXT: SwiftContext (SubjectMatchRule_variable_is_parameter)
169170
// CHECK-NEXT: SwiftError (SubjectMatchRule_function, SubjectMatchRule_objc_method)

0 commit comments

Comments
 (0)