summaryrefslogtreecommitdiff
path: root/clang/test/SemaObjC/property-9.m
diff options
context:
space:
mode:
authorCarlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au>2012-10-15 17:10:06 +1100
committerCarlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au>2012-10-15 17:10:06 +1100
commitbe1de4be954c80875ad4108e0a33e8e131b2f2c0 (patch)
tree1fbbecf276bf7c7bdcbb4dd446099d6d90eaa516 /clang/test/SemaObjC/property-9.m
parentc4626a62754862d20b41e8a46a3574264ea80e6d (diff)
parentf1bd2e48c5324d3f7cda4090c87f8a5b6f463ce2 (diff)
Merge branch 'master' of ssh://bitbucket.org/czan/honours
Diffstat (limited to 'clang/test/SemaObjC/property-9.m')
-rw-r--r--clang/test/SemaObjC/property-9.m108
1 files changed, 108 insertions, 0 deletions
diff --git a/clang/test/SemaObjC/property-9.m b/clang/test/SemaObjC/property-9.m
new file mode 100644
index 0000000..4bed875
--- /dev/null
+++ b/clang/test/SemaObjC/property-9.m
@@ -0,0 +1,108 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
+
+typedef signed char BOOL;
+@protocol NSObject - (BOOL)isEqual:(id)object; @end
+
+@interface NSObject <NSObject> {} @end
+
+@interface _NSServicesInContextMenu : NSObject {
+ id _requestor;
+ NSObject *_appleEventDescriptor;
+}
+
+@property (retain, nonatomic) id requestor;
+@property (retain, nonatomic) id appleEventDescriptor;
+
+@end
+
+@implementation _NSServicesInContextMenu
+
+@synthesize requestor = _requestor, appleEventDescriptor = _appleEventDescriptor;
+
+@end
+
+@class NSString;
+
+@protocol MyProtocol
+- (NSString *)stringValue;
+@end
+
+@interface MyClass : NSObject {
+ id _myIvar;
+}
+@property (readwrite, retain) id<MyProtocol> myIvar;
+@end
+
+@implementation MyClass
+@synthesize myIvar = _myIvar;
+@end
+
+
+@interface BadPropClass
+{
+ int _awesome;
+}
+
+@property (readonly) int; // expected-warning {{declaration does not declare anything}}
+@property (readonly) ; // expected-error {{type name requires a specifier or qualifier}}
+@property (readonly) int : 4; // expected-error {{property requires fields to be named}}
+
+
+// test parser recovery: rdar://6254579
+@property ( // expected-note {{to match this '('}}
+ readonly getter=isAwesome) // expected-error {{expected ')'}}
+
+ int _awesome;
+@property (readonlyx) // expected-error {{unknown property attribute 'readonlyx'}}
+ int _awesome2;
+
+@property ( // expected-note {{to match this '('}}
+ +) // expected-error {{expected ')'}}
+
+ int _awesome3;
+
+@end
+
+@protocol PVImageViewProtocol
+@property int inEyeDropperMode;
+@end
+
+@interface Cls
+@property int inEyeDropperMode;
+@end
+
+@interface PVAdjustColor @end
+
+@implementation PVAdjustColor
+
+- xx {
+ id <PVImageViewProtocol> view;
+ Cls *c;
+
+ c.inEyeDropperMode = 1;
+ view.inEyeDropperMode = 1;
+}
+@end
+
+// radar 7427072
+@interface MyStyleIntf
+{
+ int _myStyle;
+}
+
+@property(readonly) int myStyle;
+
+- (float)setMyStyle:(int)style;
+@end
+
+// rdar://8774513
+@class MDAInstance; // expected-note {{forward declaration of class here}}
+
+@interface MDATestDocument
+@property(retain) MDAInstance *instance;
+@end
+
+id f0(MDATestDocument *d) {
+ return d.instance.path; // expected-error {{property 'path' cannot be found in forward class object 'MDAInstance'}}
+}
+