aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Herron <philip.herron@embecosm.com>2021-10-22 13:45:21 +0100
committerPhilip Herron <philip.herron@embecosm.com>2021-10-22 13:45:21 +0100
commitfb1d2a2ef2e47ce0be934d008c6231e00c7d7f86 (patch)
treed6b932d3bc229a020d16642f8c5cd1e16718dc54
parent8e6c5a32b6e2c1ade6f1a835be2c2a26788db544 (diff)
downloadgcc-fb1d2a2ef2e47ce0be934d008c6231e00c7d7f86.zip
gcc-fb1d2a2ef2e47ce0be934d008c6231e00c7d7f86.tar.gz
gcc-fb1d2a2ef2e47ce0be934d008c6231e00c7d7f86.tar.bz2
Cleanup IR symbol names in gimple
When we have generic code the full as_string is too verbose for symbol names. This changes the ir_symbol_names to become the name of the types not the full debug as_string version. Fixes #745
-rw-r--r--gcc/rust/typecheck/rust-tyty.cc14
-rw-r--r--gcc/rust/typecheck/rust-tyty.h4
2 files changed, 16 insertions, 2 deletions
diff --git a/gcc/rust/typecheck/rust-tyty.cc b/gcc/rust/typecheck/rust-tyty.cc
index 37f93b4..96a06e6 100644
--- a/gcc/rust/typecheck/rust-tyty.cc
+++ b/gcc/rust/typecheck/rust-tyty.cc
@@ -1982,6 +1982,20 @@ ParamType::as_string () const
return lookup->as_string ();
}
+std::string
+ParamType::get_name () const
+{
+ if (get_ref () == get_ty_ref ())
+ return get_symbol ();
+
+ auto context = Resolver::TypeCheckContext::get ();
+ BaseType *lookup = nullptr;
+ bool ok = context->lookup_type (get_ty_ref (), &lookup);
+ rust_assert (ok);
+
+ return lookup->get_name ();
+}
+
BaseType *
ParamType::unify (BaseType *other)
{
diff --git a/gcc/rust/typecheck/rust-tyty.h b/gcc/rust/typecheck/rust-tyty.h
index 20bad10..be80f77 100644
--- a/gcc/rust/typecheck/rust-tyty.h
+++ b/gcc/rust/typecheck/rust-tyty.h
@@ -545,7 +545,7 @@ public:
BaseType *resolve () const;
- std::string get_name () const override final { return as_string (); }
+ std::string get_name () const override final;
bool is_equal (const BaseType &other) const override;
@@ -680,7 +680,7 @@ public:
: generic (other.generic), param (other.param)
{}
- std::string as_string () const { return param->as_string (); }
+ std::string as_string () const { return param->get_name (); }
bool fill_param_ty (BaseType &type, Location locus);