[PATCH] D82486: RecursiveASTVisitor: don't call WalkUp unnecessarily in post-order traversal
Yitzhak Mandelbaum via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 25 06:53:18 PDT 2020
ymandel added inline comments.
================
Comment at: clang/include/clang/AST/RecursiveASTVisitor.h:335
+ template <bool has_same_type> struct is_same_method_impl {
+ static bool isSameMethod(...) { return false; }
+ };
----------------
Why use var-args rather than spelling out the type arguments like you have on lines 339-341 or, simpler, line 351?
================
Comment at: clang/include/clang/AST/RecursiveASTVisitor.h:339
+ template <> struct is_same_method_impl<true> {
+ template <typename FirstTy, typename FirstResult, typename... FirstParams,
+ typename SecondTy, typename SecondResult,
----------------
Given that we've established them to be the same type, why two sets of template arguments?
================
Comment at: clang/include/clang/AST/RecursiveASTVisitor.h:637
case Stmt::CLASS##Class: \
- TRY_TO(WalkUpFrom##CLASS(static_cast<CLASS *>(S))); break;
+ if (isSameMethod(&RecursiveASTVisitor::Traverse##CLASS, \
+ &Derived::Traverse##CLASS)) { \
----------------
Do you explain this logic somewhere? Or do you feel it will be obvious to the reader? (I don't have a good intuition about this class to judge).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D82486/new/
https://reviews.llvm.org/D82486
More information about the cfe-commits
mailing list