aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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) {}
+}
+