diff options
| author | Anna Zaks <ganna@apple.com> | 2013-01-16 01:36:00 +0000 |
|---|---|---|
| committer | Anna Zaks <ganna@apple.com> | 2013-01-16 01:36:00 +0000 |
| commit | 6519564c97d5fe113c3e6ecd2d8d2acc35fe51aa (patch) | |
| tree | e454d1d11a13013d839bd0e7a2109a3c2a49955b /clang/test/Analysis/objc | |
| parent | 8a023580c7baa28a692819c3ec9b445aad971fa0 (diff) | |
| download | bcm5719-llvm-6519564c97d5fe113c3e6ecd2d8d2acc35fe51aa.tar.gz bcm5719-llvm-6519564c97d5fe113c3e6ecd2d8d2acc35fe51aa.zip | |
[analyzer] Add an annotation to allow suppression of direct ivar
assignment
llvm-svn: 172597
Diffstat (limited to 'clang/test/Analysis/objc')
| -rw-r--r-- | clang/test/Analysis/objc/direct-ivar-assignment-in-annotated-functions.m | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/clang/test/Analysis/objc/direct-ivar-assignment-in-annotated-functions.m b/clang/test/Analysis/objc/direct-ivar-assignment-in-annotated-functions.m index cd425f3be0c..300f9775bfb 100644 --- a/clang/test/Analysis/objc/direct-ivar-assignment-in-annotated-functions.m +++ b/clang/test/Analysis/objc/direct-ivar-assignment-in-annotated-functions.m @@ -13,14 +13,14 @@ typedef signed char BOOL; @interface MyClass; @end -@interface AnnotatedClass :NSObject { +@interface AnnotatedClass : NSObject { } - (void) someMethod: (MyClass*)In __attribute__((annotate("objc_no_direct_instance_variable_assignment"))); - (void) someMethodNotAnnaotated: (MyClass*)In; @end -@interface TestProperty :AnnotatedClass { +@interface TestProperty : AnnotatedClass { MyClass *_Z; id _nonSynth; } @@ -33,6 +33,9 @@ typedef signed char BOOL; @property (assign, nonatomic) MyClass* Z; // non synthesized ivar, implemented setter @property (readonly) id nonSynth; // non synthesized, explicitly implemented to return ivar with expected name + + @property (assign) MyClass* NotX __attribute__((annotate("objc_allow_direct_instance_variable_assignment"))); // warnings should be suppressed + @end @implementation TestProperty @@ -44,6 +47,7 @@ typedef signed char BOOL; _Y = In; // expected-warning {{Direct assignment to an instance variable backing a property; use the setter instead}} _Z = In; // expected-warning {{Direct assignment to an instance variable backing a property; use the setter instead}} _nonSynth = 0; // expected-warning {{Direct assignment to an instance variable backing a property; use the setter instead}} + _NotX = 0; // no-warning } - (void) someMethodNotAnnaotated: (MyClass*)In { (__A) = In; |

