[cfe-commits] r166047 - in /cfe/trunk: lib/StaticAnalyzer/Checkers/IvarInvalidationChecker.cpp test/Analysis/objc_invalidation.m

Anna Zaks ganna at apple.com
Tue Oct 16 12:36:37 PDT 2012


Author: zaks
Date: Tue Oct 16 14:36:37 2012
New Revision: 166047

URL: http://llvm.org/viewvc/llvm-project?rev=166047&view=rev
Log:
[analyzer] Ivar Invalidation: track ivars in continuations and
@implementation.

Modified:
    cfe/trunk/lib/StaticAnalyzer/Checkers/IvarInvalidationChecker.cpp
    cfe/trunk/test/Analysis/objc_invalidation.m

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/IvarInvalidationChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/IvarInvalidationChecker.cpp?rev=166047&r1=166046&r2=166047&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/IvarInvalidationChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/IvarInvalidationChecker.cpp Tue Oct 16 14:36:37 2012
@@ -314,12 +314,12 @@
   // Collect all ivars that need cleanup.
   IvarSet Ivars;
   const ObjCInterfaceDecl *InterfaceD = D->getClassInterface();
-  for (ObjCInterfaceDecl::ivar_iterator
-      II = InterfaceD->ivar_begin(),
-      IE = InterfaceD->ivar_end(); II != IE; ++II) {
-    const ObjCIvarDecl *Iv = *II;
+
+  // Collect ivars declared in this class, its extensions and its implementation
+  ObjCInterfaceDecl *IDecl = const_cast<ObjCInterfaceDecl *>(InterfaceD);
+  for (const ObjCIvarDecl *Iv = IDecl->all_declared_ivar_begin(); Iv;
+       Iv= Iv->getNextIvar())
     trackIvar(Iv, Ivars);
-  }
 
   // Construct Property/Property Accessor to Ivar maps to assist checking if an
   // ivar which is backing a property has been reset.

Modified: cfe/trunk/test/Analysis/objc_invalidation.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/objc_invalidation.m?rev=166047&r1=166046&r2=166047&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/objc_invalidation.m (original)
+++ cfe/trunk/test/Analysis/objc_invalidation.m Tue Oct 16 14:36:37 2012
@@ -93,7 +93,14 @@
 
 @end
 
- at implementation SomeSubclassInvalidatableObject
+ at interface SomeSubclassInvalidatableObject()
+ at property (assign) SomeInvalidationImplementingObject* Prop8;
+ at end
+
+ at implementation SomeSubclassInvalidatableObject{
+  @private
+  SomeInvalidationImplementingObject *Ivar5;
+}
 
 @synthesize Prop7 = _propIvar;
 @synthesize Prop3 = _Prop3;
@@ -139,4 +146,6 @@
  // expected-warning at -4 {{Property SynthIvarProp needs to be invalidated}}
  // expected-warning at -5 {{Instance variable _Ivar3 needs to be invalidated}}
  // expected-warning at -6 {{Instance variable _Ivar4 needs to be invalidated}}
+ // expected-warning at -7 {{Instance variable Ivar5 needs to be invalidated or set to nil}}
+ // expected-warning at -8 {{Property Prop8 needs to be invalidated}}
 @end





More information about the cfe-commits mailing list