diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2011-10-24 04:06:44 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2011-10-24 04:06:44 +0000 |
commit | b7190f2fc6ea307d8238910edb47007cd48cd486 (patch) | |
tree | ab60c2d0a2afd391b859db4da3bc867fd4f64372 | |
parent | bb12a72a480421a89e860414cf69065fd4607443 (diff) | |
download | gcc-b7190f2fc6ea307d8238910edb47007cd48cd486.zip gcc-b7190f2fc6ea307d8238910edb47007cd48cd486.tar.gz gcc-b7190f2fc6ea307d8238910edb47007cd48cd486.tar.bz2 |
Rename is_open_array_type to is_slice_type.
From-SVN: r180361
-rw-r--r-- | gcc/go/gofrontend/expressions.cc | 45 | ||||
-rw-r--r-- | gcc/go/gofrontend/gogo.cc | 2 | ||||
-rw-r--r-- | gcc/go/gofrontend/statements.cc | 4 | ||||
-rw-r--r-- | gcc/go/gofrontend/types.cc | 20 | ||||
-rw-r--r-- | gcc/go/gofrontend/types.h | 4 |
5 files changed, 37 insertions, 38 deletions
diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc index bf829b5..97c7558 100644 --- a/gcc/go/gofrontend/expressions.cc +++ b/gcc/go/gofrontend/expressions.cc @@ -234,8 +234,7 @@ Expression::convert_for_assignment(Translate_context* context, Type* lhs_type, else if (rhs_type->interface_type() != NULL) return Expression::convert_interface_to_type(context, lhs_type, rhs_type, rhs_tree, location); - else if (lhs_type->is_open_array_type() - && rhs_type->is_nil_type()) + else if (lhs_type->is_slice_type() && rhs_type->is_nil_type()) { // Assigning nil to an open array. go_assert(TREE_CODE(lhs_type_tree) == RECORD_TYPE); @@ -3315,7 +3314,7 @@ Type_conversion_expression::do_lower(Gogo*, Named_object*, mpfr_clear(imag); } - if (type->is_open_array_type() && type->named_type() == NULL) + if (type->is_slice_type() && type->named_type() == NULL) { Type* element_type = type->array_type()->element_type()->forwarded(); bool is_byte = element_type == Type::lookup_integer_type("uint8"); @@ -3663,7 +3662,7 @@ Type_conversion_expression::do_get_tree(Translate_context* context) len); } } - else if (type->is_open_array_type() && expr_type->is_string_type()) + else if (type->is_slice_type() && expr_type->is_string_type()) { Type* e = type->array_type()->element_type()->forwarded(); go_assert(e->integer_type() != NULL); @@ -3831,9 +3830,9 @@ Unsafe_type_conversion_expression::do_get_tree(Translate_context* context) source_location loc = this->location(); bool use_view_convert = false; - if (t->is_open_array_type()) + if (t->is_slice_type()) { - go_assert(et->is_open_array_type()); + go_assert(et->is_slice_type()); use_view_convert = true; } else if (t->map_type() != NULL) @@ -7302,7 +7301,7 @@ Builtin_call_expression::do_lower(Gogo* gogo, Named_object* function, if (args == NULL || args->empty()) return this; Type* slice_type = args->front()->type(); - if (!slice_type->is_open_array_type()) + if (!slice_type->is_slice_type()) { error_at(args->front()->location(), "argument 1 must be a slice"); this->set_is_error(); @@ -7342,7 +7341,7 @@ Builtin_call_expression::lower_make() bool is_slice = false; bool is_map = false; bool is_chan = false; - if (type->is_open_array_type()) + if (type->is_slice_type()) is_slice = true; else if (type->map_type() != NULL) is_map = true; @@ -7554,7 +7553,7 @@ Builtin_call_expression::do_is_constant() const if (arg_type->points_to() != NULL && arg_type->points_to()->array_type() != NULL - && !arg_type->points_to()->is_open_array_type()) + && !arg_type->points_to()->is_slice_type()) arg_type = arg_type->points_to(); if (arg_type->array_type() != NULL @@ -7633,7 +7632,7 @@ Builtin_call_expression::do_integer_constant_value(bool iota_is_constant, if (arg_type->points_to() != NULL && arg_type->points_to()->array_type() != NULL - && !arg_type->points_to()->is_open_array_type()) + && !arg_type->points_to()->is_slice_type()) arg_type = arg_type->points_to(); if (arg_type->array_type() != NULL @@ -8080,7 +8079,7 @@ Builtin_call_expression::do_check_types(Gogo*) Type* arg_type = this->one_arg()->type(); if (arg_type->points_to() != NULL && arg_type->points_to()->array_type() != NULL - && !arg_type->points_to()->is_open_array_type()) + && !arg_type->points_to()->is_slice_type()) arg_type = arg_type->points_to(); if (this->code_ == BUILTIN_CAP) { @@ -8135,7 +8134,7 @@ Builtin_call_expression::do_check_types(Gogo*) || type->channel_type() != NULL || type->map_type() != NULL || type->function_type() != NULL - || type->is_open_array_type()) + || type->is_slice_type()) ; else this->report_error(_("unsupported argument type to " @@ -8192,7 +8191,7 @@ Builtin_call_expression::do_check_types(Gogo*) break; Type* e1; - if (arg1_type->is_open_array_type()) + if (arg1_type->is_slice_type()) e1 = arg1_type->array_type()->element_type(); else { @@ -8201,7 +8200,7 @@ Builtin_call_expression::do_check_types(Gogo*) } Type* e2; - if (arg2_type->is_open_array_type()) + if (arg2_type->is_slice_type()) e2 = arg2_type->array_type()->element_type(); else if (arg2_type->is_string_type()) e2 = Type::lookup_integer_type("uint8"); @@ -8321,7 +8320,7 @@ Builtin_call_expression::do_get_tree(Translate_context* context) { arg_type = arg_type->points_to(); go_assert(arg_type->array_type() != NULL - && !arg_type->is_open_array_type()); + && !arg_type->is_slice_type()); go_assert(POINTER_TYPE_P(TREE_TYPE(arg_tree))); arg_tree = build_fold_indirect_ref(arg_tree); } @@ -8515,7 +8514,7 @@ Builtin_call_expression::do_get_tree(Translate_context* context) fnname = "__go_print_interface"; } } - else if (type->is_open_array_type()) + else if (type->is_slice_type()) { static tree print_slice_fndecl; pfndecl = &print_slice_fndecl; @@ -8694,7 +8693,7 @@ Builtin_call_expression::do_get_tree(Translate_context* context) Type* arg2_type = arg2->type(); tree arg2_val; tree arg2_len; - if (arg2_type->is_open_array_type()) + if (arg2_type->is_slice_type()) { at = arg2_type->array_type(); arg2_tree = save_expr(arg2_tree); @@ -9078,7 +9077,7 @@ Call_expression::lower_varargs(Gogo* gogo, Named_object* function, source_location loc = this->location(); go_assert(param_count > 0); - go_assert(varargs_type->is_open_array_type()); + go_assert(varargs_type->is_slice_type()); size_t arg_count = this->args_ == NULL ? 0 : this->args_->size(); if (arg_count < param_count - 1) @@ -9903,7 +9902,7 @@ Index_expression::do_lower(Gogo*, Named_object*, Statement_inserter*, int) return Expression::make_array_index(left, start, end, location); else if (type->points_to() != NULL && type->points_to()->array_type() != NULL - && !type->points_to()->is_open_array_type()) + && !type->points_to()->is_slice_type()) { Expression* deref = Expression::make_unary(OPERATOR_MULT, left, location); @@ -10060,7 +10059,7 @@ Array_index_expression::do_type() this->type_ = Type::make_error_type(); else if (this->end_ == NULL) this->type_ = type->element_type(); - else if (type->is_open_array_type()) + else if (type->is_slice_type()) { // A slice of a slice has the same type as the original // slice. @@ -10150,7 +10149,7 @@ Array_index_expression::do_check_types(Gogo*) // A slice of an array requires an addressable array. A slice of a // slice is always possible. - if (this->end_ != NULL && !array_type->is_open_array_type()) + if (this->end_ != NULL && !array_type->is_slice_type()) { if (!this->array_->is_addressable()) this->report_error(_("array is not addressable")); @@ -10169,7 +10168,7 @@ Array_index_expression::do_is_addressable() const return false; // An index into a slice is addressable. - if (this->array_->type()->is_open_array_type()) + if (this->array_->type()->is_slice_type()) return true; // An index into an array is addressable if the array is @@ -12234,7 +12233,7 @@ Expression* Expression::make_slice_composite_literal(Type* type, Expression_list* vals, source_location location) { - go_assert(type->is_open_array_type()); + go_assert(type->is_slice_type()); return new Open_array_construction_expression(type, vals, location); } diff --git a/gcc/go/gofrontend/gogo.cc b/gcc/go/gofrontend/gogo.cc index f1f7680..9998ab8 100644 --- a/gcc/go/gofrontend/gogo.cc +++ b/gcc/go/gofrontend/gogo.cc @@ -3662,7 +3662,7 @@ Variable::type_from_range(Expression* expr, bool get_index_type, if (t->array_type() != NULL || (t->points_to() != NULL && t->points_to()->array_type() != NULL - && !t->points_to()->is_open_array_type())) + && !t->points_to()->is_slice_type())) { if (get_index_type) return Type::lookup_integer_type("int"); diff --git a/gcc/go/gofrontend/statements.cc b/gcc/go/gofrontend/statements.cc index 8c1f168..c079fdf 100644 --- a/gcc/go/gofrontend/statements.cc +++ b/gcc/go/gofrontend/statements.cc @@ -4319,7 +4319,7 @@ Send_statement::do_get_backend(Translate_context* context) case Type::TYPE_ARRAY: is_small = false; - can_take_address = !element_type->is_open_array_type(); + can_take_address = !element_type->is_slice_type(); break; default: @@ -5181,7 +5181,7 @@ For_range_statement::do_lower(Gogo* gogo, Named_object*, Block* enclosing, Type* range_type = this->range_->type(); if (range_type->points_to() != NULL && range_type->points_to()->array_type() != NULL - && !range_type->points_to()->is_open_array_type()) + && !range_type->points_to()->is_slice_type()) range_type = range_type->points_to(); Type* index_type; diff --git a/gcc/go/gofrontend/types.cc b/gcc/go/gofrontend/types.cc index 68c35f4..c596de9 100644 --- a/gcc/go/gofrontend/types.cc +++ b/gcc/go/gofrontend/types.cc @@ -240,7 +240,7 @@ Type::points_to() const // Return whether this is an open array type. bool -Type::is_open_array_type() const +Type::is_slice_type() const { return this->array_type() != NULL && this->array_type()->length() == NULL; } @@ -457,7 +457,7 @@ Type::are_compatible_for_binop(const Type* lhs, const Type* rhs) if (lhs->is_nil_type() && (rhs->points_to() != NULL || rhs->interface_type() != NULL - || rhs->is_open_array_type() + || rhs->is_slice_type() || rhs->map_type() != NULL || rhs->channel_type() != NULL || rhs->function_type() != NULL)) @@ -465,7 +465,7 @@ Type::are_compatible_for_binop(const Type* lhs, const Type* rhs) if (rhs->is_nil_type() && (lhs->points_to() != NULL || lhs->interface_type() != NULL - || lhs->is_open_array_type() + || lhs->is_slice_type() || lhs->map_type() != NULL || lhs->channel_type() != NULL || lhs->function_type() != NULL)) @@ -556,7 +556,7 @@ Type::are_assignable_check_hidden(const Type* lhs, const Type* rhs, if (rhs->is_nil_type() && (lhs->points_to() != NULL || lhs->function_type() != NULL - || lhs->is_open_array_type() + || lhs->is_slice_type() || lhs->map_type() != NULL || lhs->channel_type() != NULL || lhs->interface_type() != NULL)) @@ -662,7 +662,7 @@ Type::are_convertible(const Type* lhs, const Type* rhs, std::string* reason) { if (rhs->integer_type() != NULL) return true; - if (rhs->is_open_array_type() && rhs->named_type() == NULL) + if (rhs->is_slice_type() && rhs->named_type() == NULL) { const Type* e = rhs->array_type()->element_type()->forwarded(); if (e->integer_type() != NULL @@ -674,7 +674,7 @@ Type::are_convertible(const Type* lhs, const Type* rhs, std::string* reason) // A string may be converted to []byte or []int. if (rhs->is_string_type() - && lhs->is_open_array_type() + && lhs->is_slice_type() && lhs->named_type() == NULL) { const Type* e = lhs->array_type()->element_type()->forwarded(); @@ -6480,7 +6480,7 @@ Find_type_use::type(Type* type) // essentially a pointer: a pointer, a slice, a function, a map, or // a channel. if (type->points_to() != NULL - || type->is_open_array_type() + || type->is_slice_type() || type->function_type() != NULL || type->map_type() != NULL || type->channel_type() != NULL) @@ -6699,7 +6699,7 @@ Named_type::convert(Gogo* gogo) case TYPE_ARRAY: // Slice types were completed in create_placeholder. - if (!base->is_open_array_type()) + if (!base->is_slice_type()) { Btype* bet = base->array_type()->get_backend_element(gogo); Bexpression* blen = base->array_type()->get_backend_length(gogo); @@ -6789,7 +6789,7 @@ Named_type::create_placeholder(Gogo* gogo) break; case TYPE_ARRAY: - if (base->is_open_array_type()) + if (base->is_slice_type()) bt = gogo->backend()->placeholder_struct_type(this->name(), this->location_); else @@ -6822,7 +6822,7 @@ Named_type::create_placeholder(Gogo* gogo) this->named_btype_ = bt; - if (base->is_open_array_type()) + if (base->is_slice_type()) { // We do not record slices as dependencies of other types, // because we can fill them in completely here with the final diff --git a/gcc/go/gofrontend/types.h b/gcc/go/gofrontend/types.h index cb3fcaa7..2ec828f 100644 --- a/gcc/go/gofrontend/types.h +++ b/gcc/go/gofrontend/types.h @@ -741,9 +741,9 @@ class Type array_type() const { return this->convert<const Array_type, TYPE_ARRAY>(); } - // Return whether if this is an open array type. + // Return whether if this is a slice type. bool - is_open_array_type() const; + is_slice_type() const; // If this is a map type, return it. Otherwise, return NULL. Map_type* |