aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/backend/rust-compile-context.h
diff options
context:
space:
mode:
authorPhilip Herron <philip.herron@embecosm.com>2021-01-13 21:14:28 +0000
committerPhilip Herron <herron.philip@googlemail.com>2021-01-16 14:07:50 +0000
commitd96e1594dd378078987900819afc611bd0db19b0 (patch)
tree7105c8abfaaabe2dbd997aee37e13fe0bed860c4 /gcc/rust/backend/rust-compile-context.h
parent05b9f235566d7d361709c5bc44e7c36598515946 (diff)
downloadgcc-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-context.h')
-rw-r--r--gcc/rust/backend/rust-compile-context.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/rust/backend/rust-compile-context.h b/gcc/rust/backend/rust-compile-context.h
index 298ff50..5a0805b 100644
--- a/gcc/rust/backend/rust-compile-context.h
+++ b/gcc/rust/backend/rust-compile-context.h
@@ -223,8 +223,6 @@ public:
void visit (TyTy::ErrorType &type) override { gcc_unreachable (); }
- void visit (TyTy::UnitType &type) override { gcc_unreachable (); }
-
void visit (TyTy::InferType &type) override { gcc_unreachable (); }
void visit (TyTy::FnType &type) override { gcc_unreachable (); }
@@ -233,6 +231,11 @@ public:
void visit (TyTy::ParamType &type) override { gcc_unreachable (); }
+ void visit (TyTy::UnitType &type) override
+ {
+ translated = ctx->get_backend ()->void_type ();
+ }
+
void visit (TyTy::ADTType &type) override
{
::Btype *compiled_type = nullptr;