]> granicus.if.org Git - clang/commitdiff
If the body of for loop is empty, set its body to the continue target.
authorZhongxing Xu <xuzhongxing@gmail.com>
Thu, 20 Aug 2009 02:56:48 +0000 (02:56 +0000)
committerZhongxing Xu <xuzhongxing@gmail.com>
Thu, 20 Aug 2009 02:56:48 +0000 (02:56 +0000)
Otherwise we get a wrong CFG.

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

lib/Analysis/CFG.cpp

index c4406858e5f8504a2fffd6969226ce6e4380ce00..336faabdfb5f363b3a3b8d3cb22c37b707c81b26 100644 (file)
@@ -925,7 +925,7 @@ CFGBlock* CFGBuilder::VisitForStmt(ForStmt* F) {
     CFGBlock* BodyBlock = addStmt(F->getBody());
 
     if (!BodyBlock)
-      BodyBlock = EntryConditionBlock; // can happen for "for (...;...; ) ;"
+      BodyBlock = ContinueTargetBlock; // can happen for "for (...;...;...) ;"
     else if (Block && !FinishBlock(BodyBlock))
       return 0;