annotate clang/test/SemaObjC/check-objcbridge-related-attribute-lookup.m @ 266:00f31e85ec16 default tip

Added tag current for changeset 31d058e83c98
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sat, 14 Oct 2023 10:13:55 +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 -x objective-c -verify -Wno-objc-root-class %s
anatofuz
parents:
diff changeset
2 // rdar://15499111
anatofuz
parents:
diff changeset
3
anatofuz
parents:
diff changeset
4 typedef struct __attribute__((objc_bridge_related(NSColor,colorXWithCGColor:,CXGColor))) CGColor *CGColorRef; // expected-note 2 {{declared here}}
anatofuz
parents:
diff changeset
5
anatofuz
parents:
diff changeset
6 typedef struct __attribute__((objc_bridge_related(XNSColor,colorWithCGColor:,CGColor))) CGColor1 *CGColorRef1; // expected-note 2 {{declared here}}
anatofuz
parents:
diff changeset
7
anatofuz
parents:
diff changeset
8 typedef struct __attribute__((objc_bridge_related(PNsColor,colorWithCGColor:,CGColor))) CGColor2 *CGColorRef2; // expected-note 2 {{declared here}}
anatofuz
parents:
diff changeset
9
anatofuz
parents:
diff changeset
10 @interface NSColor
anatofuz
parents:
diff changeset
11 + (NSColor *)colorWithCGColor:(CGColorRef)cgColor;
anatofuz
parents:
diff changeset
12 - (CGColorRef)CGColor;
anatofuz
parents:
diff changeset
13 @end
anatofuz
parents:
diff changeset
14
anatofuz
parents:
diff changeset
15 @interface NSTextField
anatofuz
parents:
diff changeset
16 - (void)setBackgroundColor:(NSColor *)color;
anatofuz
parents:
diff changeset
17 - (NSColor *)backgroundColor;
anatofuz
parents:
diff changeset
18 @end
anatofuz
parents:
diff changeset
19
anatofuz
parents:
diff changeset
20 typedef int PNsColor; // expected-note 2 {{declared here}}
anatofuz
parents:
diff changeset
21
anatofuz
parents:
diff changeset
22 NSColor * Test1(NSTextField *textField, CGColorRef newColor) {
anatofuz
parents:
diff changeset
23 textField.backgroundColor = newColor; // expected-error {{'CGColorRef' (aka 'struct CGColor *') must be explicitly converted to 'NSColor *'; use '+colorXWithCGColor:' method for this conversion}} \
anatofuz
parents:
diff changeset
24 // expected-warning {{incompatible pointer types assigning to 'NSColor *' from 'CGColorRef' (aka 'struct CGColor *')}}
anatofuz
parents:
diff changeset
25 newColor = textField.backgroundColor; // expected-error {{'NSColor *' must be explicitly converted to 'CGColorRef' (aka 'struct CGColor *'); use '-CXGColor' method for this conversion}} \
anatofuz
parents:
diff changeset
26 // expected-warning {{incompatible pointer types assigning to 'CGColorRef' (aka 'struct CGColor *') from 'NSColor *'}}
anatofuz
parents:
diff changeset
27 }
anatofuz
parents:
diff changeset
28 NSColor * Test2(NSTextField *textField, CGColorRef1 newColor) {
anatofuz
parents:
diff changeset
29 textField.backgroundColor = newColor; // expected-error {{could not find Objective-C class 'XNSColor' to convert 'CGColorRef1' (aka 'struct CGColor1 *') to 'NSColor *'}} \
anatofuz
parents:
diff changeset
30 // expected-warning {{incompatible pointer types assigning to 'NSColor *' from 'CGColorRef1' (aka 'struct CGColor1 *')}}
anatofuz
parents:
diff changeset
31 newColor = textField.backgroundColor ; // expected-error {{could not find Objective-C class 'XNSColor' to convert 'NSColor *' to 'CGColorRef1' (aka 'struct CGColor1 *')}} \
anatofuz
parents:
diff changeset
32 // expected-warning {{incompatible pointer types assigning to 'CGColorRef1' (aka 'struct CGColor1 *') from 'NSColor *'}}
anatofuz
parents:
diff changeset
33 }
anatofuz
parents:
diff changeset
34
anatofuz
parents:
diff changeset
35 NSColor * Test3(NSTextField *textField, CGColorRef2 newColor) {
anatofuz
parents:
diff changeset
36 textField.backgroundColor = newColor; // expected-error {{'PNsColor' must be name of an Objective-C class to be able to convert 'CGColorRef2' (aka 'struct CGColor2 *') to 'NSColor *'}} \
anatofuz
parents:
diff changeset
37 // expected-warning {{incompatible pointer types assigning to 'NSColor *' from 'CGColorRef2' (aka 'struct CGColor2 *')}}
anatofuz
parents:
diff changeset
38 newColor = textField.backgroundColor; // expected-error {{'PNsColor' must be name of an Objective-C class to be able to convert 'NSColor *' to 'CGColorRef2' (aka 'struct CGColor2 *')}} \
anatofuz
parents:
diff changeset
39 // expected-warning {{incompatible pointer types assigning to 'CGColorRef2' (aka 'struct CGColor2 *') from 'NSColor *'}}
anatofuz
parents:
diff changeset
40 }
anatofuz
parents:
diff changeset
41