diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2019-07-03 00:56:35 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2019-07-03 00:56:35 +0000 |
commit | 61a02d1e97aa9b2cb3c4e3e5c823d3a8a4c5834c (patch) | |
tree | ba9c904f9fe356d87ab7ee4f3f59bebc39a71d83 /gcc/go/gofrontend/export.h | |
parent | 5935baf5bb52209ed2e8fa0f435e19bd4e0507db (diff) | |
download | gcc-61a02d1e97aa9b2cb3c4e3e5c823d3a8a4c5834c.zip gcc-61a02d1e97aa9b2cb3c4e3e5c823d3a8a4c5834c.tar.gz gcc-61a02d1e97aa9b2cb3c4e3e5c823d3a8a4c5834c.tar.bz2 |
compiler: rework type and package tracking in exporter
Revamps the way the exporter tracks exported types and imported
packages that need to be mentioned in the export data.
The previous implementation wasn't properly handling the case where an
exported non-inlinable function refers to an imported type whose
method set includes an inlinable function whose body makes a call to a
function in another package that's not directly used in the original
package.
This patch integrates together two existing traversal helper classes,
"Collect_references_from_inline" and "Find_types_to_prepare" into a
single helper "Collect_export_references", so as to have common/shared
code that looks for indirectly imported packages.
Fixes golang/go#32778
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/183850
From-SVN: r272955
Diffstat (limited to 'gcc/go/gofrontend/export.h')
-rw-r--r-- | gcc/go/gofrontend/export.h | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/gcc/go/gofrontend/export.h b/gcc/go/gofrontend/export.h index 74bdd94..1af386c1 100644 --- a/gcc/go/gofrontend/export.h +++ b/gcc/go/gofrontend/export.h @@ -160,9 +160,15 @@ class Export : public String_dump const Import_init_set& imported_init_fns, const Bindings* bindings); - // Set the index of a type. + // Record a type that is mentioned in export data. Return value is + // TRUE for newly visited types, FALSE for types that have been seen + // previously. bool - set_type_index(Type*); + record_type(Type*); + + // Assign type indices to types mentioned in export data. + int + assign_type_indices(const std::vector<Named_object*>& sorted_exports); // Write a string to the export stream. void @@ -213,11 +219,6 @@ class Export : public String_dump Export(const Export&); Export& operator=(const Export&); - // Prepare types for exporting. - int - prepare_types(const std::vector<Named_object*>* exports, - Unordered_set(const Package*)* imports); - // Write out all known packages. void write_packages(const std::map<std::string, Package*>& packages); @@ -258,6 +259,10 @@ class Export : public String_dump int type_index(const Type*); + // Set the index of a type. + void + set_type_index(const Type*); + // The stream to which we are writing data. Stream* stream_; // Index number of next type. |