[cfe-commits] r93963 - /cfe/trunk/lib/Analysis/CFG.cpp

Mike Stump mrs at apple.com
Tue Jan 19 17:30:58 PST 2010


Author: mrs
Date: Tue Jan 19 19:30:58 2010
New Revision: 93963

URL: http://llvm.org/viewvc/llvm-project?rev=93963&view=rev
Log:
Wire up the EH context for the catch clauses to the outer EH context.  WIP.

Modified:
    cfe/trunk/lib/Analysis/CFG.cpp

Modified: cfe/trunk/lib/Analysis/CFG.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CFG.cpp?rev=93963&r1=93962&r2=93963&view=diff

==============================================================================
--- cfe/trunk/lib/Analysis/CFG.cpp (original)
+++ cfe/trunk/lib/Analysis/CFG.cpp Tue Jan 19 19:30:58 2010
@@ -1598,14 +1598,12 @@
     TrySuccessor = Block;
   } else TrySuccessor = Succ;
 
-  // Save the current "try" context.
   CFGBlock *PrevTryTerminatedBlock = TryTerminatedBlock;
-  SaveAndRestore<CFGBlock*> save_try(TryTerminatedBlock);
 
   // Create a new block that will contain the try statement.
-  TryTerminatedBlock = createBlock(false);
+  CFGBlock *NewTryTerminatedBlock = createBlock(false);
   // Add the terminator in the try block.
-  TryTerminatedBlock->setTerminator(Terminator);
+  NewTryTerminatedBlock->setTerminator(Terminator);
 
   bool HasCatchAll = false;
   for (unsigned h = 0; h <Terminator->getNumHandlers(); ++h) {
@@ -1621,20 +1619,22 @@
       return 0;
     // Add this block to the list of successors for the block with the try
     // statement.
-    AddSuccessor(TryTerminatedBlock, CatchBlock);
+    AddSuccessor(NewTryTerminatedBlock, CatchBlock);
   }
   if (!HasCatchAll) {
     if (PrevTryTerminatedBlock)
-      AddSuccessor(TryTerminatedBlock, PrevTryTerminatedBlock);
+      AddSuccessor(NewTryTerminatedBlock, PrevTryTerminatedBlock);
     else
-      AddSuccessor(TryTerminatedBlock, &cfg->getExit());
+      AddSuccessor(NewTryTerminatedBlock, &cfg->getExit());
   }
 
   // The code after the try is the implicit successor.
   Succ = TrySuccessor;
 
-  // When visiting the body, the case statements should automatically get linked
-  // up to the try.
+  // Save the current "try" context.
+  SaveAndRestore<CFGBlock*> save_try(TryTerminatedBlock);
+  TryTerminatedBlock = NewTryTerminatedBlock;
+
   assert(Terminator->getTryBlock() && "try must contain a non-NULL body");
   Block = NULL;
   Block = addStmt(Terminator->getTryBlock());





More information about the cfe-commits mailing list