The new overloads apply directly to a node, like the
clang::ast_matchers::match functions, Rather than generating an
EditGenerator combinator.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang/include/clang/Tooling/Transformer/RewriteRule.h | ||
---|---|---|
388 | I agree that these functions provide very useful functionality, however I feel uneasy about putting a function that returns an EditGenerator and a function that actually executes the refactoring into the same overload set. The first is a part of a DSL, the second is a regular function. Do you think this is a problem worth solving? IDK what exactly to suggest though. A namespace for DSL functions like we have in AST matchers? |
Thanks for the review!
clang/include/clang/Tooling/Transformer/RewriteRule.h | ||
---|---|---|
388 | That's a really good point. These new functions are definitely a part of an (implicit) lower-level library that improves manipulation of the AST directly. We don't have any appropriate library yet for this -- SourceCode is in this spirit but even simpler than RewriteRule, which in fact depends on it. For now, I'll put these in the detail which is (in some sense) the collection of low level functions for which we need to solve this same problem. WDYT? (I wasn't quite clear about the comparison with ast matchers, since both the matchers DSL and the match functions (on which this is loosely based) are in the same namespace). |
clang/include/clang/Tooling/Transformer/RewriteRule.h | ||
---|---|---|
388 |
Oh right -- I mistakenly thought that clang::ast_matchers only contains the DSL. I think your choice to put functions into detail looks good. |
I agree that these functions provide very useful functionality, however I feel uneasy about putting a function that returns an EditGenerator and a function that actually executes the refactoring into the same overload set. The first is a part of a DSL, the second is a regular function. Do you think this is a problem worth solving?
IDK what exactly to suggest though. A namespace for DSL functions like we have in AST matchers?