aboutsummaryrefslogtreecommitdiff
path: root/gcc/go
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2011-09-13 18:24:45 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2011-09-13 18:24:45 +0000
commitd9930d55ad31d35abe3a3a1b2d2c4a8b677ed4a9 (patch)
tree85ad0452783a9f4f381dc32dd0baab514c83a916 /gcc/go
parent61c4c1504980a97e4689209640fa6be3e9d7f0e3 (diff)
downloadgcc-d9930d55ad31d35abe3a3a1b2d2c4a8b677ed4a9.zip
gcc-d9930d55ad31d35abe3a3a1b2d2c4a8b677ed4a9.tar.gz
gcc-d9930d55ad31d35abe3a3a1b2d2c4a8b677ed4a9.tar.bz2
Fix inheriting hidden methods with arguments of hidden type.
From-SVN: r178827
Diffstat (limited to 'gcc/go')
-rw-r--r--gcc/go/gofrontend/expressions.cc8
-rw-r--r--gcc/go/gofrontend/expressions.h14
-rw-r--r--gcc/go/gofrontend/statements.h7
-rw-r--r--gcc/go/gofrontend/types.cc1
4 files changed, 23 insertions, 7 deletions
diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc
index 5529e6c..b0be483 100644
--- a/gcc/go/gofrontend/expressions.cc
+++ b/gcc/go/gofrontend/expressions.cc
@@ -9239,7 +9239,13 @@ Call_expression::check_argument_type(int i, const Type* parameter_type,
bool issued_error)
{
std::string reason;
- if (!Type::are_assignable(parameter_type, argument_type, &reason))
+ bool ok;
+ if (this->are_hidden_fields_ok_)
+ ok = Type::are_assignable_hidden_ok(parameter_type, argument_type,
+ &reason);
+ else
+ ok = Type::are_assignable(parameter_type, argument_type, &reason);
+ if (!ok)
{
if (!issued_error)
{
diff --git a/gcc/go/gofrontend/expressions.h b/gcc/go/gofrontend/expressions.h
index bb4f23e..c6ae12c 100644
--- a/gcc/go/gofrontend/expressions.h
+++ b/gcc/go/gofrontend/expressions.h
@@ -1198,8 +1198,9 @@ class Call_expression : public Expression
source_location location)
: Expression(EXPRESSION_CALL, location),
fn_(fn), args_(args), type_(NULL), results_(NULL), tree_(NULL),
- is_varargs_(is_varargs), varargs_are_lowered_(false),
- types_are_determined_(false), is_deferred_(false), issued_error_(false)
+ is_varargs_(is_varargs), are_hidden_fields_ok_(false),
+ varargs_are_lowered_(false), types_are_determined_(false),
+ is_deferred_(false), issued_error_(false)
{ }
// The function to call.
@@ -1249,6 +1250,12 @@ class Call_expression : public Expression
set_varargs_are_lowered()
{ this->varargs_are_lowered_ = true; }
+ // Note that it is OK for this call to set hidden fields when
+ // passing arguments.
+ void
+ set_hidden_fields_are_ok()
+ { this->are_hidden_fields_ok_ = true; }
+
// Whether this call is being deferred.
bool
is_deferred() const
@@ -1350,6 +1357,9 @@ class Call_expression : public Expression
tree tree_;
// True if the last argument is a varargs argument (f(a...)).
bool is_varargs_;
+ // True if this statement may pass hidden fields in the arguments.
+ // This is used for generated method stubs.
+ bool are_hidden_fields_ok_;
// True if varargs have already been lowered.
bool varargs_are_lowered_;
// True if types have been determined.
diff --git a/gcc/go/gofrontend/statements.h b/gcc/go/gofrontend/statements.h
index 8206a08..a22090a 100644
--- a/gcc/go/gofrontend/statements.h
+++ b/gcc/go/gofrontend/statements.h
@@ -490,8 +490,7 @@ class Temporary_statement : public Statement
Type*
type() const;
- // Note that it is OK for this return statement to set hidden
- // fields.
+ // Note that it is OK for this statement to set hidden fields.
void
set_hidden_fields_are_ok()
{ this->are_hidden_fields_ok_ = true; }
@@ -533,8 +532,8 @@ class Temporary_statement : public Statement
Expression* init_;
// The backend representation of the temporary variable.
Bvariable* bvariable_;
- // True if this statement may pass hidden fields in the return
- // value. This is used for generated method stubs.
+ // True if this statement may set hidden fields when assigning the
+ // value to the temporary. This is used for generated method stubs.
bool are_hidden_fields_ok_;
// True if something takes the address of this temporary variable.
bool is_address_taken_;
diff --git a/gcc/go/gofrontend/types.cc b/gcc/go/gofrontend/types.cc
index 6e87056..453e741 100644
--- a/gcc/go/gofrontend/types.cc
+++ b/gcc/go/gofrontend/types.cc
@@ -7401,6 +7401,7 @@ Type::build_one_stub_method(Gogo* gogo, Method* method,
go_assert(func != NULL);
Call_expression* call = Expression::make_call(func, arguments, is_varargs,
location);
+ call->set_hidden_fields_are_ok();
size_t count = call->result_count();
if (count == 0)
gogo->add_statement(Statement::make_statement(call));