Skip to content

Commit 27222cd

Browse files
authored
Merge pull request #3547 from beccadax/send-me-an-object-stable
[20210726] Allow __attribute__((swift_attr)) in attribute push pragmas
2 parents 88c7ab5 + 5d5d035 commit 27222cd

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
@@ -2347,6 +2347,7 @@ def SwiftAttr : InheritableAttr {
23472347
let Spellings = [GNU<"swift_attr">];
23482348
let Args = [StringArgument<"Attribute">];
23492349
let Documentation = [SwiftAttrDocs];
2350+
let PragmaAttributeSupport = 1;
23502351
}
23512352

23522353
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
@@ -161,6 +161,7 @@
161161
// CHECK-NEXT: SwiftAsyncContext (SubjectMatchRule_variable_is_parameter)
162162
// CHECK-NEXT: SwiftAsyncError (SubjectMatchRule_function, SubjectMatchRule_objc_method)
163163
// CHECK-NEXT: SwiftAsyncName (SubjectMatchRule_objc_method, SubjectMatchRule_function)
164+
// CHECK-NEXT: SwiftAttr ()
164165
// CHECK-NEXT: SwiftBridgedTypedef (SubjectMatchRule_type_alias)
165166
// CHECK-NEXT: SwiftContext (SubjectMatchRule_variable_is_parameter)
166167
// CHECK-NEXT: SwiftError (SubjectMatchRule_function, SubjectMatchRule_objc_method)

0 commit comments

Comments
 (0)