]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: Add new getters
authorMarc Poulhiès <dkm@kataplop.net>
Thu, 29 Jun 2023 18:47:16 +0000 (20:47 +0200)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 16 Jan 2024 17:49:30 +0000 (18:49 +0100)
Some class members were not accessible from outside, which will be needed
for the new HIR dump.

gcc/rust/ChangeLog:

* hir/tree/rust-hir-expr.h (AwaitExpr::get_awaited_expr): New.
(AsyncBlockExpr::get_has_move, AsyncBlockExpr::get_block_expr): New.
* hir/tree/rust-hir-item.h (Enum::get_where_clause): New.
(Trait::get_where_clause, Trait::is_unsafe): New.
(ExternalItem::get_visibility): New.

Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
gcc/rust/hir/tree/rust-hir-expr.h
gcc/rust/hir/tree/rust-hir-item.h

index 9bd4941ea13b86e3ff20eb9ae05edec7a0471929..a783da1833c27d3c04adb50bc499b5043b55c322 100644 (file)
@@ -3755,6 +3755,8 @@ public:
   void accept_vis (HIRFullVisitor &vis) override;
   void accept_vis (HIRExpressionVisitor &vis) override;
 
+  std::unique_ptr<Expr> &get_awaited_expr () { return awaited_expr; }
+
   ExprType get_expression_type () const final override
   {
     return ExprType::Await;
@@ -3809,6 +3811,9 @@ public:
 
   Location get_locus () const override final { return locus; }
 
+  bool get_has_move () const { return has_move; }
+  std::unique_ptr<BlockExpr> &get_block_expr () { return block_expr; }
+
   void accept_vis (HIRFullVisitor &vis) override;
   void accept_vis (HIRExpressionVisitor &vis) override;
 
index 13e933bbe18460083b1f487e417c1d16db1a0f05..c719a7b03b8758fef3087f75e8e20f2bedff3cbd 100644 (file)
@@ -1965,6 +1965,7 @@ public:
   }
 
   std::vector<std::unique_ptr<EnumItem>> &get_variants () { return items; }
+  WhereClause &get_where_clause () { return where_clause; }
 
 protected:
   /* Use covariance to implement clone function as returning this object
@@ -2638,7 +2639,10 @@ public:
     return trait_items;
   }
 
+  WhereClause &get_where_clause () { return where_clause; }
+
   Identifier get_name () const { return name; }
+  bool is_unsafe () const { return unsafety == Unsafety::Unsafe; }
 
   // Mega-constructor
   Trait (Analysis::NodeMapping mappings, Identifier name, Unsafety unsafety,
@@ -2894,6 +2898,7 @@ public:
   virtual void accept_vis (HIRFullVisitor &vis) = 0;
   virtual void accept_vis (HIRExternalItemVisitor &vis) = 0;
 
+  Visibility &get_visibility () { return visibility; }
   Analysis::NodeMapping get_mappings () const { return mappings; }
 
   Identifier get_item_name () const { return item_name; }