[PATCH] D116328: [ast-matchers] Add hasSubstmt() traversal matcher for caseStmt(), defaultStmt()

Richard via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 27 23:21:49 PST 2021


LegalizeAdulthood created this revision.
LegalizeAdulthood added a reviewer: klimek.
LegalizeAdulthood requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Previously if you wanted to match the statement associated with
a case or default block, you had to use hasDescendant.  Review
comments stated that hasDescendant is heavy-handed and that a
more specific narrowing matcher was preferred.  This is that
narrowing matcher.

- Separate matcher definitions with a blank line.
- Add corresponding unit tests for new narrowing matcher.
- Add the new matcher to the Registry
- Add documentation in the AST matchers reference HTML page.
- Remove trailing semi-colon from REGISTER_MATCHER macro to be consistent with the other macro declarations and fix a missing semi-colon in the invocation of the macro.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D116328

Files:
  clang/docs/LibASTMatchersReference.html
  clang/include/clang/ASTMatchers/ASTMatchers.h
  clang/lib/ASTMatchers/Dynamic/Registry.cpp
  clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116328.396374.patch
Type: text/x-patch
Size: 5924 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211228/2a205159/attachment.bin>


More information about the cfe-commits mailing list