summaryrefslogtreecommitdiff
path: root/src/lib/eolian_cxx/grammar/klass_def.hpp
diff options
context:
space:
mode:
authorLauro Moura <lauromoura@expertisesolutions.com.br>2019-09-05 20:04:34 +0200
committerDaniel Kolesa <d.kolesa@samsung.com>2019-09-05 20:05:19 +0200
commit1e855482140647d741129377d82b4d5179909000 (patch)
tree2d46e534230606eb15c67bd504abba920227f44a /src/lib/eolian_cxx/grammar/klass_def.hpp
parent2225e05f78cc3f110334efc3d3c494094d7959cf (diff)
eolian_cxx: Replace type_is_owned with is_move
Summary: is_owned is being replaced with the is_move family of functions. This commit changes only the libeolian usage inside libeolian_cxx, keeping the has_own naming in the generators for a simpler patch during this freeze period. Fixes T8199 Reviewers: q66, felipealmeida Reviewed By: q66 Subscribers: cedric, #reviewers, brunobelo, #committers Tags: #efl Maniphest Tasks: T8199 Differential Revision: https://phab.enlightenment.org/D9843
Diffstat (limited to '')
-rw-r--r--src/lib/eolian_cxx/grammar/klass_def.hpp31
1 files changed, 19 insertions, 12 deletions
diff --git a/src/lib/eolian_cxx/grammar/klass_def.hpp b/src/lib/eolian_cxx/grammar/klass_def.hpp
index b451ed2d6b..47afbfedb8 100644
--- a/src/lib/eolian_cxx/grammar/klass_def.hpp
+++ b/src/lib/eolian_cxx/grammar/klass_def.hpp
@@ -366,6 +366,12 @@ inline bool operator!=(complex_type_def const& lhs, complex_type_def const& rhs)
366 return !(lhs == rhs); 366 return !(lhs == rhs);
367} 367}
368 368
369namespace value_ownership
370{
371 const bool moved = true;
372 const bool unmoved = false;
373};
374
369// type_def represents a type where it is used, like a method parameter or a struc field, in contrast to more 375// type_def represents a type where it is used, like a method parameter or a struc field, in contrast to more
370// specifict types like struct_def, class_def, function_def, which represents a declaration of a type. 376// specifict types like struct_def, class_def, function_def, which represents a declaration of a type.
371struct type_def 377struct type_def
@@ -383,11 +389,11 @@ struct type_def
383 type_def(variant_type original_type, std::string c_type, bool has_own, bool is_ptr, bool is_beta, std::string doc_summary) 389 type_def(variant_type original_type, std::string c_type, bool has_own, bool is_ptr, bool is_beta, std::string doc_summary)
384 : original_type(original_type), c_type(c_type), has_own(has_own), is_ptr(is_ptr), is_beta(is_beta), doc_summary(doc_summary) {} 390 : original_type(original_type), c_type(c_type), has_own(has_own), is_ptr(is_ptr), is_beta(is_beta), doc_summary(doc_summary) {}
385 391
386 type_def(Eolian_Type const* eolian_type, Eolian_Unit const* unit, Eolian_C_Type_Type ctype) 392 type_def(Eolian_Type const* eolian_type, Eolian_Unit const* unit, Eolian_C_Type_Type ctype, bool is_moved)
387 { 393 {
388 set(eolian_type, unit, ctype); 394 set(eolian_type, unit, ctype, is_moved);
389 } 395 }
390 void set(Eolian_Type const* eolian_type, Eolian_Unit const* unit, Eolian_C_Type_Type ctype); 396 void set(Eolian_Type const* eolian_type, Eolian_Unit const* unit, Eolian_C_Type_Type ctype, bool is_moved);
391 void set(Eolian_Expression_Type eolian_exp_type); 397 void set(Eolian_Expression_Type eolian_exp_type);
392 398
393 friend inline bool operator<(type_def const& lhs, type_def const& rhs) 399 friend inline bool operator<(type_def const& lhs, type_def const& rhs)
@@ -427,13 +433,13 @@ inline bool operator!=(type_def const& lhs, type_def const& rhs)
427 433
428type_def const void_ {attributes::regular_type_def{"void", {qualifier_info::is_none, {}}, {}}, "void", false, false, false, ""}; 434type_def const void_ {attributes::regular_type_def{"void", {qualifier_info::is_none, {}}, {}}, "void", false, false, false, ""};
429 435
430inline void type_def::set(Eolian_Type const* eolian_type, Eolian_Unit const* unit, Eolian_C_Type_Type ctype) 436inline void type_def::set(Eolian_Type const* eolian_type, Eolian_Unit const* unit, Eolian_C_Type_Type ctype, bool is_moved)
431{ 437{
432 c_type = ::eolian_type_c_type_get(eolian_type, ctype); 438 c_type = ::eolian_type_c_type_get(eolian_type, ctype);
433 is_value_type = ('*' != c_type.back()); 439 is_value_type = ('*' != c_type.back());
434 // ::eina_stringshare_del(stringshare); // this crashes 440 // ::eina_stringshare_del(stringshare); // this crashes
435 Eolian_Type const* stp = eolian_type_base_type_get(eolian_type); 441 Eolian_Type const* stp = eolian_type_base_type_get(eolian_type);
436 has_own = !!::eolian_type_is_owned(eolian_type); 442 has_own = is_moved;
437 is_ptr = !!::eolian_type_is_ptr(eolian_type); 443 is_ptr = !!::eolian_type_is_ptr(eolian_type);
438 444
439 Eolian_Typedecl const* decl = eolian_type_typedecl_get(eolian_type); 445 Eolian_Typedecl const* decl = eolian_type_typedecl_get(eolian_type);
@@ -476,7 +482,7 @@ inline void type_def::set(Eolian_Type const* eolian_type, Eolian_Unit const* uni
476 {{::eolian_type_short_name_get(eolian_type), {qualifiers(eolian_type), {}}, {}}, {}}; 482 {{::eolian_type_short_name_get(eolian_type), {qualifiers(eolian_type), {}}, {}}, {}};
477 while (stp) 483 while (stp)
478 { 484 {
479 complex.subtypes.push_back({stp, unit, EOLIAN_C_TYPE_DEFAULT}); 485 complex.subtypes.push_back({stp, unit, EOLIAN_C_TYPE_DEFAULT, eolian_type_is_move(stp)});
480 stp = eolian_type_next_type_get(stp); 486 stp = eolian_type_next_type_get(stp);
481 } 487 }
482 original_type = complex; 488 original_type = complex;
@@ -534,7 +540,7 @@ struct alias_def
534 is_undefined = true; 540 is_undefined = true;
535 else 541 else
536 { 542 {
537 base_type = type_def(::eolian_typedecl_base_type_get(alias_obj), unit, EOLIAN_C_TYPE_DEFAULT); 543 base_type = type_def(::eolian_typedecl_base_type_get(alias_obj), unit, EOLIAN_C_TYPE_DEFAULT, value_ownership::unmoved);
538 is_undefined = false; 544 is_undefined = false;
539 } 545 }
540 546
@@ -587,7 +593,7 @@ struct parameter_def
587 documentation_def documentation, Eolian_Unit const* unit) 593 documentation_def documentation, Eolian_Unit const* unit)
588 : direction(std::move(direction)), type(std::move(type)), param_name(std::move(param_name)), documentation(documentation), unit(unit) {} 594 : direction(std::move(direction)), type(std::move(type)), param_name(std::move(param_name)), documentation(documentation), unit(unit) {}
589 parameter_def(Eolian_Function_Parameter const* param, Eolian_Unit const* unit) 595 parameter_def(Eolian_Function_Parameter const* param, Eolian_Unit const* unit)
590 : type( ::eolian_parameter_type_get(param), unit, EOLIAN_C_TYPE_PARAM) 596 : type( ::eolian_parameter_type_get(param), unit, EOLIAN_C_TYPE_PARAM, eolian_parameter_is_move(param))
591 , param_name( ::eolian_parameter_name_get(param)), unit(unit) 597 , param_name( ::eolian_parameter_name_get(param)), unit(unit)
592 { 598 {
593 Eolian_Parameter_Dir direction = ::eolian_parameter_direction_get(param); 599 Eolian_Parameter_Dir direction = ::eolian_parameter_direction_get(param);
@@ -741,7 +747,7 @@ struct function_def
741 return_documentation = eolian_function_return_documentation_get(function, type); 747 return_documentation = eolian_function_return_documentation_get(function, type);
742 scope = static_cast<member_scope>(eolian_function_scope_get(function, type)); 748 scope = static_cast<member_scope>(eolian_function_scope_get(function, type));
743 if(r_type) 749 if(r_type)
744 return_type.set(r_type, unit, EOLIAN_C_TYPE_RETURN); 750 return_type.set(r_type, unit, EOLIAN_C_TYPE_RETURN, eolian_function_return_is_move(function, type));
745 if(type == EOLIAN_METHOD || type == EOLIAN_FUNCTION_POINTER) 751 if(type == EOLIAN_METHOD || type == EOLIAN_FUNCTION_POINTER)
746 { 752 {
747 for(efl::eina::iterator<Eolian_Function_Parameter> param_iterator ( ::eolian_function_parameters_get(function)) 753 for(efl::eina::iterator<Eolian_Function_Parameter> param_iterator ( ::eolian_function_parameters_get(function))
@@ -997,7 +1003,7 @@ struct variable_def
997 variable_def(Eolian_Variable const* variable, Eolian_Unit const* unit) 1003 variable_def(Eolian_Variable const* variable, Eolian_Unit const* unit)
998 : name(::eolian_variable_short_name_get(variable)) 1004 : name(::eolian_variable_short_name_get(variable))
999 , full_name(::eolian_variable_name_get(variable)) 1005 , full_name(::eolian_variable_name_get(variable))
1000 , base_type(::eolian_variable_base_type_get(variable), unit, ::EOLIAN_C_TYPE_DEFAULT) 1006 , base_type(::eolian_variable_base_type_get(variable), unit, ::EOLIAN_C_TYPE_DEFAULT, value_ownership::unmoved)
1001 , documentation(::eolian_variable_documentation_get(variable)) 1007 , documentation(::eolian_variable_documentation_get(variable))
1002 , type(static_cast<variable_type>(::eolian_variable_type_get(variable))) 1008 , type(static_cast<variable_type>(::eolian_variable_type_get(variable)))
1003 , expression_value() 1009 , expression_value()
@@ -1081,7 +1087,7 @@ struct event_def
1081 1087
1082 event_def(Eolian_Event const* event, Eolian_Class const* cls, Eolian_Unit const* unit) 1088 event_def(Eolian_Event const* event, Eolian_Class const* cls, Eolian_Unit const* unit)
1083 : klass(cls, {attributes::qualifier_info::is_none, std::string()}) 1089 : klass(cls, {attributes::qualifier_info::is_none, std::string()})
1084 , type( ::eolian_event_type_get(event) ? eina::optional<type_def>{{::eolian_event_type_get(event), unit, EOLIAN_C_TYPE_DEFAULT}} : eina::optional<type_def>{}) 1090 , type( ::eolian_event_type_get(event) ? eina::optional<type_def>{{::eolian_event_type_get(event), unit, EOLIAN_C_TYPE_DEFAULT, value_ownership::unmoved}} : eina::optional<type_def>{})
1085 , name( ::eolian_event_name_get(event)) 1091 , name( ::eolian_event_name_get(event))
1086 , c_name( ::eolian_event_c_macro_get(event)) 1092 , c_name( ::eolian_event_c_macro_get(event))
1087 , beta( ::eolian_event_is_beta(event)) 1093 , beta( ::eolian_event_is_beta(event))
@@ -1546,7 +1552,8 @@ struct struct_field_def
1546 { 1552 {
1547 name = eolian_typedecl_struct_field_name_get(struct_field); 1553 name = eolian_typedecl_struct_field_name_get(struct_field);
1548 try { 1554 try {
1549 type.set(eolian_typedecl_struct_field_type_get(struct_field), unit, EOLIAN_C_TYPE_DEFAULT); 1555 type.set(eolian_typedecl_struct_field_type_get(struct_field), unit, EOLIAN_C_TYPE_DEFAULT
1556 , eolian_typedecl_struct_field_is_move(struct_field));
1550 } catch(std::runtime_error const&) { /* Silently skip pointer fields*/ } 1557 } catch(std::runtime_error const&) { /* Silently skip pointer fields*/ }
1551 documentation = ::eolian_typedecl_struct_field_documentation_get(struct_field); 1558 documentation = ::eolian_typedecl_struct_field_documentation_get(struct_field);
1552 } 1559 }