[PATCH] D120504: [AST] RAV doesn't traverse explicitly instantiated function bodies by default

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 25 01:22:02 PST 2022


hokein added inline comments.


================
Comment at: clang/unittests/Tooling/RecursiveASTVisitorTests/Templates.cpp:168
     extern template int foo<3>();
     // Explicit instantiation. Head traversed, body only with instantiations on.
     template int foo<4>();
----------------
What does the Head mean? 


================
Comment at: clang/unittests/Tooling/RecursiveASTVisitorTests/Templates.cpp:209
   Visitor.Instantiations = false;
   Visitor.ChooseTraversalRoot = [](ASTContext &Ctx) -> Decl * {
     for (auto *D : Ctx.getTranslationUnitDecl()->decls()) {
----------------
There are many declaration in the testcode, hard to figure out which one we are chosen, can you add a comment about which declaration is chosen as the traversal root? I think it is function decl instantiated by the `template int foo<4>();`?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D120504/new/

https://reviews.llvm.org/D120504



More information about the cfe-commits mailing list