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

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 24 10:34:44 PST 2022


sammccall created this revision.
sammccall added reviewers: hokein, davidxl.
Herald added subscribers: wenlei, usaxena95, kadircet, arphaman.
sammccall requested review of this revision.
Herald added projects: clang, clang-tools-extra.
Herald added a subscriber: cfe-commits.

This is consistent with the idea of shouldVisitTemplateInstantiations():
when false, we should traverse the code the user wrote but not the code
clang synthesized. Therefore we should be able to traverse the
signature of the function without traversing its body.
This is also consistent with how class and variable templates behave.

Note that currently RAV does not traverse *any* part of the these when
shouldVisitTemplateInstantiations() is false (which is another bug).
So currently this change is only observable when the user passes the
instantiated FunctionDecl to TraverseDecl themselves.

This is what the caller in CodeGenPGO does, and it wants to traverse the
instantiated body. I believe not traversing instantiations in general in
this context is an oversight.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D120504

Files:
  clang-tools-extra/clangd/unittests/InlayHintTests.cpp
  clang/include/clang/AST/RecursiveASTVisitor.h
  clang/lib/CodeGen/CodeGenPGO.cpp
  clang/unittests/Tooling/RecursiveASTVisitorTests/Templates.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D120504.411178.patch
Type: text/x-patch
Size: 4686 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220224/c59dd794/attachment-0001.bin>


More information about the cfe-commits mailing list