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] ast: Add location info to MetaWord Date: Wed, 8 Jun 2022 12:39:24 +0000 (GMT) [thread overview] Message-ID: <20220608123924.613FF381A7F7@sourceware.org> (raw) 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; }
reply other threads:[~2022-06-08 12:39 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=20220608123924.613FF381A7F7@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: linkBe 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).