• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
2
3typedef signed char BOOL;
4@protocol NSObject  - (BOOL)isEqual:(id)object; @end
5
6@interface NSObject <NSObject> {} @end
7
8@interface _NSServicesInContextMenu : NSObject {
9    id _requestor;
10    NSObject *_appleEventDescriptor;
11}
12
13@property (retain, nonatomic) id requestor;
14@property (retain, nonatomic) id appleEventDescriptor;
15
16@end
17
18@implementation _NSServicesInContextMenu
19
20@synthesize requestor = _requestor, appleEventDescriptor = _appleEventDescriptor;
21
22@end
23
24@class NSString;
25
26@protocol MyProtocol
27- (NSString *)stringValue;
28@end
29
30@interface MyClass : NSObject {
31  id  _myIvar;
32}
33@property (readwrite, retain) id<MyProtocol> myIvar;
34@end
35
36@implementation MyClass
37@synthesize myIvar = _myIvar;
38@end
39
40
41@interface BadPropClass
42{
43 int _awesome;
44}
45
46@property (readonly) int; // expected-warning {{declaration does not declare anything}}
47@property (readonly) ; // expected-error {{type name requires a specifier or qualifier}}
48@property (readonly) int : 4; // expected-error {{property requires fields to be named}}
49
50
51// test parser recovery: rdar://6254579
52@property (                           // expected-note {{to match this '('}}
53           readonly getter=isAwesome) // expected-error {{expected ')'}}
54
55  int _awesome;
56@property (readonlyx) // expected-error {{unknown property attribute 'readonlyx'}}
57  int _awesome2;
58
59@property (    // expected-note {{to match this '('}}
60           +)  // expected-error {{expected ')'}}
61
62  int _awesome3;
63
64@end
65
66@protocol PVImageViewProtocol
67@property int inEyeDropperMode;
68@end
69
70@interface Cls
71@property int inEyeDropperMode;
72@end
73
74@interface PVAdjustColor @end
75
76@implementation PVAdjustColor
77
78- xx {
79  id <PVImageViewProtocol> view;
80  Cls *c;
81
82  c.inEyeDropperMode = 1;
83  view.inEyeDropperMode = 1;
84}
85@end
86
87// radar 7427072
88@interface MyStyleIntf
89{
90    int _myStyle;
91}
92
93@property(readonly) int myStyle;
94
95- (float)setMyStyle:(int)style;
96@end
97
98// rdar://8774513
99@class MDAInstance; // expected-note {{forward declaration of class here}}
100
101@interface MDATestDocument
102@property(retain) MDAInstance *instance;
103@end
104
105id f0(MDATestDocument *d) {
106  return d.instance.path; // expected-error {{property 'path' cannot be found in forward class object 'MDAInstance'}}
107}
108
109// rdar://20469452
110@interface UIView @end
111
112@interface FRFakeBannerView : UIView
113@end
114
115@interface FRAdCollectionViewCell
116@property (nonatomic, weak, readonly) UIView *bannerView;
117@end
118
119@interface FRAdCollectionViewCell ()
120
121@property (nonatomic, weak, readwrite) FRFakeBannerView *bannerView;
122
123@end
124