public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-8849] gccrs: TyTy: Store reference to type before any substitutions
@ 2024-02-07 12:43 Arthur Cohen
  0 siblings, 0 replies; only message in thread
From: Arthur Cohen @ 2024-02-07 12:43 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:99fccb3eee81b3593bc5e538b4ba17dff6724c05

commit r14-8849-g99fccb3eee81b3593bc5e538b4ba17dff6724c05
Author: Jakub Dupak <dev@jakubdupak.com>
Date:   Tue Jan 23 14:50:57 2024 +0100

    gccrs: TyTy: Store reference to type before any substitutions
    
    gcc/rust/ChangeLog:
    
            * typecheck/rust-tyty.cc (BaseType::BaseType): Store orig ref.
            (BaseType::get_orig_ref): Add getter.
            * typecheck/rust-tyty.h: Store orig ref.
    
    Signed-off-by: Jakub Dupak <dev@jakubdupak.com>

Diff:
---
 gcc/rust/typecheck/rust-tyty.cc | 10 ++++++++--
 gcc/rust/typecheck/rust-tyty.h  |  3 +++
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/gcc/rust/typecheck/rust-tyty.cc b/gcc/rust/typecheck/rust-tyty.cc
index a8d358161fc1..d81311eed6e9 100644
--- a/gcc/rust/typecheck/rust-tyty.cc
+++ b/gcc/rust/typecheck/rust-tyty.cc
@@ -140,14 +140,15 @@ is_primitive_type_kind (TypeKind kind)
 BaseType::BaseType (HirId ref, HirId ty_ref, TypeKind kind, RustIdent ident,
 		    std::set<HirId> refs)
   : TypeBoundsMappings ({}), kind (kind), ref (ref), ty_ref (ty_ref),
-    combined (refs), ident (ident), mappings (Analysis::Mappings::get ())
+    orig_ref (ref), combined (refs), ident (ident),
+    mappings (Analysis::Mappings::get ())
 {}
 
 BaseType::BaseType (HirId ref, HirId ty_ref, TypeKind kind, RustIdent ident,
 		    std::vector<TypeBoundPredicate> specified_bounds,
 		    std::set<HirId> refs)
   : TypeBoundsMappings (specified_bounds), kind (kind), ref (ref),
-    ty_ref (ty_ref), combined (refs), ident (ident),
+    ty_ref (ty_ref), orig_ref (ref), combined (refs), ident (ident),
     mappings (Analysis::Mappings::get ())
 {}
 
@@ -178,6 +179,11 @@ BaseType::set_ty_ref (HirId id)
 {
   ty_ref = id;
 }
+HirId
+BaseType::get_orig_ref () const
+{
+  return orig_ref;
+}
 
 bool
 BaseType::is_equal (const BaseType &other) const
diff --git a/gcc/rust/typecheck/rust-tyty.h b/gcc/rust/typecheck/rust-tyty.h
index 570a57bff01e..5d4eab42a91f 100644
--- a/gcc/rust/typecheck/rust-tyty.h
+++ b/gcc/rust/typecheck/rust-tyty.h
@@ -99,6 +99,8 @@ public:
   HirId get_ty_ref () const;
   void set_ty_ref (HirId id);
 
+  HirId get_orig_ref () const;
+
   virtual void accept_vis (TyVisitor &vis) = 0;
   virtual void accept_vis (TyConstVisitor &vis) const = 0;
 
@@ -243,6 +245,7 @@ protected:
   TypeKind kind;
   HirId ref;
   HirId ty_ref;
+  const HirId orig_ref;
   std::set<HirId> combined;
   RustIdent ident;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-02-07 12:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-07 12:43 [gcc r14-8849] gccrs: TyTy: Store reference to type before any substitutions Arthur Cohen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).