diff options
author | Ian Lance Taylor <iant@google.com> | 2013-11-23 19:01:57 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2013-11-23 19:01:57 +0000 |
commit | 18768faed3875e1d33b122fbf867788add95f056 (patch) | |
tree | 4b25b8df89857ef87087b3f0a341c0a0d717af7a /gcc/go/go-gcc.cc | |
parent | 7c42f52b7419ea5db30917cf39c15783e5aa2bf5 (diff) | |
download | gcc-18768faed3875e1d33b122fbf867788add95f056.zip gcc-18768faed3875e1d33b122fbf867788add95f056.tar.gz gcc-18768faed3875e1d33b122fbf867788add95f056.tar.bz2 |
compiler: Fix backend representation of calls to interface methods.
Also unify all identical result parameter sets into a single
struct type, and fix the use of backend function pointers.
* go-gcc.cc (Gcc_backend::function_type): Add result_struct
parameter.
From-SVN: r205316
Diffstat (limited to 'gcc/go/go-gcc.cc')
-rw-r--r-- | gcc/go/go-gcc.cc | 29 |
1 files changed, 5 insertions, 24 deletions
diff --git a/gcc/go/go-gcc.cc b/gcc/go/go-gcc.cc index 50e31ff..939be20 100644 --- a/gcc/go/go-gcc.cc +++ b/gcc/go/go-gcc.cc @@ -158,6 +158,7 @@ class Gcc_backend : public Backend function_type(const Btyped_identifier&, const std::vector<Btyped_identifier>&, const std::vector<Btyped_identifier>&, + Btype*, const Location); Btype* @@ -493,7 +494,8 @@ Btype* Gcc_backend::function_type(const Btyped_identifier& receiver, const std::vector<Btyped_identifier>& parameters, const std::vector<Btyped_identifier>& results, - Location location) + Btype* result_struct, + Location) { tree args = NULL_TREE; tree* pp = &args; @@ -528,29 +530,8 @@ Gcc_backend::function_type(const Btyped_identifier& receiver, result = results.front().btype->get_tree(); else { - result = make_node(RECORD_TYPE); - tree field_trees = NULL_TREE; - pp = &field_trees; - for (std::vector<Btyped_identifier>::const_iterator p = results.begin(); - p != results.end(); - ++p) - { - const std::string name = (p->name.empty() - ? "UNNAMED" - : p->name); - tree name_tree = get_identifier_from_string(name); - tree field_type_tree = p->btype->get_tree(); - if (field_type_tree == error_mark_node) - return this->error_type(); - gcc_assert(TYPE_SIZE(field_type_tree) != NULL_TREE); - tree field = build_decl(location.gcc_location(), FIELD_DECL, - name_tree, field_type_tree); - DECL_CONTEXT(field) = result; - *pp = field; - pp = &DECL_CHAIN(field); - } - TYPE_FIELDS(result) = field_trees; - layout_type(result); + gcc_assert(result_struct != NULL); + result = result_struct->get_tree(); } if (result == error_mark_node) return this->error_type(); |