]> gcc.gnu.org Git - gcc.git/commitdiff
gccrs: HIR: add missing getters
authorJakub Dupak <dev@jakubdupak.com>
Sun, 3 Dec 2023 10:07:04 +0000 (11:07 +0100)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 30 Jan 2024 11:36:49 +0000 (12:36 +0100)
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 f72d8c8b05017a1429d249b6671c1f71e19dba5f..74450786e89a260ebdb0ad070120200e136c3bf8 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 9fe126a56a8d5782ccf86e8f2b9972d072c4db83..0566e2e2a1cbf50c78f3294186f3c113a5890b21 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 0f2d52256d2fd2910a96e588e672d5daa9b346df..f66f53fbd2042e298915c56232d639139cdfa234 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 (); }
 
This page took 0.488977 seconds and 5 git commands to generate.