]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
TyTy: Store reference to type before any substitutions
authorJakub Dupak <dev@jakubdupak.com>
Tue, 23 Jan 2024 13:50:57 +0000 (14:50 +0100)
committerPhilip Herron <philip.herron@embecosm.com>
Sat, 3 Feb 2024 15:25:30 +0000 (15:25 +0000)
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>
gcc/rust/typecheck/rust-tyty.cc
gcc/rust/typecheck/rust-tyty.h

index ea6d17d535238f48970ccdc3a39513bce308cbc0..9863ed0ac7b6308ba0aea8f9f1e666ff1d621cb1 100644 (file)
@@ -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
index 1a02bf2981dee31ed62e8c54b52c6749e90a51b9..48c58a3af59ba07bebba23ae844f43f90777636d 100644 (file)
@@ -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;