[clang] [clang] Add hasAnyNameInVector matcher (PR #139594)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Wed May 14 05:00:09 PDT 2025
AaronBallman wrote:
> > > > Are there any planned in-tree uses for this matcher?
> > >
> > >
> > > I had a downstream use planned. Does this mean I will have to reimplement `internal::HasNameMatcher`?
> >
> >
> > Can you adapt the code to use `hasAnyName()` instead, as that can accept a variadic number of `StringRef` arguments stored in an `ArrayRef`?
>
> The use is for a runtime list of names, so I don't think the variadic would work?
I could be wrong on this, but I think it might actually work to just pass an ArrayRef that's constructed from the vector. `hasAnyName` (https://github.com/llvm/llvm-project/blob/b96c5df04e55396572a7c12cb6505f5a116072cb/clang/include/clang/ASTMatchers/ASTMatchers.h#L3143) uses `internal::hasAnyNameFunc` which has an overload taking an ArrayRef (https://github.com/llvm/llvm-project/blob/b96c5df04e55396572a7c12cb6505f5a116072cb/clang/include/clang/ASTMatchers/ASTMatchersInternal.h#L965).
https://github.com/llvm/llvm-project/pull/139594
More information about the cfe-commits
mailing list