diff options
author | Philip Herron <philip.herron@embecosm.com> | 2021-02-25 17:44:42 +0000 |
---|---|---|
committer | Philip Herron <herron.philip@googlemail.com> | 2021-03-03 22:46:24 +0000 |
commit | a886a9c06ed237a2fa8cff9d708f694066b18e66 (patch) | |
tree | 6805a79a9dbecc5d6975e1ace93a91517beb612e /gcc/rust/rust-gcc.cc | |
parent | e76855ab401d70361cc8c1738d95127b6f45df86 (diff) | |
download | gcc-a886a9c06ed237a2fa8cff9d708f694066b18e66.zip gcc-a886a9c06ed237a2fa8cff9d708f694066b18e66.tar.gz gcc-a886a9c06ed237a2fa8cff9d708f694066b18e66.tar.bz2 |
Add in TyTy support for an initial String Literal
This gives the apropriate reference type over const char *.
Fixes #85
Diffstat (limited to 'gcc/rust/rust-gcc.cc')
-rw-r--r-- | gcc/rust/rust-gcc.cc | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/gcc/rust/rust-gcc.cc b/gcc/rust/rust-gcc.cc index f8033af..9a13332 100644 --- a/gcc/rust/rust-gcc.cc +++ b/gcc/rust/rust-gcc.cc @@ -187,6 +187,8 @@ public: int get_pointer_size (); + Btype *raw_str_type (); + Btype *integer_type (bool, int); Btype *float_type (int); @@ -804,6 +806,14 @@ Gcc_backend::get_pointer_size () } Btype * +Gcc_backend::raw_str_type () +{ + tree char_ptr = build_pointer_type (char_type_node); + tree const_char_type = build_qualified_type (char_ptr, TYPE_QUAL_CONST); + return this->make_type (const_char_type); +} + +Btype * Gcc_backend::integer_type (bool is_unsigned, int bits) { tree type; @@ -1427,8 +1437,7 @@ Bexpression * Gcc_backend::string_constant_expression (const std::string &val) { tree index_type = build_index_type (size_int (val.length ())); - tree const_char_type - = build_qualified_type (unsigned_char_type_node, TYPE_QUAL_CONST); + tree const_char_type = build_qualified_type (char_type_node, TYPE_QUAL_CONST); tree string_type = build_array_type (const_char_type, index_type); TYPE_STRING_FLAG (string_type) = 1; tree string_val = build_string (val.length (), val.data ()); |