public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/rust/master] array-values: 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:c6daece64782fd5f03f573b4633d1826794a9f8a
commit c6daece64782fd5f03f573b4633d1826794a9f8a
Author: Arthur Cohen <arthur.cohen@embecosm.com>
Date: Thu Feb 17 15:27:52 2022 +0100
array-values: Add location info
Diff:
---
gcc/rust/ast/rust-expr.h | 7 +++----
gcc/rust/parse/rust-parse-impl.h | 6 +++---
2 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/gcc/rust/ast/rust-expr.h b/gcc/rust/ast/rust-expr.h
index 3f3ed5cd7ee..67ef92f8d39 100644
--- a/gcc/rust/ast/rust-expr.h
+++ b/gcc/rust/ast/rust-expr.h
@@ -953,12 +953,11 @@ protected:
class ArrayElemsValues : public ArrayElems
{
std::vector<std::unique_ptr<Expr> > values;
-
- // TODO: should this store location data?
+ Location locus;
public:
- ArrayElemsValues (std::vector<std::unique_ptr<Expr> > elems)
- : ArrayElems (), values (std::move (elems))
+ ArrayElemsValues (std::vector<std::unique_ptr<Expr> > elems, Location locus)
+ : ArrayElems (), values (std::move (elems)), locus (locus)
{}
// copy constructor with vector clone
diff --git a/gcc/rust/parse/rust-parse-impl.h b/gcc/rust/parse/rust-parse-impl.h
index 3d1f58bf153..c4a508062a5 100644
--- a/gcc/rust/parse/rust-parse-impl.h
+++ b/gcc/rust/parse/rust-parse-impl.h
@@ -8739,7 +8739,7 @@ Parser<ManagedTokenSource>::parse_array_expr (AST::AttrVec outer_attrs,
std::vector<std::unique_ptr<AST::Expr>> exprs;
auto array_elems
- = Rust::make_unique<AST::ArrayElemsValues> (std::move (exprs));
+ = Rust::make_unique<AST::ArrayElemsValues> (std::move (exprs), locus);
return Rust::make_unique<AST::ArrayExpr> (std::move (array_elems),
std::move (inner_attrs),
std::move (outer_attrs), locus);
@@ -8799,7 +8799,7 @@ Parser<ManagedTokenSource>::parse_array_expr (AST::AttrVec outer_attrs,
skip_token (RIGHT_SQUARE);
std::unique_ptr<AST::ArrayElemsValues> array_elems (
- new AST::ArrayElemsValues (std::move (exprs)));
+ new AST::ArrayElemsValues (std::move (exprs), locus));
return std::unique_ptr<AST::ArrayExpr> (
new AST::ArrayExpr (std::move (array_elems),
std::move (inner_attrs),
@@ -8841,7 +8841,7 @@ Parser<ManagedTokenSource>::parse_array_expr (AST::AttrVec outer_attrs,
exprs.shrink_to_fit ();
std::unique_ptr<AST::ArrayElemsValues> array_elems (
- new AST::ArrayElemsValues (std::move (exprs)));
+ new AST::ArrayElemsValues (std::move (exprs), locus));
return std::unique_ptr<AST::ArrayExpr> (
new AST::ArrayExpr (std::move (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-values: 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).