From 5d342c24635a09502c9baf1e8a34b21be13fa7fb Mon Sep 17 00:00:00 2001 From: Emery Conrad Date: Thu, 30 Jul 2026 16:16:24 -0500 Subject: [PATCH 1/5] Add template parameter introspection The API could report a specialisation's template arguments but not the parameters a template declares, which a caller mirroring a declaration needs: the parameter's name, whether it stands for a type, a value or a template, and its default if it has one. GetNumTemplateParameters and GetTemplateParameter accept either the template or the class or function it describes, so a caller that walked to a CXXRecordDecl does not have to find the ClassTemplateDecl first. Parameters come back as declarations, so the ordinary name accessors apply to them. --- include/CppInterOp/CppInterOpTypes.h | 11 +++ lib/CppInterOp/CppInterOp.cpp | 75 ++++++++++++++++++++ lib/CppInterOp/CppInterOp.td | 41 +++++++++++ lib/CppInterOp/CppInterOpAPI.td | 3 + unittests/CppInterOp/ScopeReflectionTest.cpp | 59 +++++++++++++++ 5 files changed, 189 insertions(+) diff --git a/include/CppInterOp/CppInterOpTypes.h b/include/CppInterOp/CppInterOpTypes.h index 4a2f72e61..475350594 100644 --- a/include/CppInterOp/CppInterOpTypes.h +++ b/include/CppInterOp/CppInterOpTypes.h @@ -342,6 +342,17 @@ enum QualKind : unsigned char { All = Const | Volatile | Restrict }; +/// What a template parameter stands for. +enum class TemplateParamKind : unsigned char { + Unknown, + /// A type parameter: template . + Type, + /// A value parameter: template . + NonType, + /// A template parameter: template