summaryrefslogtreecommitdiffstats
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
commitecc31c93c2a847f54db8fa978800fb4c8287b853 (patch)
tree94a1745d6fdb00d88b013036f44be8d9c8030d1b
parentd321413e3de506a0e24ef36d4685e520457511a8 (diff)
downloadbcm5719-llvm-ecc31c93c2a847f54db8fa978800fb4c8287b853.tar.gz
bcm5719-llvm-ecc31c93c2a847f54db8fa978800fb4c8287b853.zip
Don't add a null successor to a CFGBlock when the contents of an @synchronized statement is empty.
Fixes <rdar://problem/7979430>. llvm-svn: 103717
-rw-r--r--clang/lib/Analysis/CFG.cpp3
-rw-r--r--clang/test/Analysis/misc-ps.m10
2 files changed, 11 insertions, 2 deletions
diff --git a/clang/lib/Analysis/CFG.cpp b/clang/lib/Analysis/CFG.cpp
index 7f71e0acf7a..c7eb53d3613 100644
--- a/clang/lib/Analysis/CFG.cpp
+++ b/clang/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/clang/test/Analysis/misc-ps.m b/clang/test/Analysis/misc-ps.m
index 2b21eec18cd..7061f6b2d10 100644
--- a/clang/test/Analysis/misc-ps.m
+++ b/clang/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) {}
+}
+
OpenPOWER on IntegriCloud