diff options
Diffstat (limited to 'gcc/go/gofrontend/gogo.h')
-rw-r--r-- | gcc/go/gofrontend/gogo.h | 43 |
1 files changed, 32 insertions, 11 deletions
diff --git a/gcc/go/gofrontend/gogo.h b/gcc/go/gofrontend/gogo.h index fd28ed1..5b77d6d 100644 --- a/gcc/go/gofrontend/gogo.h +++ b/gcc/go/gofrontend/gogo.h @@ -1486,6 +1486,11 @@ class Function set_is_inline_only() { this->is_inline_only_ = true; } + // Mark the function as referenced by an inline body. + void + set_is_referenced_by_inline() + { this->is_referenced_by_inline_ = true; } + // Swap with another function. Used only for the thunk which calls // recover. void @@ -1538,17 +1543,18 @@ class Function // Export the function. void - export_func(Export*, const std::string& name) const; + export_func(Export*, const Named_object*) const; // Export a function with a type. static void - export_func_with_type(Export*, const std::string& name, + export_func_with_type(Export*, const Named_object*, const Function_type*, Results*, bool nointerface, Block* block, Location); - // Import a function. - static void - import_func(Import*, std::string* pname, Typed_identifier** receiver, + // Import a function. Reports whether the import succeeded. + static bool + import_func(Import*, std::string* pname, Package** pkg, + bool* is_exported, Typed_identifier** receiver, Typed_identifier_list** pparameters, Typed_identifier_list** presults, bool* is_varargs, bool* nointerface, std::string* body); @@ -1628,6 +1634,9 @@ class Function // True if this function is inline only: if it should not be emitted // if it is not inlined. bool is_inline_only_ : 1; + // True if this function is referenced from an inlined body that + // will be put into the export data. + bool is_referenced_by_inline_ : 1; }; // A snapshot of the current binding state. @@ -1768,9 +1777,9 @@ class Function_declaration // Export a function declaration. void - export_func(Export* exp, const std::string& name) const + export_func(Export* exp, const Named_object* no) const { - Function::export_func_with_type(exp, name, this->fntype_, NULL, + Function::export_func_with_type(exp, no, this->fntype_, NULL, this->is_method() && this->nointerface(), NULL, this->location_); } @@ -2022,6 +2031,14 @@ class Variable this->in_unique_section_ = true; } + // Mark the variable as referenced by an inline body. + void + set_is_referenced_by_inline() + { + go_assert(this->is_global_); + this->is_referenced_by_inline_ = true; + } + // Return the top-level declaration for this variable. Statement* toplevel_decl() @@ -2062,11 +2079,12 @@ class Variable // Export the variable. void - export_var(Export*, const std::string& name) const; + export_var(Export*, const Named_object*) const; - // Import a variable. - static void - import_var(Import*, std::string* pname, Type** ptype); + // Import a variable. Reports whether the import succeeded. + static bool + import_var(Import*, std::string* pname, Package** pkg, bool* is_exported, + Type** ptype); private: // The type of a tuple. @@ -2133,6 +2151,9 @@ class Variable // True if this variable should be put in a unique section. This is // used for field tracking. bool in_unique_section_ : 1; + // True if this variable is referenced from an inlined body that + // will be put into the export data. + bool is_referenced_by_inline_ : 1; // The top-level declaration for this variable. Only used for local // variables. Must be a Temporary_statement if not NULL. Statement* toplevel_decl_; |