[PATCH] D27104: Unify and simplify the behavior of the hasDeclaration matcher.

Manuel Klimek via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 24 07:24:13 PST 2016


klimek created this revision.
klimek added reviewers: rsmith, lukasza.
klimek added a subscriber: cfe-commits.

Originally, we weren't able to match on Type nodes themselves (only QualType),
so the hasDeclaration matcher was initially written to give what we thought are
reasonable results for QualType matches.

When we chagned the matchers to allow matching on Type nodes, it turned out
that the hasDeclaration matcher was by chance written templated enough to now
allow hasDeclaration to also match on (some) Type nodes.

This patch change the hasDeclaration matcher to:
a) work the same on Type and QualType nodes,
b) be completely explicit about what nodes we can match instead of just allowing

  anything with a getDecl() to match,

c) explicitly control desugaring only one level in very specific instances.


https://reviews.llvm.org/D27104

Files:
  include/clang/ASTMatchers/ASTMatchersInternal.h
  unittests/ASTMatchers/ASTMatchersTraversalTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27104.79236.patch
Type: text/x-patch
Size: 7458 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161124/c5226a54/attachment-0001.bin>


More information about the cfe-commits mailing list