[PATCH] D90767: Add new matchers for dependent names in templates
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 6 10:20:54 PST 2020
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.
LGTM!
================
Comment at: clang/include/clang/ASTMatchers/ASTMatchers.h:2859
+AST_MATCHER_P(CXXDependentScopeMemberExpr, hasMemberName, std::string, N) {
+ return Node.getMember().getAsString() == N;
+}
----------------
steveire wrote:
> aaron.ballman wrote:
> > steveire wrote:
> > > aaron.ballman wrote:
> > > > This will allow users to match on members that don't have identifiers -- is that intentional? If not, my recommendation is to use something like:
> > > > ```
> > > > if (const IdentifierInfo *II = Node.getMember().getAsIdentifierInfo())
> > > > return II->isStr(N);
> > > > return false;
> > > > ```
> > > > Either way, we should document and test what the expected behavior is for things like constructors/destructors, overloaded operators, and the likes. (But we don't have to test every kind of odd declaration name.)
> > > I was not able to demonstrate the problem with a test: https://godbolt.org/z/3Grd1b
> > >
> > > Can you be more specific?
> > I was thinking of something along these lines: https://godbolt.org/z/K8serj
> Added a test for that.
Thanks!
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D90767/new/
https://reviews.llvm.org/D90767
More information about the cfe-commits
mailing list