blob: 3f68206b168fc6ff4abf3cadcf1e1a66691e1408 [file] [log] [blame]
Ted Kremenek148849a2011-02-12 01:01:31 +00001// RUN: %clang_cc1 -analyze -analyzer-store=region -analyzer-constraints=range -fblocks -analyzer-opt-analyze-nested-blocks -analyzer-check-objc-mem -analyzer-check-idempotent-operations -verify %s
2
3typedef signed char BOOL;
4typedef unsigned long NSUInteger;
5typedef struct _NSZone NSZone;
6@protocol NSObject - (BOOL)isEqual:(id)object;
7@end @interface NSObject <NSObject> {
8}
9@end
10
11
12// <rdar://problem/8725041> - Don't flag idempotent operation warnings when
13// a method may invalidate an instance variable.
14@interface Rdar8725041 : NSObject {
15 id _attribute;
16}
17 - (void) method2;
18@end
19
20@implementation Rdar8725041
21- (BOOL) method1 {
22 BOOL needsUpdate = (BOOL)0;
23 id oldAttribute = _attribute;
24 [self method2];
25 needsUpdate |= (_attribute != oldAttribute); // no-warning
26 return needsUpdate;
27}
28
29- (void) method2
30{
31 _attribute = ((void*)0);
32}
33@end
34