[clang] [AstMatcher]`templateArgumentCountIs` support `FunctionDecl` (PR #130416)

Congcong Cai via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 10 23:54:18 PDT 2025


https://github.com/HerrCai0907 updated https://github.com/llvm/llvm-project/pull/130416

>From b28bd17fd58c6f41b3d860cb490cdbfeef8b8c3e Mon Sep 17 00:00:00 2001
From: Congcong Cai <congcongcai0907 at 163.com>
Date: Sat, 8 Mar 2025 21:33:02 +0800
Subject: [PATCH] [AstMatcher]`templateArgumentCountIs` support `FunctionDecl`

`hasTemplateArgument` and `templateArgumentCountIs` are always used together. It is more convenient to make then support `FunctionDecl`.
---
 clang/include/clang/ASTMatchers/ASTMatchers.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/clang/include/clang/ASTMatchers/ASTMatchers.h b/clang/include/clang/ASTMatchers/ASTMatchers.h
index 0f7e3a8a01762..03d522072f6c1 100644
--- a/clang/include/clang/ASTMatchers/ASTMatchers.h
+++ b/clang/include/clang/ASTMatchers/ASTMatchers.h
@@ -1090,6 +1090,7 @@ AST_POLYMORPHIC_MATCHER_P2(
 AST_POLYMORPHIC_MATCHER_P(
     templateArgumentCountIs,
     AST_POLYMORPHIC_SUPPORTED_TYPES(ClassTemplateSpecializationDecl,
+                                    VarTemplateSpecializationDecl, FunctionDecl,
                                     TemplateSpecializationType),
     unsigned, N) {
   return internal::getTemplateSpecializationArgs(Node).size() == N;



More information about the cfe-commits mailing list