diff options
author | Felipe Magno de Almeida <felipe@expertisesolutions.com.br> | 2019-07-31 18:26:34 -0300 |
---|---|---|
committer | Felipe Magno de Almeida <felipe@expertisesolutions.com.br> | 2019-07-31 18:38:59 -0300 |
commit | 69975fc72d12dec339f9c0a9b2ce93d34265c599 (patch) | |
tree | 5a83a995d1406ac1165b26fa9739cb507feef7c2 /src/lib | |
parent | dccd68491cd5a3bc8ed3ab925cb36d514025d537 (diff) |
eolian-cxx: Add special type tags to make function_wrapper specializations unique
Reviewers: lauromoura, bu5hm4n, woohyun
Reviewed By: lauromoura
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D9469
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/eolian_cxx/grammar/klass_def.hpp | 2 | ||||
-rw-r--r-- | src/lib/eolian_cxx/grammar/type_function_declaration.hpp | 12 |
2 files changed, 7 insertions, 7 deletions
diff --git a/src/lib/eolian_cxx/grammar/klass_def.hpp b/src/lib/eolian_cxx/grammar/klass_def.hpp index 628e2166c5..c3c524c5b4 100644 --- a/src/lib/eolian_cxx/grammar/klass_def.hpp +++ b/src/lib/eolian_cxx/grammar/klass_def.hpp | |||
@@ -872,7 +872,7 @@ struct function_def | |||
872 | char typenam[2] = { 0, }; | 872 | char typenam[2] = { 0, }; |
873 | typenam[0] = template_typename++; | 873 | typenam[0] = template_typename++; |
874 | std::string statement = "auto fw_" + param.param_name + " = new ::efl::eolian::function_wrapper<"; | 874 | std::string statement = "auto fw_" + param.param_name + " = new ::efl::eolian::function_wrapper<"; |
875 | statement += param.type.c_type + ", " + typenam + ">(" + param.param_name + ");"; | 875 | statement += param.type.c_type + ", " + typenam + ", ::efl::eolian::" + param.type.c_type + "__function_tag>(" + param.param_name + ");"; |
876 | statements.push_back(statement); | 876 | statements.push_back(statement); |
877 | } | 877 | } |
878 | } | 878 | } |
diff --git a/src/lib/eolian_cxx/grammar/type_function_declaration.hpp b/src/lib/eolian_cxx/grammar/type_function_declaration.hpp index 93ebe45940..71ca630f94 100644 --- a/src/lib/eolian_cxx/grammar/type_function_declaration.hpp +++ b/src/lib/eolian_cxx/grammar/type_function_declaration.hpp | |||
@@ -37,9 +37,9 @@ struct type_function_declaration_generator { | |||
37 | 37 | ||
38 | if (!as_generator( | 38 | if (!as_generator( |
39 | "template <typename F>\n" | 39 | "template <typename F>\n" |
40 | "struct function_wrapper<" << string << ", F> {\n" | 40 | "struct function_wrapper<" << string << ", F, struct " << string << "__function_tag> {\n" |
41 | << scope_tab << "function_wrapper(F cxx_func) : _cxx_func(cxx_func) {}\n" | 41 | << scope_tab << "function_wrapper(F cxx_func) : _cxx_func(cxx_func) {}\n" |
42 | ).generate(sink, f.c_name, ctx)) | 42 | ).generate(sink, std::make_tuple(f.c_name, f.c_name), ctx)) |
43 | return false; | 43 | return false; |
44 | 44 | ||
45 | if (!as_generator( | 45 | if (!as_generator( |
@@ -49,9 +49,9 @@ struct type_function_declaration_generator { | |||
49 | << "private:\n" | 49 | << "private:\n" |
50 | << scope_tab << "F _cxx_func;\n" | 50 | << scope_tab << "F _cxx_func;\n" |
51 | << scope_tab << "static void deleter(void *data) {\n" | 51 | << scope_tab << "static void deleter(void *data) {\n" |
52 | << scope_tab << scope_tab << "delete static_cast<function_wrapper<" << string << ", F>*>(data);\n" | 52 | << scope_tab << scope_tab << "delete static_cast<function_wrapper<" << string << ", F, ::efl::eolian::" << string << "__function_tag>*>(data);\n" |
53 | << scope_tab << "}\n" | 53 | << scope_tab << "}\n" |
54 | ).generate(sink, std::make_tuple(f.c_name, f.c_name), ctx)) | 54 | ).generate(sink, std::make_tuple(f.c_name, f.c_name, f.c_name), ctx)) |
55 | return false; | 55 | return false; |
56 | 56 | ||
57 | std::vector<std::string> c_args; | 57 | std::vector<std::string> c_args; |
@@ -61,8 +61,8 @@ struct type_function_declaration_generator { | |||
61 | scope_tab << "static " << string << " caller(void *cxx_call_data" | 61 | scope_tab << "static " << string << " caller(void *cxx_call_data" |
62 | << *(string) << ") {\n" | 62 | << *(string) << ") {\n" |
63 | << scope_tab << scope_tab << "auto fw = static_cast<function_wrapper<" | 63 | << scope_tab << scope_tab << "auto fw = static_cast<function_wrapper<" |
64 | << string << ", F>*>(cxx_call_data);\n" | 64 | << string << ", F, ::efl::eolian::" << string << "__function_tag>*>(cxx_call_data);\n" |
65 | ).generate(sink, std::make_tuple(f.return_type.c_type, c_args, f.c_name), ctx)) | 65 | ).generate(sink, std::make_tuple(f.return_type.c_type, c_args, f.c_name, f.c_name), ctx)) |
66 | return false; | 66 | return false; |
67 | 67 | ||
68 | if (f.return_type != attributes::void_ | 68 | if (f.return_type != attributes::void_ |