[cfe-commits] r41549 - /cfe/trunk/AST/CFG.cpp
Ted Kremenek
kremenek at apple.com
Tue Aug 28 11:30:10 PDT 2007
Author: kremenek
Date: Tue Aug 28 13:30:10 2007
New Revision: 41549
URL: http://llvm.org/viewvc/llvm-project?rev=41549&view=rev
Log:
Added support for GCC-style statement expressions in source-level CFGs.
Modified:
cfe/trunk/AST/CFG.cpp
Modified: cfe/trunk/AST/CFG.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/AST/CFG.cpp?rev=41549&r1=41548&r2=41549&view=diff
==============================================================================
--- cfe/trunk/AST/CFG.cpp (original)
+++ cfe/trunk/AST/CFG.cpp Tue Aug 28 13:30:10 2007
@@ -102,6 +102,7 @@
CFGBlock* WalkAST(Stmt* S, bool AlwaysAddStmt);
CFGBlock* WalkAST_VisitChildren(Stmt* S);
CFGBlock* WalkAST_VisitVarDecl(VarDecl* D);
+ CFGBlock* WalkAST_VisitStmtExpr(StmtExpr* S);
void FinishBlock(CFGBlock* B);
};
@@ -218,6 +219,9 @@
return WalkAST_VisitVarDecl(V);
}
else return Block;
+
+ case Stmt::StmtExprClass:
+ return WalkAST_VisitStmtExpr(cast<StmtExpr>(S));
case Stmt::BinaryOperatorClass: {
BinaryOperator* B = cast<BinaryOperator>(S);
@@ -287,6 +291,13 @@
return B;
}
+/// WalkAST_VisitStmtExpr - Utility method to handle (nested) statement
+/// expressions (a GCC extension).
+CFGBlock* CFGBuilder::WalkAST_VisitStmtExpr(StmtExpr* S) {
+ Block->appendStmt(S);
+ return VisitCompoundStmt(S->getSubStmt());
+}
+
/// VisitStmt - Handle statements with no branching control flow.
CFGBlock* CFGBuilder::VisitStmt(Stmt* Statement) {
// We cannot assume that we are in the middle of a basic block, since
More information about the cfe-commits
mailing list