[PATCH] D90767: Add new matchers for dependent names in templates

Stephen Kelly via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 5 15:14:02 PST 2020


steveire added inline comments.


================
Comment at: clang/include/clang/ASTMatchers/ASTMatchers.h:2859
+AST_MATCHER_P(CXXDependentScopeMemberExpr, hasMemberName, std::string, N) {
+  return Node.getMember().getAsString() == N;
+}
----------------
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?


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