diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-05-03 19:16:22 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-05-03 19:16:22 +0000 |
commit | 0f2fc5ff49cb9abd6c6972ffd6db066295672867 (patch) | |
tree | bfc41cab8354335424b7c89e9d3f8a040624e8d4 /include | |
parent | 8c045ace381972f41d385b0a661ccf172834f459 (diff) |
PR15906: The body of a lambda is not an evaluated subexpression; don't visit it when visiting such subexpressions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181046 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/clang/AST/EvaluatedExprVisitor.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/include/clang/AST/EvaluatedExprVisitor.h b/include/clang/AST/EvaluatedExprVisitor.h index eb186c217e..2e3cbfad91 100644 --- a/include/clang/AST/EvaluatedExprVisitor.h +++ b/include/clang/AST/EvaluatedExprVisitor.h @@ -55,7 +55,7 @@ public: // Only the selected subexpression matters; the other one is not evaluated. return this->Visit(E->getChosenSubExpr(Context)); } - + void VisitDesignatedInitExpr(DesignatedInitExpr *E) { // Only the actual initializer matters; the designators are all constant // expressions. @@ -72,6 +72,15 @@ public: return static_cast<ImplClass*>(this)->VisitExpr(CE); } + void VisitLambdaExpr(LambdaExpr *LE) { + // Only visit the capture initializers, and not the body. + for (LambdaExpr::capture_init_iterator I = LE->capture_init_begin(), + E = LE->capture_init_end(); + I != E; ++I) + if (*I) + this->Visit(*I); + } + /// \brief The basis case walks all of the children of the statement or /// expression, assuming they are all potentially evaluated. void VisitStmt(Stmt *S) { |