]> granicus.if.org Git - clang/commitdiff
source-level CFG: have the body for the @synchronized start with its own basic
authorTed Kremenek <kremenek@apple.com>
Tue, 5 May 2009 23:11:51 +0000 (23:11 +0000)
committerTed Kremenek <kremenek@apple.com>
Tue, 5 May 2009 23:11:51 +0000 (23:11 +0000)
block. This makes it a little easier for diagnostics generation.

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

lib/AST/CFG.cpp

index f5b604554d895d7fb931744c25f7ca6c907cc518..af2a8910d8b33d743dac26f3201b074f35786fc3 100644 (file)
@@ -937,7 +937,18 @@ CFGBlock* CFGBuilder::VisitObjCAtSynchronizedStmt(ObjCAtSynchronizedStmt* S) {
   // FIXME: Add locking 'primitives' to CFG for @synchronized.
   
   // Inline the body.
-  Visit(S->getSynchBody());
+  CFGBlock *SyncBlock = Visit(S->getSynchBody());
+  
+  // The sync body starts its own basic block.  This makes it a little easier
+  // for diagnostic clients.
+  if (SyncBlock) {
+    if (!FinishBlock(SyncBlock))
+      return 0;
+    
+    Block = 0;
+  }
+    
+  Succ = SyncBlock;
   
   // Inline the sync expression.
   return Visit(S->getSynchExpr());