]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: Add locus getters
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Fri, 27 Jun 2025 11:31:17 +0000 (13:31 +0200)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 5 Aug 2025 14:36:52 +0000 (16:36 +0200)
gcc/rust/ChangeLog:

* ast/rust-expr.h: Add getter to locus field.
* ast/rust-pattern.h (tokenid_to_rangekind): Likewise.
* hir/tree/rust-hir-item.h: Likewise.
* hir/tree/rust-hir-visibility.h: Likewise.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
gcc/rust/ast/rust-expr.h
gcc/rust/ast/rust-pattern.h
gcc/rust/hir/tree/rust-hir-item.h
gcc/rust/hir/tree/rust-hir-visibility.h

index 8f44d5878bbf2841f6244e4c665d59b65c58ebf1..21e856bb1d0e9342a1707607fd51bfd1263478f0 100644 (file)
@@ -1192,6 +1192,8 @@ public:
 
   std::string as_string () const override;
 
+  location_t get_locus () const { return locus; }
+
   void accept_vis (ASTVisitor &vis) override;
 
   // TODO: this mutable getter seems really dodgy. Think up better way.
@@ -1248,6 +1250,8 @@ public:
 
   std::string as_string () const override;
 
+  location_t get_locus () const { return locus; }
+
   void accept_vis (ASTVisitor &vis) override;
 
   // TODO: is this better? Or is a "vis_block" better?
@@ -1777,6 +1781,8 @@ public:
 
   std::string as_string () const;
 
+  location_t get_locus () const { return locus; }
+
   // TODO: is this better? Or is a "vis_block" better?
   Expr &get_base_struct ()
   {
index b9c0fd9bb2f14e610f09831636209c46310dda3e..57c065ff69559bb554633ecb2b3d8401de1049ef 100644 (file)
@@ -948,7 +948,7 @@ public:
    * is empty). */
   bool has_struct_pattern_elems () const { return !elems.is_empty (); }
 
-  location_t get_locus () const override { return path.get_locus (); }
+  location_t get_locus () const override { return locus; }
 
   void accept_vis (ASTVisitor &vis) override;
 
index 8cedfe8647dce66de38cb2da40fcd417436841e6..d9df6029c5ace5f644ad279f48f95a35f1de0f96 100644 (file)
@@ -209,6 +209,8 @@ public:
 
   std::string as_string () const override;
 
+  location_t get_locus () const { return locus; }
+
   void accept_vis (HIRFullVisitor &vis) override;
 
   Lifetime &get_lifetime () { return lifetime; }
index a750d88f284dcde163adc5af5c8aed431660f0fd..9dd6ff292674bbcf5764f74bfdca840ca62730f6 100644 (file)
@@ -73,6 +73,8 @@ public:
   }
 
   std::string as_string () const;
+
+  location_t get_locus () const { return locus; }
 };
 } // namespace HIR
 } // namespace Rust