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

Martin Böhme via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 4 08:33:27 PDT 2016


mboehme marked an inline comment as done.

================
Comment at: include/clang/ASTMatchers/ASTMatchers.h:2486
@@ +2485,3 @@
+
+  return (UnderlyingDecl != nullptr &&
+          InnerMatcher.matches(*UnderlyingDecl, Finder, Builder));
----------------
I was trying to match the style of the next matcher below -- or do you think I should establish a precedent / preference for emitting the superfluous parentheses?

================
Comment at: include/clang/ASTMatchers/ASTMatchers.h:2855
@@ +2854,3 @@
+///     bar(t);
+///   }
+/// \endcode
----------------
> The documentation doesn't describe what the matcher does (can you please clarify the docs?).

I've rephrased the description of the matcher -- is it clearer now?

> 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?

As klimek notes, the difference is that hasDeclaration() is currently used only for nodes that have exactly one associated declaration.

My proposal would be to stay with canReferToDecl -- thoughts?


https://reviews.llvm.org/D23004





More information about the cfe-commits mailing list