[cfe-commits] r127687 - in /cfe/trunk: lib/StaticAnalyzer/Checkers/IdempotentOperationChecker.cpp test/Analysis/idempotent-operations.m

Ted Kremenek kremenek at apple.com
Tue Mar 15 12:27:57 PDT 2011


Author: kremenek
Date: Tue Mar 15 14:27:57 2011
New Revision: 127687

URL: http://llvm.org/viewvc/llvm-project?rev=127687&view=rev
Log:
Remove bogus assertion in IdempotentOperationsChecker.

Modified:
    cfe/trunk/lib/StaticAnalyzer/Checkers/IdempotentOperationChecker.cpp
    cfe/trunk/test/Analysis/idempotent-operations.m

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/IdempotentOperationChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/IdempotentOperationChecker.cpp?rev=127687&r1=127686&r2=127687&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/IdempotentOperationChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/IdempotentOperationChecker.cpp Tue Mar 15 14:27:57 2011
@@ -336,10 +336,9 @@
     = cast<StmtPoint>(C.getPredecessor()->getLocation()).getStmt();
   
   // Ignore implicit calls to setters.
-  if (isa<ObjCPropertyRefExpr>(predStmt))
+  if (!isa<BinaryOperator>(predStmt))
     return;
-  
-  assert(isa<BinaryOperator>(predStmt));
+
   Data.explodedNodes.Add(C.getPredecessor());
 }
 

Modified: cfe/trunk/test/Analysis/idempotent-operations.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/idempotent-operations.m?rev=127687&r1=127686&r2=127687&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/idempotent-operations.m (original)
+++ cfe/trunk/test/Analysis/idempotent-operations.m Tue Mar 15 14:27:57 2011
@@ -40,3 +40,15 @@
   int x = placeholder.media.locked = placeholder ? 1 : 0;
 }
 
+// <rdar://problem/9130239>: Test that calling property setters doesn't 
+// trigger an assertion failure when the object is nil.
+ at interface RDar9130239
+ at property (assign) id delegate;
+ at end
+
+void test_RDar9130239(RDar9130239 *x) {
+  if (x)
+    return;
+  x.delegate = x; // no-warning
+}
+





More information about the cfe-commits mailing list