aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2011-03-15 19:27:57 +0000
committerTed Kremenek <kremenek@apple.com>2011-03-15 19:27:57 +0000
commitcf995d357759221f0a3b9fcd9315b004a4aa38ad (patch)
tree2316c837307225feae45c10564c9fcc11425317c
parenta968e97947b1281c3bb3c4d47a952b3801d9bb02 (diff)
Remove bogus assertion in IdempotentOperationsChecker.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127687 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/StaticAnalyzer/Checkers/IdempotentOperationChecker.cpp5
-rw-r--r--test/Analysis/idempotent-operations.m12
2 files changed, 14 insertions, 3 deletions
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<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());
}
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;
}
+// <rdar://problem/9130239>: 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
+}
+