public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Thomas Schwinge <tschwinge@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc/devel/rust/master] hir: SimplePath: Add location info
Date: Wed,  8 Jun 2022 12:43:23 +0000 (GMT)	[thread overview]
Message-ID: <20220608124323.1D99738936C8@sourceware.org> (raw)

https://gcc.gnu.org/g:52b5286a69d86a36e279bc636cc41cbdd6795dee

commit 52b5286a69d86a36e279bc636cc41cbdd6795dee
Author: Arthur Cohen <arthur.cohen@embecosm.com>
Date:   Mon May 2 14:25:54 2022 +0200

    hir: SimplePath: Add location info

Diff:
---
 gcc/rust/hir/rust-ast-lower-item.cc | 3 ++-
 gcc/rust/hir/tree/rust-hir-item.h   | 4 +---
 gcc/rust/hir/tree/rust-hir-path.h   | 9 ++++++---
 3 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/gcc/rust/hir/rust-ast-lower-item.cc b/gcc/rust/hir/rust-ast-lower-item.cc
index 45072d36a7a..0d59d7f6f94 100644
--- a/gcc/rust/hir/rust-ast-lower-item.cc
+++ b/gcc/rust/hir/rust-ast-lower-item.cc
@@ -61,7 +61,8 @@ ASTLoweringSimplePath::lower (const AST::SimplePath &path)
 					mappings->get_next_hir_id (crate_num),
 					UNKNOWN_LOCAL_DEFID);
 
-  auto lowered = HIR::SimplePath (std::move (segments), mapping);
+  auto lowered
+    = HIR::SimplePath (std::move (segments), mapping, path.get_locus ());
 
   mappings->insert_node_to_hir (crate_num, node_id, mapping.get_hirid ());
   mappings->insert_simple_path (crate_num, node_id, &path);
diff --git a/gcc/rust/hir/tree/rust-hir-item.h b/gcc/rust/hir/tree/rust-hir-item.h
index c1dcf7651f5..5f664af17eb 100644
--- a/gcc/rust/hir/tree/rust-hir-item.h
+++ b/gcc/rust/hir/tree/rust-hir-item.h
@@ -581,9 +581,7 @@ public:
   // Creates an error visibility.
   static Visibility create_error ()
   {
-    return Visibility (ERROR,
-		       HIR::SimplePath ({},
-					Analysis::NodeMapping::get_error ()));
+    return Visibility (ERROR, HIR::SimplePath::create_error ());
   }
 
   VisType get_vis_type () const { return vis_type; }
diff --git a/gcc/rust/hir/tree/rust-hir-path.h b/gcc/rust/hir/tree/rust-hir-path.h
index e3ad8384252..d153eae1c61 100644
--- a/gcc/rust/hir/tree/rust-hir-path.h
+++ b/gcc/rust/hir/tree/rust-hir-path.h
@@ -961,19 +961,22 @@ class SimplePath
 {
   std::vector<SimplePathSegment> segments;
   Analysis::NodeMapping mappings;
+  Location locus;
 
 public:
   SimplePath (std::vector<SimplePathSegment> segments,
-	      Analysis::NodeMapping mappings)
-    : segments (std::move (segments)), mappings (mappings)
+	      Analysis::NodeMapping mappings, Location locus)
+    : segments (std::move (segments)), mappings (mappings), locus (locus)
   {}
 
   static HIR::SimplePath create_error ()
   {
-    return HIR::SimplePath ({}, Analysis::NodeMapping::get_error ());
+    return HIR::SimplePath ({}, Analysis::NodeMapping::get_error (),
+			    Location ());
   }
 
   const Analysis::NodeMapping &get_mappings () const { return mappings; }
+  const Location &get_locus () const { return locus; }
 };
 
 } // namespace HIR


                 reply	other threads:[~2022-06-08 12:43 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220608124323.1D99738936C8@sourceware.org \
    --to=tschwinge@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).