[PATCH] D49840: [AST] Add MatchFinder::matchSubtree

Gabor Marton via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 26 02:50:13 PDT 2018


martong created this revision.
martong added reviewers: klimek, aprantl, pcc, sbenza, Prazek, dblaikie, balazske, xazax.hun.
Herald added subscribers: cfe-commits, dkrupp, rnkovacs.

Add matchSubtree, so we can traverse on a subtree rooted on a specific node.

Currently, we can match **one** node against a matcher, but we will not traverse
into the children (this is MatchFinder::match).
Or we can traverse through the whole tree rooted at the TUDecl (this
is MatchFinder::matchAST).
Note, findAll may provide an alternative, but that will traverse throught the
whole AST, and that has some weaknesses:
https://bugs.llvm.org/show_bug.cgi?id=38318


Repository:
  rC Clang

https://reviews.llvm.org/D49840

Files:
  include/clang/ASTMatchers/ASTMatchFinder.h
  lib/ASTMatchers/ASTMatchFinder.cpp
  unittests/ASTMatchers/ASTMatchersInternalTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49840.157442.patch
Type: text/x-patch
Size: 4143 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180726/df467983/attachment.bin>


More information about the cfe-commits mailing list