aboutsummaryrefslogtreecommitdiff
path: root/gcc/go
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2011-12-28 00:06:10 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2011-12-28 00:06:10 +0000
commit11304b7b99e4c8bf1d47dfc8c125ae18ec6a5044 (patch)
tree6a2286c64c271e38bc044f984d6565492984123c /gcc/go
parentdd8d9bff4599af02fdff1686728e3579124359c4 (diff)
downloadgcc-11304b7b99e4c8bf1d47dfc8c125ae18ec6a5044.zip
gcc-11304b7b99e4c8bf1d47dfc8c125ae18ec6a5044.tar.gz
gcc-11304b7b99e4c8bf1d47dfc8c125ae18ec6a5044.tar.bz2
go-gcc.cc (Gcc_backend::set_placeholder_struct_type): Use build_distinct_type_copy rather than build_variant_type_copy.
* go-gcc.cc (Gcc_backend::set_placeholder_struct_type): Use build_distinct_type_copy rather than build_variant_type_copy. (Gcc_backend::set_placeholder_array_type): Likewise. (Gcc_backend::named_type): Add special handling for builtin basic types. From-SVN: r182698
Diffstat (limited to 'gcc/go')
-rw-r--r--gcc/go/ChangeLog18
-rw-r--r--gcc/go/go-gcc.cc22
2 files changed, 33 insertions, 7 deletions
diff --git a/gcc/go/ChangeLog b/gcc/go/ChangeLog
index fcd137b..c3b03e9 100644
--- a/gcc/go/ChangeLog
+++ b/gcc/go/ChangeLog
@@ -1,10 +1,18 @@
+2011-12-27 Ian Lance Taylor <iant@google.com>
+
+ * go-gcc.cc (Gcc_backend::set_placeholder_struct_type): Use
+ build_distinct_type_copy rather than build_variant_type_copy.
+ (Gcc_backend::set_placeholder_array_type): Likewise.
+ (Gcc_backend::named_type): Add special handling for builtin
+ basic types.
+
2011-12-22 Ian Lance Taylor <iant@google.com>
- * go-gcc.cc (set_placeholder_pointer_type): Arrange for the type
- name to have a DECL_ORIGINAL_TYPE as gcc expects.
- (set_placeholder_struct_type): Likewise.
- (set_placeholder_array_type): Likewise.
- (named_type): Set DECL_ORIGINAL_TYPE.
+ * go-gcc.cc (Gcc_backend::set_placeholder_pointer_type): Arrange
+ for the type name to have a DECL_ORIGINAL_TYPE as gcc expects.
+ (Gcc_backend::set_placeholder_struct_type): Likewise.
+ (Gcc_backend::set_placeholder_array_type): Likewise.
+ (Gcc_backend::named_type): Set DECL_ORIGINAL_TYPE.
2011-12-13 Ian Lance Taylor <iant@google.com>
diff --git a/gcc/go/go-gcc.cc b/gcc/go/go-gcc.cc
index b4ec275..492787d 100644
--- a/gcc/go/go-gcc.cc
+++ b/gcc/go/go-gcc.cc
@@ -663,7 +663,7 @@ Gcc_backend::set_placeholder_struct_type(
Btype* r = this->fill_in_struct(placeholder, fields);
// Build the data structure gcc wants to see for a typedef.
- tree copy = build_variant_type_copy(t);
+ tree copy = build_distinct_type_copy(t);
TYPE_NAME(copy) = NULL_TREE;
DECL_ORIGINAL_TYPE(TYPE_NAME(t)) = copy;
@@ -696,7 +696,7 @@ Gcc_backend::set_placeholder_array_type(Btype* placeholder,
Btype* r = this->fill_in_array(placeholder, element_btype, length);
// Build the data structure gcc wants to see for a typedef.
- tree copy = build_variant_type_copy(t);
+ tree copy = build_distinct_type_copy(t);
TYPE_NAME(copy) = NULL_TREE;
DECL_ORIGINAL_TYPE(TYPE_NAME(t)) = copy;
@@ -712,6 +712,24 @@ Gcc_backend::named_type(const std::string& name, Btype* btype,
tree type = btype->get_tree();
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),