[PATCH] D23004: [ASTMatchers] Add matchers canReferToDecl() and hasUnderlyingDecl()

Manuel Klimek via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 4 07:52:11 PDT 2016


klimek added inline comments.

================
Comment at: include/clang/ASTMatchers/ASTMatchers.h:2809
@@ +2808,3 @@
+///   matches \c foo in \c foo(t);
+AST_MATCHER_P(OverloadExpr, canReferToDecl, internal::Matcher<Decl>,
+              InnerMatcher) {
----------------
aaron.ballman wrote:
> I find the name of this matcher a little bit confusing. The documentation doesn't describe what the matcher does (can you please clarify the docs?). The implementation suggests that this is looking to see if the given decl exists in the overload expression set, which makes me wonder why this isn't implemented on the `hasDeclaration()` traversal matcher rather than adding a new matcher name?
I don't like hasDeclaration, as that's so far used when there is exactly one.  Something like hasAnyDeclaration might also fit, but I think canReferToDecl makes it clear that there is not yet a specific decl, but a couple of candidates we'll want to select from.


https://reviews.llvm.org/D23004





More information about the cfe-commits mailing list