[clang] [ASTMatchers] Extend hasName matcher when matching templates (PR #100349)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 25 06:49:18 PDT 2024


AaronBallman wrote:

> > > @AaronBallman That's a good point, I didn't account for how defaulted template arguments aren't printed. Would using `<*>` ~or a more rustic approach of `<_>`~ be a good alternative?
> > 
> > 
> > I was thinking about that, but I keep coming around to wondering whether it might make sense to support a regex there instead of a custom syntax. That seems like it gives users a bit more power without requiring them to write additional matchers, but perhaps that's a bad idea for performance reasons...
> 
> We already have a `matchesName` matcher that would be able to handle any case you want to throw at it, but there is definitely some performance concerns with it. This is here to simply the basic case where you just want to match any template which should be helpful for most cases.

Okay, that's a good point! Hmm, then yeah, I think `*` makes sense as a glob; `_` is a loaded term because of https://wg21.link/P2169

https://github.com/llvm/llvm-project/pull/100349


More information about the cfe-commits mailing list