diff options
author | Carlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au> | 2012-10-15 17:10:06 +1100 |
---|---|---|
committer | Carlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au> | 2012-10-15 17:10:06 +1100 |
commit | be1de4be954c80875ad4108e0a33e8e131b2f2c0 (patch) | |
tree | 1fbbecf276bf7c7bdcbb4dd446099d6d90eaa516 /clang/test/SemaObjC/default-synthesize-3.m | |
parent | c4626a62754862d20b41e8a46a3574264ea80e6d (diff) | |
parent | f1bd2e48c5324d3f7cda4090c87f8a5b6f463ce2 (diff) |
Merge branch 'master' of ssh://bitbucket.org/czan/honours
Diffstat (limited to 'clang/test/SemaObjC/default-synthesize-3.m')
-rw-r--r-- | clang/test/SemaObjC/default-synthesize-3.m | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/clang/test/SemaObjC/default-synthesize-3.m b/clang/test/SemaObjC/default-synthesize-3.m new file mode 100644 index 0000000..606ece3 --- /dev/null +++ b/clang/test/SemaObjC/default-synthesize-3.m @@ -0,0 +1,41 @@ +// RUN: %clang_cc1 -x objective-c -fsyntax-only -fobjc-default-synthesize-properties -verify -Wno-objc-root-class %s +// RUN: %clang_cc1 -x objective-c++ -fsyntax-only -fobjc-default-synthesize-properties -verify -Wno-objc-root-class %s + +#if __has_attribute(objc_requires_property_definitions) +__attribute ((objc_requires_property_definitions)) +#endif +@interface NoAuto // expected-note 2 {{class with specified objc_requires_property_definitions attribute is declared here}} +@property int NoAutoProp; // expected-note 2 {{property declared here}} +@end + +@implementation NoAuto // expected-warning {{property 'NoAutoProp' requires method 'NoAutoProp' to be defined}} \ + // expected-warning {{property 'NoAutoProp' requires method 'setNoAutoProp:'}} +@end + +__attribute ((objc_requires_property_definitions)) // redundant, just for testing +@interface Sub : NoAuto // expected-note 3 {{class with specified objc_requires_property_definitions attribute is declared here}} +@property (copy) id SubProperty; // expected-note 2 {{property declared here}} +@end + +@implementation Sub // expected-warning {{property 'SubProperty' requires method 'SubProperty' to be defined}} \ + // expected-warning {{property 'SubProperty' requires method 'setSubProperty:' to be defined}} +@end + +@interface Deep : Sub +@property (copy) id DeepProperty; +@property (copy) id DeepSynthProperty; +@property (copy) id DeepMustSynthProperty; // expected-note {{property declared here}} +@end + +@implementation Deep // expected-warning {{property 'DeepMustSynthProperty' requires method 'setDeepMustSynthProperty:' to be defined}} +@dynamic DeepProperty; +@synthesize DeepSynthProperty; +- (id) DeepMustSynthProperty { return 0; } +@end + +__attribute ((objc_requires_property_definitions)) +@interface Deep(CAT) // expected-error {{attributes may not be specified on a category}} +@end + +__attribute ((objc_requires_property_definitions)) // expected-error {{objc_requires_property_definitions attribute may only be specified on a class}} +@protocol P @end |