[PATCH] D82486: RecursiveASTVisitor: don't call WalkUp unnecessarily in post-order traversal
Dmitri Gribenko via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 24 11:21:54 PDT 2020
gribozavr created this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
gribozavr2 added reviewers: eduucaldas, ymandel.
How does RecursiveASTVisitor call the WalkUp callback for expressions?
- In pre-order traversal mode, RecursiveASTVisitor calls the WalkUp
callback from the default implementation of Traverse callbacks.
- In post-order traversal mode when we don't have a DataRecursionQueue,
RecursiveASTVisitor also calls the WalkUp callback from the default
implementation of Traverse callbacks.
- However, in post-order traversal mode when we have a DataRecursionQueue,
RecursiveASTVisitor calls the WalkUp callback from PostVisitStmt.
As a result, when the user overrides the Traverse callback, in pre-order
traversal mode they never get the corresponding WalkUp callback. However
in the post-order traversal mode the WalkUp callback is invoked or not
depending on whether the data recursion optimization could be applied.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D82486
Files:
clang/include/clang/AST/RecursiveASTVisitor.h
clang/unittests/Tooling/RecursiveASTVisitorTests/Callbacks.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D82486.273108.patch
Type: text/x-patch
Size: 5889 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200624/093a2b13/attachment.bin>
More information about the cfe-commits
mailing list