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

Anna Zaks ganna at apple.com
Thu Jan 10 19:52:40 PST 2013


Author: zaks
Date: Thu Jan 10 21:52:40 2013
New Revision: 172169

URL: http://llvm.org/viewvc/llvm-project?rev=172169&view=rev
Log:
[analyzer]Recognize ivar invalidation protocol even if it was redeclared

This will get rid of some false positives as well as false negatives.

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=172169&r1=172168&r2=172169&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/IvarInvalidationChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/IvarInvalidationChecker.cpp Thu Jan 10 21:52:40 2013
@@ -233,7 +233,7 @@
     for (ObjCInterfaceDecl::protocol_iterator
         I = InterfD->protocol_begin(),
         E = InterfD->protocol_end(); I != E; ++I) {
-      containsInvalidationMethod(*I, OutInfo);
+      containsInvalidationMethod((*I)->getDefinition(), OutInfo);
     }
 
     // Visit all categories in case the invalidation method is declared in
@@ -252,7 +252,7 @@
     for (ObjCInterfaceDecl::protocol_iterator
         I = ProtD->protocol_begin(),
         E = ProtD->protocol_end(); I != E; ++I) {
-      containsInvalidationMethod(*I, OutInfo);
+      containsInvalidationMethod((*I)->getDefinition(), OutInfo);
     }
     return;
   }

Modified: cfe/trunk/test/Analysis/objc_invalidation.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/objc_invalidation.m?rev=172169&r1=172168&r2=172169&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/objc_invalidation.m (original)
+++ cfe/trunk/test/Analysis/objc_invalidation.m Thu Jan 10 21:52:40 2013
@@ -35,6 +35,9 @@
 - (void) invalidate2 __attribute__((annotate("objc_instance_variable_invalidator")));
 @end
 
+ at protocol Invalidation3;
+ at protocol Invalidation2;
+
 @interface Invalidation2Class <Invalidation2>
 @end
 





More information about the cfe-commits mailing list