aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/rust-gcc.cc
diff options
context:
space:
mode:
authorPhilip Herron <philip.herron@embecosm.com>2021-02-16 15:40:28 +0000
committerPhilip Herron <herron.philip@googlemail.com>2021-03-01 10:35:07 +0000
commit9af2ae0ff91535da104db0d3828d863770439fad (patch)
tree57b375ba818f22c70066c87a4d9c2a1c1b78f69e /gcc/rust/rust-gcc.cc
parent06bb1d6542a9d07f4d866613a5b039be7bcb5f95 (diff)
downloadgcc-9af2ae0ff91535da104db0d3828d863770439fad.zip
gcc-9af2ae0ff91535da104db0d3828d863770439fad.tar.gz
gcc-9af2ae0ff91535da104db0d3828d863770439fad.tar.bz2
Support Generic arguments to Structs
This removes StructFieldType from the TyTy base as it is not a type that can be unified against. It adds in a substition mapper implementation which will likely change over time when this this support is extended over to Functions and TupleStructs. Note generic argument binding is not supported as part of this yet. Fixes #235
Diffstat (limited to 'gcc/rust/rust-gcc.cc')
-rw-r--r--gcc/rust/rust-gcc.cc23
1 files changed, 3 insertions, 20 deletions
diff --git a/gcc/rust/rust-gcc.cc b/gcc/rust/rust-gcc.cc
index 4df813b..7cb24d8 100644
--- a/gcc/rust/rust-gcc.cc
+++ b/gcc/rust/rust-gcc.cc
@@ -1200,27 +1200,10 @@ Gcc_backend::named_type (const std::string &name, Btype *btype,
if (type == error_mark_node)
return this->error_type ();
- // The middle-end expects a basic type to have a name. In Go every
- // basic type will have a name. The first time we see a basic type,
- // give it whatever Go name we have at this point.
- if (TYPE_NAME (type) == NULL_TREE
- && location.gcc_location () == BUILTINS_LOCATION
- && (TREE_CODE (type) == INTEGER_TYPE || TREE_CODE (type) == REAL_TYPE
- || TREE_CODE (type) == COMPLEX_TYPE
- || TREE_CODE (type) == BOOLEAN_TYPE))
- {
- tree decl = build_decl (BUILTINS_LOCATION, TYPE_DECL,
- get_identifier_from_string (name), type);
- TYPE_NAME (type) = decl;
- return this->make_type (type);
- }
-
- tree copy = build_variant_type_copy (type);
tree decl = build_decl (location.gcc_location (), TYPE_DECL,
- get_identifier_from_string (name), copy);
- DECL_ORIGINAL_TYPE (decl) = type;
- TYPE_NAME (copy) = decl;
- return this->make_type (copy);
+ get_identifier_from_string (name), type);
+ TYPE_NAME (type) = decl;
+ return this->make_type (type);
}
// Return a pointer type used as a marker for a circular type.