summaryrefslogtreecommitdiff
path: root/src/lib/eolian_cxx
diff options
context:
space:
mode:
authorFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2017-06-18 11:30:00 -0300
committerFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2017-06-18 11:31:43 -0300
commit0fcee227aa9269b3767d6f6046d4b18389c0533d (patch)
tree0756b0644e8eb7b42bce12748ffbccc83bf24960 /src/lib/eolian_cxx
parent81d01cfbd0e0d1753bc9e00e8fc962e1b5317cf0 (diff)
eolian-cxx: Fix C++ generation errors with handle opaque types
Diffstat (limited to 'src/lib/eolian_cxx')
-rw-r--r--src/lib/eolian_cxx/grammar/klass_def.hpp14
-rw-r--r--src/lib/eolian_cxx/grammar/type_impl.hpp4
2 files changed, 15 insertions, 3 deletions
diff --git a/src/lib/eolian_cxx/grammar/klass_def.hpp b/src/lib/eolian_cxx/grammar/klass_def.hpp
index 9629c70715..583744b503 100644
--- a/src/lib/eolian_cxx/grammar/klass_def.hpp
+++ b/src/lib/eolian_cxx/grammar/klass_def.hpp
@@ -174,6 +174,7 @@ struct regular_type_def
174 std::string base_type; 174 std::string base_type;
175 qualifier_def base_qualifier; 175 qualifier_def base_qualifier;
176 std::vector<std::string> namespaces; 176 std::vector<std::string> namespaces;
177 bool is_undefined = false;
177}; 178};
178 179
179inline bool operator==(regular_type_def const& rhs, regular_type_def const& lhs) 180inline bool operator==(regular_type_def const& rhs, regular_type_def const& lhs)
@@ -253,13 +254,24 @@ inline void type_def::set(Eolian_Type const* eolian_type, Eolian_Unit const* uni
253 break; 254 break;
254 case EOLIAN_TYPE_REGULAR: 255 case EOLIAN_TYPE_REGULAR:
255 { 256 {
257 bool is_undefined = false;
258 Eolian_Typedecl const* decl = eolian_type_typedecl_get(eolian_type);
259 if(decl && eolian_typedecl_type_get(decl) == EOLIAN_TYPEDECL_ALIAS)
260 {
261 Eolian_Type const* aliased = eolian_typedecl_base_type_get(decl);
262 if(aliased && eolian_type_type_get(aliased) == EOLIAN_TYPE_UNDEFINED)
263 {
264 is_undefined = true;
265 }
266 }
267
256 if(c_type == "va_list *") 268 if(c_type == "va_list *")
257 throw std::runtime_error(""); 269 throw std::runtime_error("");
258 std::vector<std::string> namespaces; 270 std::vector<std::string> namespaces;
259 for(efl::eina::iterator<const char> namespace_iterator( ::eolian_type_namespaces_get(eolian_type)) 271 for(efl::eina::iterator<const char> namespace_iterator( ::eolian_type_namespaces_get(eolian_type))
260 , namespace_last; namespace_iterator != namespace_last; ++namespace_iterator) 272 , namespace_last; namespace_iterator != namespace_last; ++namespace_iterator)
261 namespaces.push_back(&*namespace_iterator); 273 namespaces.push_back(&*namespace_iterator);
262 original_type = {regular_type_def{ ::eolian_type_name_get(eolian_type), {qualifiers(eolian_type), {}}, namespaces}}; 274 original_type = {regular_type_def{ ::eolian_type_name_get(eolian_type), {qualifiers(eolian_type), {}}, namespaces, is_undefined}};
263 } 275 }
264 break; 276 break;
265 case EOLIAN_TYPE_CLASS: 277 case EOLIAN_TYPE_CLASS:
diff --git a/src/lib/eolian_cxx/grammar/type_impl.hpp b/src/lib/eolian_cxx/grammar/type_impl.hpp
index a6bd0a9158..38d0bb3bb5 100644
--- a/src/lib/eolian_cxx/grammar/type_impl.hpp
+++ b/src/lib/eolian_cxx/grammar/type_impl.hpp
@@ -132,7 +132,7 @@ struct visitor_generate
132 ( 132 (
133 lit("void") << (regular.base_qualifier & qualifier_info::is_const ? " const" : "") 133 lit("void") << (regular.base_qualifier & qualifier_info::is_const ? " const" : "")
134 << "*" 134 << "*"
135 << (is_out ? "&" : "") 135 << (is_out ? "*" : "")
136 ) 136 )
137 .generate(sink, attributes::unused, *context); 137 .generate(sink, attributes::unused, *context);
138 } 138 }
@@ -220,7 +220,7 @@ struct visitor_generate
220 || (regular.base_qualifier & qualifier_info::is_ref 220 || (regular.base_qualifier & qualifier_info::is_ref
221 && !is_return && !is_out) 221 && !is_return && !is_out)
222 ? " const" : "") 222 ? " const" : "")
223 << (regular.base_qualifier & qualifier_info::is_ref? "&" : "") 223 << (regular.base_qualifier & qualifier_info::is_ref ? (regular.is_undefined ? "*" : "&") : "")
224 ) 224 )
225 .generate(sink, std::make_tuple(regular.namespaces, regular.base_type), *context)) 225 .generate(sink, std::make_tuple(regular.namespaces, regular.base_type), *context))
226 return true; 226 return true;