diff options
author | Chris Manghane <cmang@google.com> | 2013-10-04 18:07:20 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2013-10-04 18:07:20 +0000 |
commit | c6d2bfbb441ed464ed61e0ee7045c77cf4a94b06 (patch) | |
tree | eea8468b131614593562965119db0820aa44ace6 /gcc/go/go-gcc.cc | |
parent | 7c327f7b1021e3702a1565510563fdf277e1877b (diff) | |
download | gcc-c6d2bfbb441ed464ed61e0ee7045c77cf4a94b06.zip gcc-c6d2bfbb441ed464ed61e0ee7045c77cf4a94b06.tar.gz gcc-c6d2bfbb441ed464ed61e0ee7045c77cf4a94b06.tar.bz2 |
compiler: Use backend interface for temporary reference expressions.
* go-gcc.cc (Backend::convert_expression): New function.
From-SVN: r203209
Diffstat (limited to 'gcc/go/go-gcc.cc')
-rw-r--r-- | gcc/go/go-gcc.cc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/go/go-gcc.cc b/gcc/go/go-gcc.cc index 55b60ad..fcfd41b 100644 --- a/gcc/go/go-gcc.cc +++ b/gcc/go/go-gcc.cc @@ -229,6 +229,9 @@ class Gcc_backend : public Backend Bexpression* complex_constant_expression(Btype* btype, mpfr_t real, mpfr_t imag); + Bexpression* + convert_expression(Btype* type, Bexpression* expr, Location); + // Statements. Bstatement* @@ -949,6 +952,20 @@ Gcc_backend::complex_constant_expression(Btype* btype, mpfr_t real, mpfr_t imag) return tree_to_expr(ret); } +// An expression that converts an expression to a different type. + +Bexpression* +Gcc_backend::convert_expression(Btype* type, Bexpression* expr, Location) +{ + tree type_tree = type->get_tree(); + tree expr_tree = expr->get_tree(); + if (type_tree == error_mark_node || expr_tree == error_mark_node) + return this->error_expression(); + + tree ret = fold_convert(type_tree, expr_tree); + return tree_to_expr(ret); +} + // An expression as a statement. Bstatement* |