summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaObjC
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2013-02-14 19:07:19 +0000
committerFariborz Jahanian <fjahanian@apple.com>2013-02-14 19:07:19 +0000
commita934a022af67bf1ed04db7b7d4f2eb1842bf94e4 (patch)
treed4bdf02061433d47dcc89d1775ec7458152879ae /clang/test/SemaObjC
parentba4a6d10e0d6cf703d4beedc57bdb5e30abf0181 (diff)
downloadbcm5719-llvm-a934a022af67bf1ed04db7b7d4f2eb1842bf94e4.tar.gz
bcm5719-llvm-a934a022af67bf1ed04db7b7d4f2eb1842bf94e4.zip
objective-C: When implementing custom accessor method for
a property, the -Wdirect-ivar-access should not warn when accessing the property's synthesized instance variable. // rdar://13142820 llvm-svn: 175195
Diffstat (limited to 'clang/test/SemaObjC')
-rw-r--r--clang/test/SemaObjC/warn-direct-ivar-access.m24
1 files changed, 23 insertions, 1 deletions
diff --git a/clang/test/SemaObjC/warn-direct-ivar-access.m b/clang/test/SemaObjC/warn-direct-ivar-access.m
index 4f242e6b338..283a00faee8 100644
--- a/clang/test/SemaObjC/warn-direct-ivar-access.m
+++ b/clang/test/SemaObjC/warn-direct-ivar-access.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -fobjc-runtime-has-weak -Wdirect-ivar-access -verify -Wno-objc-root-class %s
+// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -fobjc-runtime-has-weak -fobjc-default-synthesize-properties -Wdirect-ivar-access -verify -Wno-objc-root-class %s
// rdar://6505197
__attribute__((objc_root_class)) @interface MyObject {
@@ -54,3 +54,25 @@ id Test32(__weak ITest32 *x) {
: (*x).ivar; // expected-error {{dereferencing a __weak pointer is not allowed}}
}
+// rdar://13142820
+@protocol PROTOCOL
+@property (copy, nonatomic) id property_in_protocol;
+@end
+
+__attribute__((objc_root_class)) @interface INTF <PROTOCOL>
+@property (copy, nonatomic) id foo;
+- (id) foo;
+@end
+
+@interface INTF()
+@property (copy, nonatomic) id foo1;
+- (id) foo1;
+@end
+
+@implementation INTF
+- (id) foo { return _foo; }
+- (id) property_in_protocol { return _property_in_protocol; } // expected-warning {{instance variable '_property_in_protocol' is being directly accessed}}
+- (id) foo1 { return _foo1; }
+@synthesize property_in_protocol = _property_in_protocol;
+@end
+
OpenPOWER on IntegriCloud