diff options
author | Philip Herron <philip.herron@embecosm.com> | 2021-01-13 21:14:28 +0000 |
---|---|---|
committer | Philip Herron <herron.philip@googlemail.com> | 2021-01-16 14:07:50 +0000 |
commit | d96e1594dd378078987900819afc611bd0db19b0 (patch) | |
tree | 7105c8abfaaabe2dbd997aee37e13fe0bed860c4 /gcc/rust/backend/rust-compile-expr.h | |
parent | 05b9f235566d7d361709c5bc44e7c36598515946 (diff) | |
download | gcc-d96e1594dd378078987900819afc611bd0db19b0.zip gcc-d96e1594dd378078987900819afc611bd0db19b0.tar.gz gcc-d96e1594dd378078987900819afc611bd0db19b0.tar.bz2 |
This brings in resolution and type checking of the unit-type.
It is possible to assign and declare variables of unit-type which
translate down to zero sized void_type_node.
More work is needed to handle array and ADT types using unit-type
when emiting gimple. The name+type resolution should be generic enough.
Diffstat (limited to 'gcc/rust/backend/rust-compile-expr.h')
-rw-r--r-- | gcc/rust/backend/rust-compile-expr.h | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/gcc/rust/backend/rust-compile-expr.h b/gcc/rust/backend/rust-compile-expr.h index 0370129..d38ef04 100644 --- a/gcc/rust/backend/rust-compile-expr.h +++ b/gcc/rust/backend/rust-compile-expr.h @@ -38,7 +38,16 @@ public: return compiler.translated; } - virtual ~CompileExpr () {} + void visit (HIR::TupleExpr &expr) + { + if (expr.is_unit ()) + { + translated = ctx->get_backend ()->unit_expression (); + return; + } + + gcc_unreachable (); + } void visit (HIR::ReturnExpr &expr) { @@ -85,10 +94,6 @@ public: return; } - printf ("have ast node id %u ref %u for expr [%s]\n", - expr.get_mappings ().get_nodeid (), ref_node_id, - expr.as_string ().c_str ()); - // these ref_node_ids will resolve to a pattern declaration but we are // interested in the definition that this refers to get the parent id Resolver::Definition def; |