From: Pierre-Emmanuel Patry <pierre-emmanuel.pa...@embecosm.com>

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.pa...@embecosm.com>
---
 gcc/rust/ast/rust-expr.h                | 6 ++++++
 gcc/rust/ast/rust-pattern.h             | 2 +-
 gcc/rust/hir/tree/rust-hir-item.h       | 2 ++
 gcc/rust/hir/tree/rust-hir-visibility.h | 2 ++
 4 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/gcc/rust/ast/rust-expr.h b/gcc/rust/ast/rust-expr.h
index 8f44d5878bb..21e856bb1d0 100644
--- a/gcc/rust/ast/rust-expr.h
+++ b/gcc/rust/ast/rust-expr.h
@@ -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 ()
   {
diff --git a/gcc/rust/ast/rust-pattern.h b/gcc/rust/ast/rust-pattern.h
index b9c0fd9bb2f..57c065ff695 100644
--- a/gcc/rust/ast/rust-pattern.h
+++ b/gcc/rust/ast/rust-pattern.h
@@ -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;
 
diff --git a/gcc/rust/hir/tree/rust-hir-item.h 
b/gcc/rust/hir/tree/rust-hir-item.h
index 8cedfe8647d..d9df6029c5a 100644
--- a/gcc/rust/hir/tree/rust-hir-item.h
+++ b/gcc/rust/hir/tree/rust-hir-item.h
@@ -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; }
diff --git a/gcc/rust/hir/tree/rust-hir-visibility.h 
b/gcc/rust/hir/tree/rust-hir-visibility.h
index a750d88f284..9dd6ff29267 100644
--- a/gcc/rust/hir/tree/rust-hir-visibility.h
+++ b/gcc/rust/hir/tree/rust-hir-visibility.h
@@ -73,6 +73,8 @@ public:
   }
 
   std::string as_string () const;
+
+  location_t get_locus () const { return locus; }
 };
 } // namespace HIR
 } // namespace Rust
-- 
2.49.0

Reply via email to