[cfe-commits] r47034 - /cfe/trunk/Analysis/GREngine.cpp
Ted Kremenek
kremenek at apple.com
Tue Feb 12 13:51:20 PST 2008
Author: kremenek
Date: Tue Feb 12 15:51:20 2008
New Revision: 47034
URL: http://llvm.org/viewvc/llvm-project?rev=47034&view=rev
Log:
Added GREngine support for GotoStmt.
Modified:
cfe/trunk/Analysis/GREngine.cpp
Modified: cfe/trunk/Analysis/GREngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Analysis/GREngine.cpp?rev=47034&r1=47033&r2=47034&view=diff
==============================================================================
--- cfe/trunk/Analysis/GREngine.cpp (original)
+++ cfe/trunk/Analysis/GREngine.cpp Tue Feb 12 15:51:20 2008
@@ -168,42 +168,47 @@
default:
assert(false && "Analysis for this terminator not implemented.");
break;
+
+ case Stmt::BinaryOperatorClass: // '&&' and '||'
+ HandleBranch(cast<BinaryOperator>(Term)->getLHS(), Term, B, Pred);
+ return;
case Stmt::ConditionalOperatorClass:
HandleBranch(cast<ConditionalOperator>(Term)->getCond(), Term, B, Pred);
- break;
+ return;
+
+ // FIXME: Use constant-folding in CFG construction to simplify this
+ // case.
case Stmt::ChooseExprClass:
HandleBranch(cast<ChooseExpr>(Term)->getCond(), Term, B, Pred);
- break;
+ return;
- case Stmt::BinaryOperatorClass: // '&&' and '||'
- HandleBranch(cast<BinaryOperator>(Term)->getLHS(), Term, B, Pred);
- break;
-
- case Stmt::IfStmtClass:
- HandleBranch(cast<IfStmt>(Term)->getCond(), Term, B, Pred);
- break;
+ case Stmt::DoStmtClass:
+ HandleBranch(cast<DoStmt>(Term)->getCond(), Term, B, Pred);
+ return;
case Stmt::ForStmtClass:
HandleBranch(cast<ForStmt>(Term)->getCond(), Term, B, Pred);
+ return;
+
+ case Stmt::GotoStmtClass:
break;
+ case Stmt::IfStmtClass:
+ HandleBranch(cast<IfStmt>(Term)->getCond(), Term, B, Pred);
+ return;
+
case Stmt::WhileStmtClass:
HandleBranch(cast<WhileStmt>(Term)->getCond(), Term, B, Pred);
- break;
-
- case Stmt::DoStmtClass:
- HandleBranch(cast<DoStmt>(Term)->getCond(), Term, B, Pred);
- break;
+ return;
}
}
- else {
- assert (B->succ_size() == 1 &&
- "Blocks with no terminator should have at most 1 successor.");
+
+ assert (B->succ_size() == 1 &&
+ "Blocks with no terminator should have at most 1 successor.");
- GenerateNode(BlockEdge(getCFG(),B,*(B->succ_begin())), Pred->State, Pred);
- }
+ GenerateNode(BlockEdge(getCFG(),B,*(B->succ_begin())), Pred->State, Pred);
}
void GREngineImpl::HandleBranch(Expr* Cond, Stmt* Term, CFGBlock * B,
More information about the cfe-commits
mailing list