public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/rust/master] ast: Add location info to MetaWord
@ 2022-06-08 12:39 Thomas Schwinge
  0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2022-06-08 12:39 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:ffb38df2eb370eacdf35f6273d6c450eb4940a21

commit ffb38df2eb370eacdf35f6273d6c450eb4940a21
Author: Arthur Cohen <arthur.cohen@embecosm.com>
Date:   Thu Apr 28 10:05:55 2022 +0200

    ast: Add location info to MetaWord

Diff:
---
 gcc/rust/ast/rust-ast-full-test.cc | 5 ++---
 gcc/rust/ast/rust-macro.h          | 5 ++++-
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/gcc/rust/ast/rust-ast-full-test.cc b/gcc/rust/ast/rust-ast-full-test.cc
index 5c8e04fcbbc..f15a1913717 100644
--- a/gcc/rust/ast/rust-ast-full-test.cc
+++ b/gcc/rust/ast/rust-ast-full-test.cc
@@ -4125,7 +4125,7 @@ AttributeParser::parse_meta_item_inner ()
       skip_token ();
       // FIXME: We probably need a Location here as well
       return std::unique_ptr<MetaWord> (
-	new MetaWord (identifier->as_string ()));
+	new MetaWord (identifier->as_string (), identifier->get_locus ()));
     }
 
   if (peek_token (1)->get_id () == EQUAL)
@@ -4731,8 +4731,7 @@ MetaItemSeq::to_attribute () const
 Attribute
 MetaWord::to_attribute () const
 {
-  // FIXME: How do we get a location here?
-  return Attribute (SimplePath::from_str (ident, Location ()), nullptr);
+  return Attribute (SimplePath::from_str (ident, ident_locus), nullptr);
 }
 
 Attribute
diff --git a/gcc/rust/ast/rust-macro.h b/gcc/rust/ast/rust-macro.h
index 4b0a41217a0..5270d11ee61 100644
--- a/gcc/rust/ast/rust-macro.h
+++ b/gcc/rust/ast/rust-macro.h
@@ -759,9 +759,12 @@ protected:
 class MetaWord : public MetaItem
 {
   Identifier ident;
+  Location ident_locus;
 
 public:
-  MetaWord (Identifier ident) : ident (std::move (ident)) {}
+  MetaWord (Identifier ident, Location ident_locus)
+    : ident (std::move (ident)), ident_locus (ident_locus)
+  {}
 
   std::string as_string () const override { return ident; }


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-06-08 12:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-08 12:39 [gcc/devel/rust/master] ast: Add location info to MetaWord Thomas Schwinge

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).