Debian Codegraph @

clang/test/FixIt/fixit-objc-bridge-related-attr.m

raw
1 // Objective-C recovery
2 // RUN: not %clang_cc1 -triple x86_64-apple-darwin10 -fdiagnostics-parseable-fixits -x objective-c %s 2>&1 | FileCheck %s
3 // RUN: not %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-arc -fdiagnostics-parseable-fixits -x objective-c %s 2>&1 | FileCheck %s
4 // RUN: not %clang_cc1 -triple x86_64-apple-darwin10 -fdiagnostics-parseable-fixits -x objective-c++ %s 2>&1 | FileCheck %s
5
6 typedef struct __attribute__((objc_bridge_related(NSColor,colorWithCGColor:,CGColor))) CGColor *CGColorRef;
7
8 @interface NSColor
9 + (NSColor *)colorWithCGColor:(CGColorRef)cgColor;
10 - (CGColorRef)CGColor;
11 @end
12
13 @interface NSTextField
14 - (void)setBackgroundColor:(NSColor *)color;
15 - (NSColor *)backgroundColor;
16 @end
17
18 NSColor * Test1(NSTextField *textField, CGColorRef newColor) {
19 textField.backgroundColor = newColor;
20 return newColor;
21 }
22
23 CGColorRef Test2(NSTextField *textField, CGColorRef newColor) {
24 newColor = textField.backgroundColor; // [textField.backgroundColor CGColor]
25 return textField.backgroundColor;
26 }
27 // CHECK: {19:30-19:30}:"[NSColor colorWithCGColor:"
28 // CHECK: {19:38-19:38}:"]"
29 // CHECK: {20:9-20:9}:"[NSColor colorWithCGColor:"
30 // CHECK: {20:17-20:17}:"]"
31 // CHECK: {24:13-24:13}:"["
32 // CHECK: {24:38-24:38}:" CGColor]"
33 // CHECK: {25:9-25:9}:"["
34 // CHECK: {25:34-25:34}:" CGColor]"