From 51096f53f06259cb0a40734a45b74e4462dbdc57 Mon Sep 17 00:00:00 2001 From: Sergey Lyskov <3302736+lyskov@users.noreply.github.com> Date: Mon, 9 Sep 2024 17:11:32 -0600 Subject: [PATCH] add check for copy-contractor skipping request (#306) --- source/class.cpp | 5 ++++- source/function.hpp | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/source/class.cpp b/source/class.cpp index 610e078c..d29935e1 100644 --- a/source/class.cpp +++ b/source/class.cpp @@ -1295,10 +1295,13 @@ void ClassBinder::bind(Context &context) if( t->getAccess() == AS_public and !t->isMoveConstructor() and is_bindable(*t) and !is_skipping_requested(*t, Config::get()) /*and t->doesThisDeclarationHaveABody()*/ ) { ConstructorBindingInfo CBI = {C, *t, trampoline, qualified_name, trampoline_name, context}; - if( t->isCopyConstructor() /*and not copy_constructor_processed*/ ) { + if( t->isCopyConstructor() /*and not copy_constructor_processed*/ and !is_skipping_requested(*t, Config::get() ) ) { // constructors += "\tcl.def(pybind11::init<{} const &>());\n"_format(binding_qualified_name); //(*t) -> dump(); + //constructors += "// CC " + standard_name(t->getQualifiedNameAsString()) + "\n"; + //constructors += "// CC " + function_qualified_name(*t, true) + "\n"; constructors += bind_copy_constructor(CBI); + //constructors += "// CC \n"; // copy_constructor_processed = true; } else if( t->isDefaultConstructor() and t->getNumParams() == 0 ) constructors += bind_default_constructor(CBI); // workaround for Pybind11-2.2 issues diff --git a/source/function.hpp b/source/function.hpp index 15bae4af..6e401443 100644 --- a/source/function.hpp +++ b/source/function.hpp @@ -27,9 +27,11 @@ namespace binder { class Context; + /// Generate function argument list separated by comma std::string function_arguments(clang::FunctionDecl const *record); + /// Generate function argument list separated by comma /// name_arguments - if arguments should be named: a1, a2, ... /// n - number of arguments to generate. If n > num_of_function_parameters - generate only list with num_of_function_parameters