diff options
Diffstat (limited to 'gcc/rust/rust-gcc.cc')
-rw-r--r-- | gcc/rust/rust-gcc.cc | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/rust/rust-gcc.cc b/gcc/rust/rust-gcc.cc index 748aa5a..6f8dc46 100644 --- a/gcc/rust/rust-gcc.cc +++ b/gcc/rust/rust-gcc.cc @@ -173,6 +173,8 @@ public: Btype *pointer_type (Btype *); + Btype *immutable_type (Btype *); + Btype *function_type (const Btyped_identifier &, const std::vector<Btyped_identifier> &, const std::vector<Btyped_identifier> &, Btype *, @@ -848,6 +850,18 @@ Gcc_backend::pointer_type (Btype *to_type) return this->make_type (type); } +// Get immutable type + +Btype * +Gcc_backend::immutable_type (Btype *base) +{ + tree type_tree = base->get_tree (); + if (type_tree == error_mark_node) + return this->error_type (); + tree constified = build_qualified_type (type_tree, TYPE_QUAL_CONST); + return this->make_type (constified); +} + // Make a function type. Btype * |