diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2018-11-27 21:37:42 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2018-11-27 21:37:42 +0000 |
commit | 340632e97bccaa528160dcdff164ba056ef6e6dc (patch) | |
tree | 73cc419534f6893624dfe95b3f17d7ff6aabf0b1 /gcc/go | |
parent | 34ea95978d0f2af4adff2de7fd9bd32e4526b0d1 (diff) | |
download | gcc-340632e97bccaa528160dcdff164ba056ef6e6dc.zip gcc-340632e97bccaa528160dcdff164ba056ef6e6dc.tar.gz gcc-340632e97bccaa528160dcdff164ba056ef6e6dc.tar.bz2 |
compiler: add types used by inline functions to export data
Reviewed-on: https://go-review.googlesource.com/c/150069
From-SVN: r266531
Diffstat (limited to 'gcc/go')
-rw-r--r-- | gcc/go/gofrontend/MERGE | 2 | ||||
-rw-r--r-- | gcc/go/gofrontend/export.cc | 19 |
2 files changed, 18 insertions, 3 deletions
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 9947fcf..9ad1464 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -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. diff --git a/gcc/go/gofrontend/export.cc b/gcc/go/gofrontend/export.cc index fde2403..d021ac4 100644 --- a/gcc/go/gofrontend/export.cc +++ b/gcc/go/gofrontend/export.cc @@ -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_type(Named_type* nt) 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<Named_object*>* exports, 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: |