[clang] [llvm] [clang] Add hasAdjSubstatements matcher (PR #169965)
Yanzuo Liu via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 28 17:59:20 PST 2025
================
@@ -2283,6 +2283,37 @@ using HasOpNameMatcher =
HasOpNameMatcher hasAnyOperatorNameFunc(ArrayRef<const StringRef *> NameRefs);
+/// Matches nodes of type T (CompoundStmt or StmtExpr) that contain a sequence
+/// of consecutive substatements matching the provided matchers in order.
+///
+/// See \c hasAdjSubstatements() in ASTMatchers.h for details.
+template <typename T, typename ArgT = std::vector<Matcher<Stmt>>>
+class HasAdjSubstatementsMatcher : public MatcherInterface<T> {
+ static_assert(std::is_same<T, CompoundStmt>::value ||
+ std::is_same<T, StmtExpr>::value,
+ "Matcher only supports `CompoundStmt` and `StmtExpr`");
----------------
zwuis wrote:
Can we refer to `AST_POLYMORPHIC_MATCHER`?
https://github.com/llvm/llvm-project/pull/169965
More information about the llvm-commits
mailing list