[PATCH] D120956: [clang][AST matchers] new AST matcher argumentsGivenCountIs(n) that checks the actual number of arguments given in a function call
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 4 04:42:08 PST 2022
aaron.ballman added a comment.
This seems somewhat more generally applicable as an AST matcher, but I'm still curious what the in-tree use will be for it. (Same suggestion for test coverage and regenerating the documentation as before.)
================
Comment at: clang/include/clang/ASTMatchers/ASTMatchers.h:4452
+/// \endcode
+AST_POLYMORPHIC_MATCHER_P(argumentsGivenCountIs,
+ AST_POLYMORPHIC_SUPPORTED_TYPES(
----------------
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()`.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D120956/new/
https://reviews.llvm.org/D120956
More information about the cfe-commits
mailing list