xref: /minix3/external/bsd/llvm/dist/clang/test/FixIt/fixit-objc-bridge-related-attr.m (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc// Objective-C recovery
2*0a6a1f1dSLionel Sambuc// RUN: not %clang_cc1  -triple x86_64-apple-darwin10  -fdiagnostics-parseable-fixits -x objective-c %s 2>&1  | FileCheck %s
3*0a6a1f1dSLionel Sambuc// RUN: not %clang_cc1  -triple x86_64-apple-darwin10  -fobjc-arc -fdiagnostics-parseable-fixits -x objective-c %s 2>&1  | FileCheck %s
4*0a6a1f1dSLionel Sambuc// RUN: not %clang_cc1  -triple x86_64-apple-darwin10  -fdiagnostics-parseable-fixits -x objective-c++ %s 2>&1  | FileCheck %s
5*0a6a1f1dSLionel Sambuc// rdar://15499111
6*0a6a1f1dSLionel Sambuc
7*0a6a1f1dSLionel Sambuctypedef struct __attribute__((objc_bridge_related(NSColor,colorWithCGColor:,CGColor))) CGColor *CGColorRef;
8*0a6a1f1dSLionel Sambuc
9*0a6a1f1dSLionel Sambuc@interface NSColor
10*0a6a1f1dSLionel Sambuc+ (NSColor *)colorWithCGColor:(CGColorRef)cgColor;
11*0a6a1f1dSLionel Sambuc- (CGColorRef)CGColor;
12*0a6a1f1dSLionel Sambuc@end
13*0a6a1f1dSLionel Sambuc
14*0a6a1f1dSLionel Sambuc@interface NSTextField
15*0a6a1f1dSLionel Sambuc- (void)setBackgroundColor:(NSColor *)color;
16*0a6a1f1dSLionel Sambuc- (NSColor *)backgroundColor;
17*0a6a1f1dSLionel Sambuc@end
18*0a6a1f1dSLionel Sambuc
19*0a6a1f1dSLionel SambucNSColor * Test1(NSTextField *textField, CGColorRef newColor) {
20*0a6a1f1dSLionel Sambuc textField.backgroundColor = newColor;
21*0a6a1f1dSLionel Sambuc return newColor;
22*0a6a1f1dSLionel Sambuc}
23*0a6a1f1dSLionel Sambuc
24*0a6a1f1dSLionel SambucCGColorRef Test2(NSTextField *textField, CGColorRef newColor) {
25*0a6a1f1dSLionel Sambuc newColor = textField.backgroundColor; // [textField.backgroundColor CGColor]
26*0a6a1f1dSLionel Sambuc return textField.backgroundColor;
27*0a6a1f1dSLionel Sambuc}
28*0a6a1f1dSLionel Sambuc// CHECK: {20:30-20:30}:"[NSColor colorWithCGColor:"
29*0a6a1f1dSLionel Sambuc// CHECK: {20:38-20:38}:"]"
30*0a6a1f1dSLionel Sambuc// CHECK: {21:9-21:9}:"[NSColor colorWithCGColor:"
31*0a6a1f1dSLionel Sambuc// CHECK: {21:17-21:17}:"]"
32*0a6a1f1dSLionel Sambuc// CHECK: {25:13-25:13}:"["
33*0a6a1f1dSLionel Sambuc// CHECK: {25:38-25:38}:" CGColor]"
34*0a6a1f1dSLionel Sambuc// CHECK: {26:9-26:9}:"["
35*0a6a1f1dSLionel Sambuc// CHECK: {26:34-26:34}:" CGColor]"
36