From: Ted Kremenek Date: Tue, 15 Mar 2011 19:27:57 +0000 (+0000) Subject: Remove bogus assertion in IdempotentOperationsChecker. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cf995d357759221f0a3b9fcd9315b004a4aa38ad;p=clang Remove bogus assertion in IdempotentOperationsChecker. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127687 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/StaticAnalyzer/Checkers/IdempotentOperationChecker.cpp b/lib/StaticAnalyzer/Checkers/IdempotentOperationChecker.cpp index 495c594bea..b2177c9a75 100644 --- a/lib/StaticAnalyzer/Checkers/IdempotentOperationChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/IdempotentOperationChecker.cpp @@ -336,10 +336,9 @@ void IdempotentOperationChecker::checkPostStmt(const BinaryOperator *B, = cast(C.getPredecessor()->getLocation()).getStmt(); // Ignore implicit calls to setters. - if (isa(predStmt)) + if (!isa(predStmt)) return; - - assert(isa(predStmt)); + Data.explodedNodes.Add(C.getPredecessor()); } diff --git a/test/Analysis/idempotent-operations.m b/test/Analysis/idempotent-operations.m index 39d44c4978..8f534940c9 100644 --- a/test/Analysis/idempotent-operations.m +++ b/test/Analysis/idempotent-operations.m @@ -40,3 +40,15 @@ void pr9116(NSObject *placeholder) { int x = placeholder.media.locked = placeholder ? 1 : 0; } +// : Test that calling property setters doesn't +// trigger an assertion failure when the object is nil. +@interface RDar9130239 +@property (assign) id delegate; +@end + +void test_RDar9130239(RDar9130239 *x) { + if (x) + return; + x.delegate = x; // no-warning +} +