diff options
Diffstat (limited to 'clang/include')
-rw-r--r-- | clang/include/clang/AST/RecursiveASTVisitor.h | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/clang/include/clang/AST/RecursiveASTVisitor.h b/clang/include/clang/AST/RecursiveASTVisitor.h index 96f3d24c6db8..44aba6355758 100644 --- a/clang/include/clang/AST/RecursiveASTVisitor.h +++ b/clang/include/clang/AST/RecursiveASTVisitor.h @@ -1368,9 +1368,14 @@ DEF_TRAVERSE_TYPELOC(PipeType, { TRY_TO(TraverseTypeLoc(TL.getValueLoc())); }) template <typename Derived> bool RecursiveASTVisitor<Derived>::canIgnoreChildDeclWhileTraversingDeclContext( const Decl *Child) { - // BlockDecls and CapturedDecls are traversed through BlockExprs and - // CapturedStmts respectively. - return isa<BlockDecl>(Child) || isa<CapturedDecl>(Child); + // BlockDecls are traversed through BlockExprs, + // CapturedDecls are traversed through CapturedStmts. + if (isa<BlockDecl>(Child) || isa<CapturedDecl>(Child)) + return true; + // Lambda classes are traversed through LambdaExprs. + if (const CXXRecordDecl* Cls = dyn_cast<CXXRecordDecl>(Child)) + return Cls->isLambda(); + return false; } template <typename Derived> |