aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/backend/rust-compile-expr.h
diff options
context:
space:
mode:
authorPhilip Herron <philip.herron@embecosm.com>2021-02-11 15:04:26 +0000
committerPhilip Herron <herron.philip@googlemail.com>2021-02-13 09:54:47 +0000
commit3ae8d55860cbe95f80d5e5c76ca71883dbde0e10 (patch)
tree3fc0385c18fe11a4ceb8ae34ad3c208f027efebb /gcc/rust/backend/rust-compile-expr.h
parentfac8276f737351afbde34a85f2b6c224b400313b (diff)
downloadgcc-3ae8d55860cbe95f80d5e5c76ca71883dbde0e10.zip
gcc-3ae8d55860cbe95f80d5e5c76ca71883dbde0e10.tar.gz
gcc-3ae8d55860cbe95f80d5e5c76ca71883dbde0e10.tar.bz2
Add char type
This might need changes in the Lexer to allow for wchar_t to be preserved. Addresses #85
Diffstat (limited to 'gcc/rust/backend/rust-compile-expr.h')
-rw-r--r--gcc/rust/backend/rust-compile-expr.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/rust/backend/rust-compile-expr.h b/gcc/rust/backend/rust-compile-expr.h
index 1e4aef6..c63479c 100644
--- a/gcc/rust/backend/rust-compile-expr.h
+++ b/gcc/rust/backend/rust-compile-expr.h
@@ -218,6 +218,13 @@ public:
}
return;
+ case HIR::Literal::CHAR: {
+ // FIXME needs wchar_t
+ char c = literal_value->as_string ().c_str ()[0];
+ translated = ctx->get_backend ()->wchar_constant_expression (c);
+ }
+ return;
+
default:
rust_fatal_error (expr.get_locus (), "unknown literal");
return;