]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
HIR: add missing getters
authorJakub Dupak <dev@jakubdupak.com>
Sun, 3 Dec 2023 10:07:04 +0000 (11:07 +0100)
committerPhilip Herron <philip.herron@embecosm.com>
Tue, 19 Dec 2023 17:23:09 +0000 (17:23 +0000)
gcc/rust/ChangeLog:

* hir/tree/rust-hir-item.h: Ad lifetime getter.
* hir/tree/rust-hir-path.h: Make getter const ref.
* hir/tree/rust-hir.h: Const ref and new getter.

Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
gcc/rust/hir/tree/rust-hir-item.h
gcc/rust/hir/tree/rust-hir-path.h
gcc/rust/hir/tree/rust-hir.h

index 4a418b6895af252af9c8cfb92c007e487de9c9bd..3c566d79cf9c50a578674b22652ad2c327cae597 100644 (file)
@@ -443,6 +443,8 @@ public:
   // Returns whether the self-param has a valid lifetime.
   bool has_lifetime () const { return !lifetime.is_error (); }
 
+  const Lifetime &get_lifetime () const { return lifetime; }
+
   // Returns whether the self-param is in an error state.
   bool is_error () const { return self_kind == ImplicitSelfKind::NONE; }
 
index c07448060431afd9438157928cee3b767a1177db..0413e150a5e2d7de93f64357a8645fa9124b1b60 100644 (file)
@@ -218,6 +218,10 @@ public:
   std::string as_string () const;
 
   std::vector<Lifetime> &get_lifetime_args () { return lifetime_args; }
+  const std::vector<Lifetime> &get_lifetime_args () const
+  {
+    return lifetime_args;
+  }
 
   std::vector<std::unique_ptr<Type> > &get_type_args () { return type_args; }
 
index 81baa500d0cff4b5a456d6b659b62bfe14eb3bc9..c8191f5c7c82fcf56eb06392443e085b399e78c9 100644 (file)
@@ -572,7 +572,10 @@ public:
 
   void accept_vis (HIRFullVisitor &vis) override;
 
-  std::string get_name () const { return lifetime_name; }
+  WARN_UNUSED_RESULT const std::string &get_name () const
+  {
+    return lifetime_name;
+  }
 
   AST::Lifetime::LifetimeType get_lifetime_type () const
   {
@@ -662,6 +665,8 @@ public:
   // Returns whether the lifetime param has any lifetime bounds.
   bool has_lifetime_bounds () const { return !lifetime_bounds.empty (); }
 
+  std::vector<Lifetime> &get_lifetime_bounds () { return lifetime_bounds; }
+
   // Returns whether the lifetime param has an outer attribute.
   bool has_outer_attribute () const { return !outer_attr.is_empty (); }