comparison clang/test/SemaObjC/attr-swift_bridge.m @ 207:2e18cbf3894f

LLVM12
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 08 Jun 2021 06:07:14 +0900 (2021-06-07)
parents
children
comparison
equal deleted inserted replaced
173:0572611fdcc8 207:2e18cbf3894f
1 // RUN: %clang_cc1 -verify -fsyntax-only %s
2
3 // expected-error@+1 {{'__swift_bridge__' attribute takes one argument}}
4 __attribute__((__swift_bridge__))
5 @interface I
6 @end
7
8 // expected-error@+1 {{'__swift_bridge__' attribute requires a string}}
9 __attribute__((__swift_bridge__(1)))
10 @interface J
11 @end
12
13 // expected-error@+1 {{'__swift_bridge__' attribute takes one argument}}
14 __attribute__((__swift_bridge__("K", 1)))
15 @interface K
16 @end
17
18 @interface L
19 // expected-error@+1 {{'__swift_bridge__' attribute only applies to tag types, typedefs, Objective-C interfaces, and Objective-C protocols}}
20 - (void)method __attribute__((__swift_bridge__("method")));
21 @end
22
23 __attribute__((__swift_bridge__("Array")))
24 @interface NSArray
25 @end
26
27 __attribute__((__swift_bridge__("ProtocolP")))
28 @protocol P
29 @end
30
31 typedef NSArray *NSArrayAlias __attribute__((__swift_bridge__("ArrayAlias")));
32
33 struct __attribute__((__swift_bridge__("StructT"))) T {};
34
35 // Duplicate attributes with the same arguments are fine.
36 struct __attribute__((swift_bridge("foo"), swift_bridge("foo"))) S;
37 // Duplicate attributes with different arguments are not.
38 struct __attribute__((swift_bridge("foo"), swift_bridge("bar"))) S; // expected-warning {{attribute 'swift_bridge' is already applied with different arguments}}