summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVitor Sousa <vitorsousasilva@gmail.com>2015-06-25 15:58:43 +0100
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2015-06-25 15:58:43 +0100
commit22094b6a275032027f3a3ef84d36ad4ab4c708a2 (patch)
treebb6bb89f577313ebfa16403e6bab684c53950982
parentc709f1dca20b058a9ca76a181add200fe25a8a09 (diff)
eolian_cxx: Fix C++ generated inheritance wrappers
Summary: Fix a bug that happens when a Eolian C++ wrapper have no default constructor (because it have obligatory constructing methods) and it is being used as a return of a inheritance wrappers. Switched to a conversion of the native type as the default return, instead of a value initialized wrapper. Reviewers: q66, felipealmeida Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D2769
-rw-r--r--src/lib/eolian_cxx/grammar/inheritance_base_generator.hh14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/lib/eolian_cxx/grammar/inheritance_base_generator.hh b/src/lib/eolian_cxx/grammar/inheritance_base_generator.hh
index ed993f0fc8..a3918a9ead 100644
--- a/src/lib/eolian_cxx/grammar/inheritance_base_generator.hh
+++ b/src/lib/eolian_cxx/grammar/inheritance_base_generator.hh
@@ -129,26 +129,24 @@ operator<<(std::ostream& out, inheritance_wrappers const& x)
129 << ")" << endl 129 << ")" << endl
130 << "{" << endl; 130 << "{" << endl;
131 131
132 if (!function_is_void(func))
133 out << tab(1) << reinterpret_type(func.ret) << " _tmp_ret{};" << endl;
134
135 out << tab(1) 132 out << tab(1)
136 << "try" << endl 133 << "try" << endl
137 << tab(2) << "{" << endl 134 << tab(2) << "{" << endl
138 << tab(3) 135 << tab(3)
139 << (!function_is_void(func) ? "_tmp_ret = ": "") 136 << (!function_is_void(func) ? "return ": "")
140 << "static_cast<T*>(self->this_)->" 137 << "static_cast<T*>(self->this_)->"
141 << func.name << "(" << parameters_cxx_list(func.params) << ");" << endl 138 << func.name << "(" << parameters_cxx_list(func.params) << ");" << endl
142 << tab(2) << "}" << endl 139 << tab(2) << "}" << endl
143 << tab(1) << "catch (...)" << endl 140 << tab(1) << "catch (...)" << endl
144 << tab(2) << "{" << endl 141 << tab(2) << "{" << endl
145 << tab(3) << "eina_error_set( ::efl::eina::unknown_error() );" << endl 142 << tab(3) << "eina_error_set( ::efl::eina::unknown_error() );" << endl;
146 << tab(2) << "}" << endl;
147 143
148 if (!function_is_void(func)) 144 if (!function_is_void(func))
149 out << tab(1) << "return _tmp_ret;" << endl; 145 out << tab(3) << func.ret.front().native << " _tmp_ret{};" << endl
146 << tab(3) << "return " << to_cxx(func.ret, "_tmp_ret") << ";" << endl;
150 147
151 out << "}" << endl; 148 out << tab(2) << "}" << endl
149 << "}" << endl;
152 150
153 out << scope_guard_tail(x._cls, func) << endl; 151 out << scope_guard_tail(x._cls, func) << endl;
154 } 152 }