]> granicus.if.org Git - clang/commitdiff
Don't add a null successor to a CFGBlock when the contents of an @synchronized statem...
authorTed Kremenek <kremenek@apple.com>
Thu, 13 May 2010 16:38:08 +0000 (16:38 +0000)
committerTed Kremenek <kremenek@apple.com>
Thu, 13 May 2010 16:38:08 +0000 (16:38 +0000)
Fixes <rdar://problem/7979430>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103717 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/CFG.cpp
test/Analysis/misc-ps.m

index 7f71e0acf7a3e839b103ea1d1b17b5234c23118a..c7eb53d36135937283f694902bc47357b2d14690 100644 (file)
@@ -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());
 }
index 2b21eec18cd7317d99631a60901e83f206d93579..7061f6b2d10a54738577168183c681ffd55a65a3 100644 (file)
@@ -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) {}
+}
+