diff options
author | John Hodge <tpg@mutabah.net> | 2018-06-03 11:02:21 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2018-06-03 11:02:21 +0800 |
commit | 1c25575621e53757234c1033d3e3ccddc5d86aa6 (patch) | |
tree | f352ee32fbea5a47beb0d8353283cf32d890bce3 | |
parent | 6a9a81064ae74b70bc93855ba5a9f39ffc996e1b (diff) | |
download | mrust-1c25575621e53757234c1033d3e3ccddc5d86aa6.tar.gz |
Trans - Fix some minor errors from building with clang
-rw-r--r-- | src/trans/codegen_c.cpp | 6 | ||||
-rw-r--r-- | src/trans/enumerate.cpp | 5 |
2 files changed, 11 insertions, 0 deletions
diff --git a/src/trans/codegen_c.cpp b/src/trans/codegen_c.cpp index f891d267..a4b0387a 100644 --- a/src/trans/codegen_c.cpp +++ b/src/trans/codegen_c.cpp @@ -196,6 +196,7 @@ namespace { } m_options; ::std::vector< ::std::pair< ::HIR::GenericPath, const ::HIR::Struct*> > m_box_glue_todo; + ::std::set< ::HIR::TypeRef> m_emitted_fn_types; public: CodeGenerator_C(const ::HIR::Crate& crate, const ::std::string& outfile): m_crate(crate), @@ -819,6 +820,11 @@ namespace { } void emit_type_fn(const ::HIR::TypeRef& ty) { + if( m_emitted_fn_types.count(ty) ) { + return ; + } + m_emitted_fn_types.insert(ty.clone()); + const auto& te = ty.m_data.as_Function(); m_of << "typedef "; // TODO: ABI marker, need an ABI enum? diff --git a/src/trans/enumerate.cpp b/src/trans/enumerate.cpp index fbf747f8..4e04ddf9 100644 --- a/src/trans/enumerate.cpp +++ b/src/trans/enumerate.cpp @@ -518,6 +518,11 @@ namespace { TU_MATCH_DEF(::HIR::TypeRef::Data, (ty.m_data), (te), ( ), + (Function, + visit_type(*te.m_rettype, Mode::Shallow); + for(const auto& sty : te.m_arg_types) + visit_type(sty, Mode::Shallow); + ), (Pointer, visit_type(*te.inner, Mode::Shallow); ), |