[PATCH] D68315: [libTooling] Add various Stencil combinators for expressions.

Yitzhak Mandelbaum via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 2 12:23:23 PDT 2019


ymandel marked an inline comment as done.
ymandel added inline comments.


================
Comment at: clang/include/clang/Tooling/Refactoring/Stencil.h:149
 /// \returns the source corresponding to the selected range.
 StencilPart selection(RangeSelector Selector);
 
----------------
gribozavr wrote:
> Should the comment cross-reference expression() and say that the user probably wants that instead?
That depends on what selector they're using. For `selection(node(ExprId))`, yes I think that `expression(ExprId)` is going to be better in most cases. But, for other selectors, no.  So, I'm not sure that the cross-reference will be generally useful.  WDYT?

Also, it occurs to me that we have an asymmetry for statements and expressions. Getting the source of a statement is
`selection(statement(Id))` versus `expression(Id)` for expressions. However, in the context of `cat`, which takes `RangeSelector` directly, they look the same, because `selection` isn't needed.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68315





More information about the cfe-commits mailing list