compiler: add types used by inline functions to export data
Change-Id: I68226e55e03d89a76ecb077c7791d9e21baa20b3
Reviewed-on: https://go-review.googlesource.com/c/150069
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
diff --git a/go/export.cc b/go/export.cc
index fde2403..d021ac4 100644
--- a/go/export.cc
+++ b/go/export.cc
@@ -290,6 +290,11 @@
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 @@
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 @@
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: