diff options
Diffstat (limited to 'test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret-region.m')
| -rw-r--r-- | test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret-region.m | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret-region.m b/test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret-region.m index e2ad1176e33f..c1cc076a9362 100644 --- a/test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret-region.m +++ b/test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret-region.m @@ -1,38 +1,32 @@ -// RUN: %clang_cc1 -triple i386-apple-darwin8 -analyze -analyzer-checker=core,experimental.core -analyzer-constraints=range -analyzer-store=region -verify %s +// RUN: %clang_cc1 -triple i386-apple-darwin8 -analyze -analyzer-checker=core,experimental.core -analyzer-constraints=range -analyzer-store=region -verify -Wno-objc-root-class %s // <rdar://problem/6888289> - This test case shows that a nil instance // variable can possibly be initialized by a method. -typedef struct RDar6888289_data { - long data[100]; -} RDar6888289_data; - @interface RDar6888289 { - RDar6888289 *x; + id *x; } -- (RDar6888289_data) test; -- (RDar6888289_data) test2; +- (void) test:(id) y; +- (void) test2:(id) y; - (void) invalidate; -- (RDar6888289_data) getData; @end +id *getVal(void); + @implementation RDar6888289 -- (RDar6888289_data) test { +- (void) test:(id)y { if (!x) [self invalidate]; - return [x getData]; + *x = y; } -- (RDar6888289_data) test2 { +- (void) test2:(id)y { if (!x) {} - return [x getData]; // expected-warning{{The receiver of message 'getData' is nil and returns a value of type 'RDar6888289_data' that will be garbage}} + *x = y; // expected-warning {{null}} } - (void) invalidate { - x = self; + x = getVal(); } -- (RDar6888289_data) getData { - return (RDar6888289_data) { 0 }; -} @end |
