summaryrefslogtreecommitdiff
path: root/gcc/go/go-gcc.cc
diff options
context:
space:
mode:
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2013-11-23 19:01:57 +0000
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2013-11-23 19:01:57 +0000
commite4329d20b91691039f87087d146d3fa713295793 (patch)
tree4b25b8df89857ef87087b3f0a341c0a0d717af7a /gcc/go/go-gcc.cc
parent5cffb4b1440504d17cc470dcc377fa664cdda0c4 (diff)
downloadgcc-e4329d20b91691039f87087d146d3fa713295793.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@205316 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/go/go-gcc.cc')
-rw-r--r--gcc/go/go-gcc.cc29
1 files changed, 5 insertions, 24 deletions
diff --git a/gcc/go/go-gcc.cc b/gcc/go/go-gcc.cc
index 50e31fff91f..939be20c349 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();