aaron.ballman added a comment. In D120956#3384416 <https://reviews.llvm.org/D120956#3384416>, @ajohnson-uoregon wrote:
> When we're doing matcher generation, we aren't able to look up the > FunctionDecl and see if there are defaults (because the function name itself > might be a parameter for us), and even if we could, adding > `cxxDefaultArgExpr()` for all of the missing ones is a lot of work that we'd > rather not do. Thanks, this is pretty compelling rationale for why this is a generally useful matcher. Be sure to also add test coverage for the matcher, as well as regenerate the documentation from `docs/tools/dump_ast_matchers.py`. ================ Comment at: clang/include/clang/ASTMatchers/ASTMatchers.h:4452 +/// \endcode +AST_POLYMORPHIC_MATCHER_P(argumentsGivenCountIs, + AST_POLYMORPHIC_SUPPORTED_TYPES( ---------------- ajohnson-uoregon wrote: > aaron.ballman wrote: > > I have a preference for `argumentCountAsWrittenIs()` -- we often use "as > > written" to distinguish syntax from semantics, and in the case of default > > arguments, the semantics are that the default arguments are treated as if > > they were given at the call site, so I would expect > > `argumentsGivenCountIs(2)` to match both calls to `f()`. > Ah that's a good point, and I like that name much better, I will update that. I'm not 100% sold on the new name being `argumentsGivenCountIs` -- I get where it's coming from, but it feels less grammatical than `argumentCountAsWrittenIs()`. Also, we have an `AsWritten` matcher already (`isVirtualAsWritten()`), but none with `Given`. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D120956/new/ https://reviews.llvm.org/D120956 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits