diff mbox

Go patch committed: Use backend interface for type info expressions

Message ID mcrtx93rj5m.fsf@iant-glaptop.roam.corp.google.com
State New
Headers show

Commit Message

Ian Lance Taylor May 5, 2014, 9:48 p.m. UTC
This patch by Chris Manghane changes the Go frontend to use the backend
interface for type info expressions.  Bootstrapped and ran Go testsuite
on x86_64-unknown-linux-gnu.  Committed to mainline.

Ian
diff mbox

Patch

diff -r 1a6ec84147d3 go/expressions.cc
--- a/go/expressions.cc	Mon May 05 15:05:17 2014 -0400
+++ b/go/expressions.cc	Mon May 05 17:08:57 2014 -0400
@@ -14095,9 +14095,13 @@ 
     default:
       go_unreachable();
     }
-  tree val_type_tree = type_to_tree(this->type()->get_backend(gogo));
-  go_assert(val_type_tree != error_mark_node);
-  return build_int_cstu(val_type_tree, val);
+  mpz_t cst;
+  mpz_init_set_ui(cst, val);
+  Btype* int_btype = this->type()->get_backend(gogo);
+  Bexpression* ret =
+    gogo->backend()->integer_constant_expression(int_btype, cst);
+  mpz_clear(cst);
+  return expr_to_tree(ret);
 }
 
 // Dump ast representation for a type info expression.