Author: kremenek
Date: Thu Oct 30 10:19:43 2008
New Revision: 58432
URL: http://llvm.org/viewvc/llvm-project?rev=58432&view=rev
Log:
Patch by Nikita Zhuk: test case for fix for false positive reported in PR2978.
Added:
cfe/trunk/test/Analysis/PR2978.m
Added: cfe/trunk/test/Analysis/PR2978.m
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/PR2978.m?rev=58432&view=auto
==============================================================================
--- cfe/trunk/test/Analysis/PR2978.m (added)
+++ cfe/trunk/test/Analysis/PR2978.m Thu Oct 30 10:19:43 2008
@@ -0,0 +1,55 @@
+// RUN: clang -warn-objc-missing-dealloc %s -verify
+
+// Tests for the checker which checks missing/extra ivar 'release' calls
+// in dealloc.
+
[EMAIL PROTECTED] NSObject
+- (void)release;
[EMAIL PROTECTED]
+
[EMAIL PROTECTED] MyClass : NSObject {
[EMAIL PROTECTED]
+ id _X;
+ id _Y;
+ id _Z;
+ id _K;
+ id _N;
+ id _M;
+ id _V;
+ id _W;
+}
[EMAIL PROTECTED](retain) id X;
[EMAIL PROTECTED](retain) id Y;
[EMAIL PROTECTED](assign) id Z;
[EMAIL PROTECTED](assign) id K;
[EMAIL PROTECTED](assign, readonly) id N;
[EMAIL PROTECTED](retain) id M;
[EMAIL PROTECTED](retain) id V;
[EMAIL PROTECTED](retain) id W;
[EMAIL PROTECTED]
+
[EMAIL PROTECTED] MyClass
[EMAIL PROTECTED] X = _X;
[EMAIL PROTECTED] Y = _Y; // expected-warning{{The '_Y' instance variable was
retained by a synthesized property but wasn't released in 'dealloc'}}
[EMAIL PROTECTED] Z = _Z; // expected-warning{{The '_Z' instance variable was
not retained by a synthesized property but was released in 'dealloc'}}
[EMAIL PROTECTED] K = _K;
[EMAIL PROTECTED] N = _N;
[EMAIL PROTECTED] M = _M;
[EMAIL PROTECTED] V = _V;
[EMAIL PROTECTED] W = _W; // expected-warning{{The '_W' instance variable was
retained by a synthesized property but wasn't released in 'dealloc'}}
+
+- (void)dealloc
+{
+ [_X release];
+ [_Z release];
+ [_N release];
+
+ self.M = 0; // This will release '_M'
+ [self setV:0]; // This will release '_V'
+ [self setW:@"newW"]; // This will release '_W', but retain the new value
+
+ [super dealloc];
+}
+
[EMAIL PROTECTED]
+
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits