aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2010-05-13 16:38:08 +0000
committerTed Kremenek <kremenek@apple.com>2010-05-13 16:38:08 +0000
commitfadebbafe622752c3c6565b53ce8cd42bbbbd90c (patch)
tree5038f38c84dd1026434ef83c32b0dffa020df457
parent6bfd53360072409715fe4e4d4f41d9ebdf948479 (diff)
Don't add a null successor to a CFGBlock when the contents of an @synchronized statement is empty.
Fixes <rdar://problem/7979430>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103717 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Analysis/CFG.cpp3
-rw-r--r--test/Analysis/misc-ps.m10
2 files changed, 11 insertions, 2 deletions
diff --git a/lib/Analysis/CFG.cpp b/lib/Analysis/CFG.cpp
index 7f71e0acf7..c7eb53d361 100644
--- a/lib/Analysis/CFG.cpp
+++ b/lib/Analysis/CFG.cpp
@@ -1223,10 +1223,9 @@ CFGBlock* CFGBuilder::VisitObjCAtSynchronizedStmt(ObjCAtSynchronizedStmt* S) {
return 0;
Block = 0;
+ Succ = SyncBlock;
}
- Succ = SyncBlock;
-
// Inline the sync expression.
return addStmt(S->getSynchExpr());
}
diff --git a/test/Analysis/misc-ps.m b/test/Analysis/misc-ps.m
index 2b21eec18c..7061f6b2d1 100644
--- a/test/Analysis/misc-ps.m
+++ b/test/Analysis/misc-ps.m
@@ -957,3 +957,13 @@ void pr6938_b() {
}) == 0) {
}
}
+
+//===----------------------------------------------------------------------===//
+// <rdar://problem/7979430> - The CFG for code containing an empty
+// @synchronized block was previously broken (and would crash the analyzer).
+//===----------------------------------------------------------------------===//
+
+void r7979430(id x) {
+ @synchronized(x) {}
+}
+