ymandel added a comment.

In D61335#1489680 <https://reviews.llvm.org/D61335#1489680>, @ilya-biryukov 
wrote:

> > As for naming, agreed, but does that concern drop away once we have only a 
> > single RewriteRule definition?
>
> Sure, that won't be an issue.
>
> The use-cases make sense, thanks for the examples. Could you add one or two 
> to the code? Would probably make sense to express them in code as matchers, 
> rather than explaining what we're trying to do in a natural language.


Sounds good, will do.

> Let's proceed with making `RewriteRule` the vocabulary type that we use for 
> transformations like this if we both agree that's a good idea.
>  There are obviously multiple ways to tackle this, which one you had in mind?

Something like this, although if you have a better name than `RewriteAction` 
I'm open to alternatives. e.g. `RewriteCase`?

  struct RewriteAction {
    SmallVector<ASTEdit, 1> Edits;
    TextGenerator Explanation;
  };
  
  struct RewriteRule {
    ast_matchers::internal::DynTypedMatcher Matcher;
    std::vector<RewriteAction> Actions;
    static constexpr llvm::StringLiteral RootId = "___root___";
  };

Or, nest the definition:

  struct RewriteRule {
    struct Action {
      SmallVector<ASTEdit, 1> Edits;
      TextGenerator Explanation;
    };
  
    ast_matchers::internal::DynTypedMatcher Matcher;
    std::vector<Action> Actions;
  
    static constexpr llvm::StringLiteral RootId = "___root___";
  };


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D61335



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to