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

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

commit d120c9db1811752e543ef8c231c1501a63dfcea2
Author: Arthur Cohen <arthur.cohen@embecosm.com>
Date:   Thu Feb 17 15:36:21 2022 +0100

    array-copy-init: Add location info

Diff:
---
 gcc/rust/ast/rust-expr.h         | 7 +++----
 gcc/rust/parse/rust-parse-impl.h | 2 +-
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/gcc/rust/ast/rust-expr.h b/gcc/rust/ast/rust-expr.h
index 67ef92f8d39..bacf1cd6aae 100644
--- a/gcc/rust/ast/rust-expr.h
+++ b/gcc/rust/ast/rust-expr.h
@@ -1007,15 +1007,14 @@ class ArrayElemsCopied : public ArrayElems
 {
   std::unique_ptr<Expr> elem_to_copy;
   std::unique_ptr<Expr> num_copies;
-
-  // TODO: should this store location data?
+  Location locus;
 
 public:
   // Constructor requires pointers for polymorphism
   ArrayElemsCopied (std::unique_ptr<Expr> copied_elem,
-		    std::unique_ptr<Expr> copy_amount)
+		    std::unique_ptr<Expr> copy_amount, Location locus)
     : ArrayElems (), elem_to_copy (std::move (copied_elem)),
-      num_copies (std::move (copy_amount))
+      num_copies (std::move (copy_amount)), locus (locus)
   {}
 
   // Copy constructor required due to unique_ptr - uses custom clone
diff --git a/gcc/rust/parse/rust-parse-impl.h b/gcc/rust/parse/rust-parse-impl.h
index c4a508062a5..8703ecb8dd6 100644
--- a/gcc/rust/parse/rust-parse-impl.h
+++ b/gcc/rust/parse/rust-parse-impl.h
@@ -8782,7 +8782,7 @@ Parser<ManagedTokenSource>::parse_array_expr (AST::AttrVec outer_attrs,
 
 	  std::unique_ptr<AST::ArrayElemsCopied> copied_array_elems (
 	    new AST::ArrayElemsCopied (std::move (initial_expr),
-				       std::move (copy_amount)));
+				       std::move (copy_amount), locus));
 	  return std::unique_ptr<AST::ArrayExpr> (
 	    new AST::ArrayExpr (std::move (copied_array_elems),
 				std::move (inner_attrs),


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

only message in thread, other threads:[~2022-06-08 12:08 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:08 [gcc/devel/rust/master] array-copy-init: Add location info 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).