diff --git a/clang/test/Analysis/misc-ps.m b/clang/test/Analysis/misc-ps.m index d7c3db7439d3..f05ec9564372 100644 --- a/clang/test/Analysis/misc-ps.m +++ b/clang/test/Analysis/misc-ps.m @@ -610,3 +610,25 @@ void test_offsetof_4() { *p = 0xDEADBEEF; // expected-warning{{Dereference of null pointer}} } +// "nil receiver" false positive: make tracking +// of the MemRegion for 'self' path-sensitive +@interface RDar6829164 : NSObject { + double x; int y; +} +- (id) init; +@end + +id rdar_6829164_1(); +double rdar_6829164_2(); + +@implementation RDar6829164 +- (id) init { + if((self = [super init]) != 0) { + id z = rdar_6829164_1(); + y = (z != 0); + if (y) + x = rdar_6829164_2(); + } + return self; +} +@end