diff mbox series

Go patch committed: Add types used by inline functions to export data

Message ID CAOyqgcUkk9Kc6nsWqPkf90C__=tgdZ0tTC=XQC+FdO-MGBu6hw@mail.gmail.com
State New
Headers show
Series Go patch committed: Add types used by inline functions to export data | expand

Commit Message

Ian Lance Taylor Nov. 27, 2018, 9:37 p.m. UTC
This Go frontend patch add types used by inline functions to the
export data.  Bootstrapped and ran Go testsuite on
x86_64-pc-linux-gnu.  Committed to mainline.

Ian
diff mbox series

Patch

Index: gcc/go/gofrontend/MERGE
===================================================================
--- gcc/go/gofrontend/MERGE	(revision 266530)
+++ gcc/go/gofrontend/MERGE	(working copy)
@@ -1,4 +1,4 @@ 
-c11d9528a0846293e4d615c86fc773c97252fdce
+21cf8069ceb078de54cc43ac25c9c89bd15cba56
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
Index: gcc/go/gofrontend/export.cc
===================================================================
--- gcc/go/gofrontend/export.cc	(revision 266523)
+++ gcc/go/gofrontend/export.cc	(working copy)
@@ -290,6 +290,11 @@  Find_types_to_prepare::type(Type* type)
   if (type->is_void_type())
     return TRAVERSE_SKIP_COMPONENTS;
 
+  // Skip abstract types.  We should never see these in real code,
+  // only in things like const declarations.
+  if (type->is_abstract())
+    return TRAVERSE_SKIP_COMPONENTS;
+
   if (!this->exp_->set_type_index(type))
     {
       // We've already seen this type.
@@ -367,7 +372,12 @@  Find_types_to_prepare::traverse_named_ty
 	     methods->begin_definitions();
 	   pm != methods->end_definitions();
 	   ++pm)
-	this->traverse_function((*pm)->func_value()->type());
+	{
+	  Function* fn = (*pm)->func_value();
+	  this->traverse_function(fn->type());
+	  if (fn->export_for_inlining())
+	    fn->block()->traverse(this);
+	}
 
       for (Bindings::const_declarations_iterator pm =
 	     methods->begin_declarations();
@@ -434,7 +444,12 @@  Export::prepare_types(const std::vector<
 	  break;
 
 	case Named_object::NAMED_OBJECT_FUNC:
-	  find.traverse_function(no->func_value()->type());
+	  {
+	    Function* fn = no->func_value();
+	    find.traverse_function(fn->type());
+	    if (fn->export_for_inlining())
+	      fn->block()->traverse(&find);
+	  }
 	  break;
 
 	case Named_object::NAMED_OBJECT_FUNC_DECLARATION: