From: Ted Kremenek Date: Thu, 12 Apr 2012 20:03:44 +0000 (+0000) Subject: Fix CFGBuilder to not include the body of a LambdaExpr in the CFG of the enclosing... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=55331da3211151aa67277aa095b7d301342200d4;p=clang Fix CFGBuilder to not include the body of a LambdaExpr in the CFG of the enclosing function. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154607 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Analysis/CFG.cpp b/lib/Analysis/CFG.cpp index 0129cfa5e1..97d494d7e9 100644 --- a/lib/Analysis/CFG.cpp +++ b/lib/Analysis/CFG.cpp @@ -310,7 +310,6 @@ private: // Visitors to walk an AST and construct the CFG. CFGBlock *VisitAddrLabelExpr(AddrLabelExpr *A, AddStmtChoice asc); CFGBlock *VisitBinaryOperator(BinaryOperator *B, AddStmtChoice asc); - CFGBlock *VisitBlockExpr(BlockExpr *E, AddStmtChoice asc); CFGBlock *VisitBreakStmt(BreakStmt *B); CFGBlock *VisitCXXCatchStmt(CXXCatchStmt *S); CFGBlock *VisitExprWithCleanups(ExprWithCleanups *E, @@ -336,6 +335,7 @@ private: CFGBlock *VisitDeclSubExpr(DeclStmt *DS); CFGBlock *VisitDefaultStmt(DefaultStmt *D); CFGBlock *VisitDoStmt(DoStmt *D); + CFGBlock *VisitLambdaExpr(LambdaExpr *E, AddStmtChoice asc); CFGBlock *VisitForStmt(ForStmt *F); CFGBlock *VisitGotoStmt(GotoStmt *G); CFGBlock *VisitIfStmt(IfStmt *I); @@ -361,6 +361,7 @@ private: CFGBlock *Visit(Stmt *S, AddStmtChoice asc = AddStmtChoice::NotAlwaysAdd); CFGBlock *VisitStmt(Stmt *S, AddStmtChoice asc); CFGBlock *VisitChildren(Stmt *S); + CFGBlock *VisitNoRecurse(Expr *E, AddStmtChoice asc); // Visitors to walk an AST and generate destructors of temporaries in // full expression. @@ -984,7 +985,8 @@ CFGBlock *CFGBuilder::Visit(Stmt * S, AddStmtChoice asc) { return VisitBinaryOperator(cast(S), asc); case Stmt::BlockExprClass: - return VisitBlockExpr(cast(S), asc); + case Stmt::LambdaExprClass: + return VisitNoRecurse(cast(S), asc); case Stmt::BreakStmtClass: return VisitBreakStmt(cast(S)); @@ -1235,7 +1237,7 @@ CFGBlock *CFGBuilder::VisitBinaryOperator(BinaryOperator *B, return (LBlock ? LBlock : RBlock); } -CFGBlock *CFGBuilder::VisitBlockExpr(BlockExpr *E, AddStmtChoice asc) { +CFGBlock *CFGBuilder::VisitNoRecurse(Expr *E, AddStmtChoice asc) { if (asc.alwaysAdd(*this, E)) { autoCreateBlock(); appendStmt(Block, E);