1 // RUN: %clang_cc1 -analyze -analyzer-store=region -analyzer-constraints=range -fblocks -analyzer-opt-analyze-nested-blocks -analyzer-checker=deadcode.IdempotentOperations,osx.cocoa.RetainCount -verify %s
3 typedef signed char BOOL;
4 typedef unsigned long NSUInteger;
5 typedef struct _NSZone NSZone;
6 @protocol NSObject - (BOOL)isEqual:(id)object;
11 @property(nonatomic, readonly) NSObject *media;
14 // <rdar://problem/8725041> - Don't flag idempotent operation warnings when
15 // a method may invalidate an instance variable.
16 @interface Rdar8725041 : NSObject {
22 @implementation Rdar8725041
24 BOOL needsUpdate = (BOOL)0;
25 id oldAttribute = _attribute;
27 needsUpdate |= (_attribute != oldAttribute); // no-warning
33 _attribute = ((void*)0);
37 // Test that the idempotent operations checker works in the prescence
38 // of property expressions.
39 void pr9116(NSObject *placeholder) {
40 int x = placeholder.media.locked = placeholder ? 1 : 0;
43 // <rdar://problem/9130239>: Test that calling property setters doesn't
44 // trigger an assertion failure when the object is nil.
45 @interface RDar9130239
46 @property (assign) id delegate;
49 void test_RDar9130239(RDar9130239 *x) {
52 x.delegate = x; // no-warning