From 0b39af57e37b47de510e4930c41445557739c3c8 Mon Sep 17 00:00:00 2001 From: mappu Date: Fri, 7 Feb 2025 18:55:01 +1300 Subject: [PATCH] genbindings: add new AllowCtor framework --- cmd/genbindings/clang2il.go | 4 ++++ cmd/genbindings/config-allowlist.go | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/cmd/genbindings/clang2il.go b/cmd/genbindings/clang2il.go index b6197809..1cd425fc 100644 --- a/cmd/genbindings/clang2il.go +++ b/cmd/genbindings/clang2il.go @@ -394,6 +394,10 @@ nextMethod: // an existing class instance mm.IsStatic = true + if !AllowCtor(ret.ClassName, mm) { + continue + } + ret.Ctors = append(ret.Ctors, mm) case "CXXDestructorDecl": diff --git a/cmd/genbindings/config-allowlist.go b/cmd/genbindings/config-allowlist.go index c39ff30b..4f65ab0a 100644 --- a/cmd/genbindings/config-allowlist.go +++ b/cmd/genbindings/config-allowlist.go @@ -321,6 +321,12 @@ func AllowMethod(className string, mm CppMethod) error { return nil // OK, allow } +func AllowCtor(className string, mm CppMethod) bool { + + // Default allow + return true +} + // AllowType controls whether to permit binding of a method, if a method uses // this type in its parameter list or return type. // Any type not permitted by AllowClass is also not permitted by this method.