xref: /minix3/external/bsd/llvm/dist/clang/test/SemaObjC/arc-invalid.m (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -fblocks -Wno-objc-root-class -verify %s
2f4a2713aSLionel Sambuc
3f4a2713aSLionel Sambuc// rdar://problem/10982793
4f4a2713aSLionel Sambuc// [p foo] in ARC creates a cleanup.
5f4a2713aSLionel Sambuc// The plus is invalid and causes the cleanup to go unbound.
6f4a2713aSLionel Sambuc// Don't crash.
7f4a2713aSLionel Sambuc@interface A
8f4a2713aSLionel Sambuc- (id) foo;
9f4a2713aSLionel Sambuc@end
10f4a2713aSLionel Sambucvoid takeBlock(void (^)(void));
11f4a2713aSLionel Sambucvoid test0(id p) {
12f4a2713aSLionel Sambuc  takeBlock(^{ [p foo] + p; }); // expected-error {{invalid operands to binary expression}}
13f4a2713aSLionel Sambuc}
14f4a2713aSLionel Sambuc
15f4a2713aSLionel Sambucvoid test1(void) {
16f4a2713aSLionel Sambuc  __autoreleasing id p; // expected-note {{'p' declared here}}
17f4a2713aSLionel Sambuc  takeBlock(^{ (void) p; }); // expected-error {{cannot capture __autoreleasing variable in a block}}
18f4a2713aSLionel Sambuc}
19*0a6a1f1dSLionel Sambuc
20*0a6a1f1dSLionel Sambuc// rdar://17024681
21*0a6a1f1dSLionel Sambuc@class WebFrame;
22*0a6a1f1dSLionel Sambuc@interface WebView  // expected-note {{previous definition is here}}
23*0a6a1f1dSLionel Sambuc- (WebFrame *)mainFrame;
24*0a6a1f1dSLionel Sambuc@end
25*0a6a1f1dSLionel Sambuc
26*0a6a1f1dSLionel Sambuc@interface WebView  // expected-error {{duplicate interface definition for class 'WebView'}}
27*0a6a1f1dSLionel Sambuc@property (nonatomic, readonly, strong) WebFrame *mainFrame;
28*0a6a1f1dSLionel Sambuc@end
29*0a6a1f1dSLionel Sambuc
30*0a6a1f1dSLionel Sambuc@interface UIWebDocumentView
31*0a6a1f1dSLionel Sambuc- (WebView *)webView;
32*0a6a1f1dSLionel Sambuc@end
33*0a6a1f1dSLionel Sambuc
34*0a6a1f1dSLionel Sambuc@interface UIWebBrowserView : UIWebDocumentView
35*0a6a1f1dSLionel Sambuc@end
36*0a6a1f1dSLionel Sambuc
37*0a6a1f1dSLionel Sambuc@interface StoreBanner @end
38*0a6a1f1dSLionel Sambuc
39*0a6a1f1dSLionel Sambuc@implementation StoreBanner
40*0a6a1f1dSLionel Sambuc+ (void)readMetaTagContentForUIWebBrowserView:(UIWebBrowserView *)browserView
41*0a6a1f1dSLionel Sambuc{
42*0a6a1f1dSLionel Sambuc  [[browserView webView] mainFrame];
43*0a6a1f1dSLionel Sambuc}
44*0a6a1f1dSLionel Sambuc@end
45