summaryrefslogtreecommitdiff
path: root/src/lib/eolian_cxx
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2017-09-22 17:46:02 +0200
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2017-09-22 17:46:02 +0200
commit4bae2a7385626e649b635dc4577a193a7d49e8e5 (patch)
tree6a69dfbbd10dabeb48c3487e420b83445eeac005 /src/lib/eolian_cxx
parentf36e5bd543a1fed2bc93bc803e326684269e28d0 (diff)
eolian: merge REGULAR and COMPLEX types
Diffstat (limited to 'src/lib/eolian_cxx')
-rw-r--r--src/lib/eolian_cxx/grammar/klass_def.hpp67
1 files changed, 33 insertions, 34 deletions
diff --git a/src/lib/eolian_cxx/grammar/klass_def.hpp b/src/lib/eolian_cxx/grammar/klass_def.hpp
index 8bcbfc6b40..3de453eb87 100644
--- a/src/lib/eolian_cxx/grammar/klass_def.hpp
+++ b/src/lib/eolian_cxx/grammar/klass_def.hpp
@@ -253,33 +253,45 @@ inline void type_def::set(Eolian_Type const* eolian_type, Eolian_Unit const* uni
253{ 253{
254 c_type = ::eolian_type_c_type_get(eolian_type, ctype); 254 c_type = ::eolian_type_c_type_get(eolian_type, ctype);
255 // ::eina_stringshare_del(stringshare); // this crashes 255 // ::eina_stringshare_del(stringshare); // this crashes
256 Eolian_Type const* stp = eolian_type_base_type_get(eolian_type);
256 switch( ::eolian_type_type_get(eolian_type)) 257 switch( ::eolian_type_type_get(eolian_type))
257 { 258 {
258 case EOLIAN_TYPE_VOID: 259 case EOLIAN_TYPE_VOID:
259 original_type = attributes::regular_type_def{"void", {qualifiers(eolian_type), {}}, {}}; 260 original_type = attributes::regular_type_def{"void", {qualifiers(eolian_type), {}}, {}};
260 break; 261 break;
261 case EOLIAN_TYPE_REGULAR: 262 case EOLIAN_TYPE_REGULAR:
262 { 263 if (!stp)
263 bool is_undefined = false; 264 {
264 Eolian_Typedecl const* decl = eolian_type_typedecl_get(eolian_type); 265 bool is_undefined = false;
265 bool is_function_ptr = decl && eolian_typedecl_type_get(decl) == EOLIAN_TYPEDECL_FUNCTION_POINTER; 266 Eolian_Typedecl const* decl = eolian_type_typedecl_get(eolian_type);
266 if(decl && eolian_typedecl_type_get(decl) == EOLIAN_TYPEDECL_ALIAS) 267 bool is_function_ptr = decl && eolian_typedecl_type_get(decl) == EOLIAN_TYPEDECL_FUNCTION_POINTER;
267 { 268 if(decl && eolian_typedecl_type_get(decl) == EOLIAN_TYPEDECL_ALIAS)
268 Eolian_Type const* aliased = eolian_typedecl_base_type_get(decl); 269 {
269 if(aliased && eolian_type_type_get(aliased) == EOLIAN_TYPE_UNDEFINED) 270 Eolian_Type const* aliased = eolian_typedecl_base_type_get(decl);
270 { 271 if(aliased && eolian_type_type_get(aliased) == EOLIAN_TYPE_UNDEFINED)
271 is_undefined = true; 272 {
272 } 273 is_undefined = true;
273 } 274 }
274 275 }
275 if(c_type == "va_list *") 276 if(c_type == "va_list *")
276 throw std::runtime_error(""); 277 throw std::runtime_error("");
277 std::vector<std::string> namespaces; 278 std::vector<std::string> namespaces;
278 for(efl::eina::iterator<const char> namespace_iterator( ::eolian_type_namespaces_get(eolian_type)) 279 for(efl::eina::iterator<const char> namespace_iterator( ::eolian_type_namespaces_get(eolian_type))
279 , namespace_last; namespace_iterator != namespace_last; ++namespace_iterator) 280 , namespace_last; namespace_iterator != namespace_last; ++namespace_iterator)
280 namespaces.push_back(&*namespace_iterator); 281 namespaces.push_back(&*namespace_iterator);
281 original_type = {regular_type_def{ ::eolian_type_name_get(eolian_type), {qualifiers(eolian_type), {}}, namespaces, is_undefined, is_function_ptr}}; 282 original_type = {regular_type_def{ ::eolian_type_name_get(eolian_type), {qualifiers(eolian_type), {}}, namespaces, is_undefined, is_function_ptr}};
282 } 283 }
284 else
285 {
286 complex_type_def complex
287 {{::eolian_type_name_get(eolian_type), {qualifiers(eolian_type), {}}, {}}, {}};
288 while (stp)
289 {
290 complex.subtypes.push_back({stp, unit, EOLIAN_C_TYPE_DEFAULT});
291 stp = eolian_type_next_type_get(stp);
292 }
293 original_type = complex;
294 }
283 break; 295 break;
284 case EOLIAN_TYPE_CLASS: 296 case EOLIAN_TYPE_CLASS:
285 { 297 {
@@ -287,19 +299,6 @@ inline void type_def::set(Eolian_Type const* eolian_type, Eolian_Unit const* uni
287 original_type = klass_name(klass, {qualifiers(eolian_type), {}}); 299 original_type = klass_name(klass, {qualifiers(eolian_type), {}});
288 } 300 }
289 break; 301 break;
290 case EOLIAN_TYPE_COMPLEX:
291 {
292 complex_type_def complex
293 {{::eolian_type_name_get(eolian_type), {qualifiers(eolian_type), {}}, {}}, {}};
294 Eolian_Type const* stp = eolian_type_base_type_get(eolian_type);
295 while (stp)
296 {
297 complex.subtypes.push_back({stp, unit, EOLIAN_C_TYPE_DEFAULT});
298 stp = eolian_type_next_type_get(stp);
299 }
300 original_type = complex;
301 }
302 break;
303 default: 302 default:
304 throw std::runtime_error("Type not supported"); 303 throw std::runtime_error("Type not supported");
305 break; 304 break;