On Mon, Jul 20, 2009 at 6:12 PM, Mike Stump<[email protected]> wrote: > --- cfe/trunk/lib/Analysis/CFG.cpp (original) > +++ cfe/trunk/lib/Analysis/CFG.cpp Mon Jul 20 20:12:51 2009 > @@ -863,10 +863,24 @@ > } > > CFGBlock* CFGBuilder::VisitForStmt(ForStmt* F) { > - // "for" is a control-flow statement. Thus we stop processing the current > - // block. > + // See if this is a known constant. > + bool KnownTrue = false; > + bool KnownFalse = false; > + Expr::EvalResult Result; > + if (F->getCond() && F->getCond()->Evaluate(Result, *Context) > + && Result.Val.isInt()) { > + if (Result.Val.getInt().getBoolValue()) > + KnownTrue = true; > + else > + KnownFalse = true; > + } > + if (F->getCond() == 0) > + KnownTrue = true;
It might be slightly clearer to structure this as an "if ... else if". -Eli _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
