]> granicus.if.org Git - clang/commitdiff
If the 'while' has an empty body, set the body to the continue target block.
authorZhongxing Xu <xuzhongxing@gmail.com>
Thu, 20 Aug 2009 03:21:49 +0000 (03:21 +0000)
committerZhongxing Xu <xuzhongxing@gmail.com>
Thu, 20 Aug 2009 03:21:49 +0000 (03:21 +0000)
Although this does not make the CFG more correct, it makes the CFG more
beautiful without multiple roots.

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

lib/Analysis/CFG.cpp

index 336faabdfb5f363b3a3b8d3cb22c37b707c81b26..1cfe858c8dbcc6a36980e471b8fcd9909e500342 100644 (file)
@@ -1146,7 +1146,7 @@ CFGBlock* CFGBuilder::VisitWhileStmt(WhileStmt* W) {
     CFGBlock* BodyBlock = addStmt(W->getBody());
 
     if (!BodyBlock)
-      BodyBlock = EntryConditionBlock; // can happen for "while(...) ;"
+      BodyBlock = ContinueTargetBlock; // can happen for "while(...) ;"
     else if (Block) {
       if (!FinishBlock(BodyBlock))
         return 0;