Bug fix in CFG construction: Properly register the loop head as the implicit
successor of blocks created above it.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47666 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/AST/CFG.cpp b/AST/CFG.cpp
index 431b2e2..3ea5313 100644
--- a/AST/CFG.cpp
+++ b/AST/CFG.cpp
@@ -679,6 +679,7 @@
     // There is no loop initialization.   We are thus basically a while 
     // loop.  NULL out Block to force lazy block construction.
     Block = NULL;
+    Succ = EntryConditionBlock;
     return EntryConditionBlock;
   }
 }
@@ -758,6 +759,7 @@
   Block = NULL;
   
   // Return the condition block, which is the dominating block for the loop.
+  Succ = EntryConditionBlock;
   return EntryConditionBlock;
 }
 
@@ -790,11 +792,9 @@
     if (Block) FinishBlock(EntryConditionBlock);
   }
   
-  // The condition block is the implicit successor for the loop body as
-  // well as any code above the loop.
+  // The condition block is the implicit successor for the loop body.
   Succ = EntryConditionBlock;
 
-
   // Process the loop body.
   CFGBlock* BodyBlock = NULL;
   {
@@ -836,6 +836,7 @@
   Block = NULL;
   
   // Return the loop body, which is the dominating block for the loop.
+  Succ = BodyBlock;
   return BodyBlock;
 }