summaryrefslogtreecommitdiffstats
path: root/clang/AST/CFG.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2007-08-28 18:30:10 +0000
committerTed Kremenek <kremenek@apple.com>2007-08-28 18:30:10 +0000
commit105efce68f86c7091588616e5e1500ead57a2aaf (patch)
tree39b0b143c8faf2627c0f80712b5d481cc71ae24a /clang/AST/CFG.cpp
parent1c1f9324337dd0f42c6e73b4b41455c2e138d743 (diff)
downloadbcm5719-llvm-105efce68f86c7091588616e5e1500ead57a2aaf.tar.gz
bcm5719-llvm-105efce68f86c7091588616e5e1500ead57a2aaf.zip
Added support for GCC-style statement expressions in source-level CFGs.
llvm-svn: 41549
Diffstat (limited to 'clang/AST/CFG.cpp')
-rw-r--r--clang/AST/CFG.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/clang/AST/CFG.cpp b/clang/AST/CFG.cpp
index 68471ac955a..fb504626603 100644
--- a/clang/AST/CFG.cpp
+++ b/clang/AST/CFG.cpp
@@ -102,6 +102,7 @@ private:
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 @@ CFGBlock* CFGBuilder::WalkAST(Stmt* S, bool AlwaysAddStmt = false) {
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 @@ CFGBlock* CFGBuilder::WalkAST_VisitChildren(Stmt* S) {
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
OpenPOWER on IntegriCloud