annotate clang/test/SemaObjC/objcbridgemutable-attribute.m @ 180:680fa57a2f20

fix compile errors.
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sat, 30 May 2020 17:44:06 +0900
parents 1d019706d866
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 // RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
anatofuz
parents:
diff changeset
2 // rdar://15498044
anatofuz
parents:
diff changeset
3
anatofuz
parents:
diff changeset
4 typedef struct __attribute__((objc_bridge_mutable(NSMutableDictionary))) __CFDictionary * CFMutableDictionaryRef; // expected-note {{declared here}}
anatofuz
parents:
diff changeset
5
anatofuz
parents:
diff changeset
6 typedef struct __attribute__((objc_bridge_mutable(12))) __CFDictionaryB1 * CFMutableDictionaryB1Ref; // expected-error {{parameter of 'objc_bridge_mutable' attribute must be a single name of an Objective-C class}}
anatofuz
parents:
diff changeset
7
anatofuz
parents:
diff changeset
8 typedef struct __attribute__((objc_bridge_mutable(P))) __CFDictionaryB2 * CFMutableDictionaryB2Ref; // expected-note {{declared here}}
anatofuz
parents:
diff changeset
9
anatofuz
parents:
diff changeset
10 typedef struct __attribute__((objc_bridge_mutable(NSMutableDictionary, Unknown))) __CFDictionaryB3 * CFMutableDictionaryB3Ref; // expected-error {{use of undeclared identifier 'Unknown'}}
anatofuz
parents:
diff changeset
11
anatofuz
parents:
diff changeset
12 typedef struct __attribute__((objc_bridge_mutable)) __CFDictionaryB4 * CFMutableDictionaryB4Ref; // expected-error {{'objc_bridge_mutable' attribute takes one argument}}
anatofuz
parents:
diff changeset
13
anatofuz
parents:
diff changeset
14 @interface NSDictionary
anatofuz
parents:
diff changeset
15 @end
anatofuz
parents:
diff changeset
16
anatofuz
parents:
diff changeset
17 @interface NSMutableDictionary : NSDictionary
anatofuz
parents:
diff changeset
18 @end
anatofuz
parents:
diff changeset
19
anatofuz
parents:
diff changeset
20 @protocol P @end
anatofuz
parents:
diff changeset
21
anatofuz
parents:
diff changeset
22 void Test(NSMutableDictionary *md, NSDictionary *nd, CFMutableDictionaryRef mcf, CFMutableDictionaryB2Ref bmcf) {
anatofuz
parents:
diff changeset
23
anatofuz
parents:
diff changeset
24 (void) (CFMutableDictionaryRef)md;
anatofuz
parents:
diff changeset
25 (void) (CFMutableDictionaryRef)nd; // expected-warning {{'NSDictionary' cannot bridge to 'CFMutableDictionaryRef' (aka 'struct __CFDictionary *')}}
anatofuz
parents:
diff changeset
26 (void) (NSDictionary *)mcf; // ok, bridgt_type NSMutableDictionary can be type-cast to its super class.
anatofuz
parents:
diff changeset
27 NSDictionary *nsdobj = (NSMutableDictionary*)0;
anatofuz
parents:
diff changeset
28 (void) (NSMutableDictionary *)mcf; // ok;
anatofuz
parents:
diff changeset
29 (void) (NSMutableDictionary *)bmcf; // expected-error {{CF object of type 'CFMutableDictionaryB2Ref' (aka 'struct __CFDictionaryB2 *') is bridged to 'P', which is not an Objective-C class}}
anatofuz
parents:
diff changeset
30
anatofuz
parents:
diff changeset
31 }
anatofuz
parents:
diff changeset
32