public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Go patch committed: Fix inherited hidden methods, part 2
@ 2011-09-13 19:03 Ian Lance Taylor
  0 siblings, 0 replies; only message in thread
From: Ian Lance Taylor @ 2011-09-13 19:03 UTC (permalink / raw)
  To: gcc-patches, gofrontend-dev

[-- Attachment #1: Type: text/plain, Size: 189 bytes --]

Similar to the last patch, this fixes inherited hidden methods with
arguments of hidden types.  Bootstrapped and ran Go testsuite on
x86_64-unknown-linux-gnu.  Committed to mainline.

Ian


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 3335 bytes --]

diff -r 4905b2cc2083 go/expressions.cc
--- a/go/expressions.cc	Tue Sep 13 10:18:45 2011 -0700
+++ b/go/expressions.cc	Tue Sep 13 11:21:29 2011 -0700
@@ -9239,7 +9239,13 @@
 				     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 -r 4905b2cc2083 go/expressions.h
--- a/go/expressions.h	Tue Sep 13 10:18:45 2011 -0700
+++ b/go/expressions.h	Tue Sep 13 11:21:29 2011 -0700
@@ -1198,8 +1198,9 @@
 		  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 @@
   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 @@
   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 -r 4905b2cc2083 go/statements.h
--- a/go/statements.h	Tue Sep 13 10:18:45 2011 -0700
+++ b/go/statements.h	Tue Sep 13 11:21:29 2011 -0700
@@ -490,8 +490,7 @@
   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 @@
   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 -r 4905b2cc2083 go/types.cc
--- a/go/types.cc	Tue Sep 13 10:18:45 2011 -0700
+++ b/go/types.cc	Tue Sep 13 11:21:29 2011 -0700
@@ -7401,6 +7401,7 @@
   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));

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-09-13 18:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-13 19:03 Go patch committed: Fix inherited hidden methods, part 2 Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).