[PATCH] D80961: WIP: Ignore template instantiations if not in AsIs mode
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 5 06:34:17 PDT 2020
aaron.ballman added a comment.
In D80961#2073049 <https://reviews.llvm.org/D80961#2073049>, @klimek wrote:
> Without jumping into the discussion whether it should be the default, I think we should be able to control template instantiation visitation separately from other implicit nodes.
> Having to put AsIs on a matcher every time you need to match template instantiations is a rather big change (suddenly you have to change all the matchers you've written so far).
I think that's the intended meaning of `AsIs` though. Template instantiations are not source code the user wrote, they're source code the compiler stamped out from code the user wrote. I hope `IgnoreUnlessSpelledInSource` isn't a misnomer.
> I love the idea of being able to control visitation of template instantiation.
> I am somewhat torn on whether it should be the default, and would like to see more data.
> I feel more strongly about needing AsIs when I want to match template instantiations.
FWIW, my experience in clang-tidy has been that template instantiations are ignored far more often than they're desired. In fact, instantiations tend to be a source of bugs for us because they're easy to forget about when writing matchers without keeping templates in mind. The times when template instantiations become important to *not* ignore within the checks is when the check is specific to template behavior, but that's a minority of the public checks thus far.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D80961/new/
https://reviews.llvm.org/D80961
More information about the cfe-commits
mailing list