From 1d4b218fa55239f2a7350f48be14090d2753c22c Mon Sep 17 00:00:00 2001 From: Zhongxing Xu Date: Thu, 20 Aug 2009 02:56:48 +0000 Subject: [PATCH] If the body of for loop is empty, set its body to the continue target. 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Analysis/CFG.cpp b/lib/Analysis/CFG.cpp index c4406858e5..336faabdfb 100644 --- a/lib/Analysis/CFG.cpp +++ b/lib/Analysis/CFG.cpp @@ -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; -- 2.50.1