eolian-cxx: Add special type tags to make function_wrapper specializations unique
authorFelipe Magno de Almeida <felipe@expertisesolutions.com.br>
Wed, 31 Jul 2019 21:26:34 +0000 (18:26 -0300)
committerWooHyun Jung <wh0705.jung@samsung.com>
Mon, 5 Aug 2019 02:19:58 +0000 (11:19 +0900)
Reviewers: lauromoura, bu5hm4n, woohyun

Reviewed By: lauromoura

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D9469

src/lib/eolian_cxx/grammar/klass_def.hpp
src/lib/eolian_cxx/grammar/type_function_declaration.hpp

index 628e216..c3c524c 100644 (file)
@@ -872,7 +872,7 @@ struct function_def
                char typenam[2] = { 0, };
                typenam[0] = template_typename++;
                std::string statement = "auto fw_" + param.param_name + " = new ::efl::eolian::function_wrapper<";
-               statement += param.type.c_type + ", " + typenam + ">(" + param.param_name + ");";
+               statement += param.type.c_type + ", " + typenam + ", ::efl::eolian::" + param.type.c_type + "__function_tag>(" + param.param_name + ");";
                statements.push_back(statement);
             }
        }
index 93ebe45..71ca630 100644 (file)
@@ -37,9 +37,9 @@ struct type_function_declaration_generator {
 
       if (!as_generator(
              "template <typename F>\n"
-             "struct function_wrapper<" << string << ", F> {\n"
+             "struct function_wrapper<" << string << ", F, struct " << string << "__function_tag> {\n"
              << scope_tab << "function_wrapper(F cxx_func) : _cxx_func(cxx_func) {}\n"
-             ).generate(sink, f.c_name, ctx))
+             ).generate(sink, std::make_tuple(f.c_name, f.c_name), ctx))
         return false;
 
       if (!as_generator(
@@ -49,9 +49,9 @@ struct type_function_declaration_generator {
              << "private:\n"
              << scope_tab << "F _cxx_func;\n"
              << scope_tab << "static void deleter(void *data) {\n"
-             << scope_tab << scope_tab << "delete static_cast<function_wrapper<" << string << ", F>*>(data);\n"
+             << scope_tab << scope_tab << "delete static_cast<function_wrapper<" << string << ", F, ::efl::eolian::" << string << "__function_tag>*>(data);\n"
              << scope_tab << "}\n"
-             ).generate(sink, std::make_tuple(f.c_name, f.c_name), ctx))
+             ).generate(sink, std::make_tuple(f.c_name, f.c_name, f.c_name), ctx))
         return false;
 
       std::vector<std::string> c_args;
@@ -61,8 +61,8 @@ struct type_function_declaration_generator {
              scope_tab << "static " << string << " caller(void *cxx_call_data"
              << *(string) << ") {\n"
              << scope_tab << scope_tab << "auto fw = static_cast<function_wrapper<"
-             << string << ", F>*>(cxx_call_data);\n"
-             ).generate(sink, std::make_tuple(f.return_type.c_type, c_args, f.c_name), ctx))
+             << string << ", F, ::efl::eolian::" << string << "__function_tag>*>(cxx_call_data);\n"
+             ).generate(sink, std::make_tuple(f.return_type.c_type, c_args, f.c_name, f.c_name), ctx))
         return false;
 
       if (f.return_type != attributes::void_