diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-10-22 15:42:12 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-22 15:42:12 +0000 |
commit | 94b1da7d971fe354f7a2e479a52e48a4145be768 (patch) | |
tree | d6b932d3bc229a020d16642f8c5cd1e16718dc54 /gcc | |
parent | 8e6c5a32b6e2c1ade6f1a835be2c2a26788db544 (diff) | |
parent | fb1d2a2ef2e47ce0be934d008c6231e00c7d7f86 (diff) | |
download | gcc-94b1da7d971fe354f7a2e479a52e48a4145be768.zip gcc-94b1da7d971fe354f7a2e479a52e48a4145be768.tar.gz gcc-94b1da7d971fe354f7a2e479a52e48a4145be768.tar.bz2 |
Merge #763
763: Cleanup IR symbol names in gimple r=philberty a=philberty
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
Co-authored-by: Philip Herron <philip.herron@embecosm.com>
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/rust/typecheck/rust-tyty.cc | 14 | ||||
-rw-r--r-- | gcc/rust/typecheck/rust-tyty.h | 4 |
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); |