[PATCH] D97784: [ASTMatchers] Always create a "binding" for the node being matched on.

Nathan James via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 2 13:51:08 PST 2021


njames93 created this revision.
njames93 added reviewers: klimek, aaron.ballman, steveire.
njames93 published this revision for review.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Most often when using matchers, there is a need to get the root node that the matcher matched on.
Currently the only way to do this is to manually create a binding the the root matcher, however this has some drawbacks.
It can be prone to typos and there is no universal agreed name to give the root node, so an API that accepts a DynTypedMatcher wont be able to figure out what the root actually is.

By altering the infrastructure to always provide access to the node being matched on, that isn't dependent on names, it can simplify workflow a lot.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D97784

Files:
  clang/include/clang/ASTMatchers/ASTMatchFinder.h
  clang/include/clang/ASTMatchers/ASTMatchers.h
  clang/include/clang/ASTMatchers/ASTMatchersInternal.h
  clang/lib/ASTMatchers/ASTMatchFinder.cpp
  clang/lib/ASTMatchers/ASTMatchersInternal.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97784.327509.patch
Type: text/x-patch
Size: 4033 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210302/4287d8b1/attachment.bin>


More information about the cfe-commits mailing list