[cfe-commits] r53647 - in /cfe/trunk: lib/Analysis/CheckObjCDealloc.cpp test/Analysis/IBOutlet.m
Ted Kremenek
kremenek at apple.com
Tue Jul 15 16:04:27 PDT 2008
Author: kremenek
Date: Tue Jul 15 18:04:27 2008
New Revision: 53647
URL: http://llvm.org/viewvc/llvm-project?rev=53647&view=rev
Log:
For the MissingDealloc check, don't treat IBOutlet ivars as being needed to be released
Added:
cfe/trunk/test/Analysis/IBOutlet.m
Modified:
cfe/trunk/lib/Analysis/CheckObjCDealloc.cpp
Modified: cfe/trunk/lib/Analysis/CheckObjCDealloc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CheckObjCDealloc.cpp?rev=53647&r1=53646&r2=53647&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/CheckObjCDealloc.cpp (original)
+++ cfe/trunk/lib/Analysis/CheckObjCDealloc.cpp Tue Jul 15 18:04:27 2008
@@ -60,9 +60,11 @@
for (ObjCInterfaceDecl::ivar_iterator I=ID->ivar_begin(), E=ID->ivar_end();
I!=E; ++I) {
- QualType T = (*I)->getType();
+ ObjCIvarDecl* ID = *I;
+ QualType T = ID->getType();
- if (T->isPointerType() || T->isObjCQualifiedIdType()) {
+ if ((T->isPointerType() || T->isObjCQualifiedIdType()) &&
+ ID->getAttr<IBOutletAttr>() == 0) { // Skip IBOutlets.
containsPointerIvar = true;
break;
}
Added: cfe/trunk/test/Analysis/IBOutlet.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/IBOutlet.m?rev=53647&view=auto
==============================================================================
--- cfe/trunk/test/Analysis/IBOutlet.m (added)
+++ cfe/trunk/test/Analysis/IBOutlet.m Tue Jul 15 18:04:27 2008
@@ -0,0 +1,20 @@
+// RUN: clang -warn-objc-missing-dealloc '-DIBOutlet=__attribute__((iboutlet))' %s --verify
+
+#ifndef IBOutlet
+#define IBOutlet
+#endif
+
+ at class NSWindow;
+
+ at interface NSObject {}
+- (void)dealloc;
+ at end
+
+ at interface A : NSObject {
+IBOutlet NSWindow *window;
+}
+ at end
+
+ at implementation A // no-warning
+ at end
+
More information about the cfe-commits
mailing list