From a66dd96413432095ef13e6429f7acb3cb06f4f0f Mon Sep 17 00:00:00 2001 From: Nirmal Patel Date: Fri, 29 Oct 2021 14:27:50 -0400 Subject: Add location info in AST::TypeBoundWhereClauseItem and HIR::TypeBoundWhereClauseItem Location info has been added to AST::TypeBoundWhereClauseItem and HIR::TypeBoundWhereClauseItem. parse_type_bound_where_clause_item () has been modified to fetch location info and store it in AST::TypeBoundWhereClauseItem Fixes #766 Signed-off-by: Nirmal Patel --- gcc/rust/hir/rust-ast-lower-type.h | 3 ++- gcc/rust/hir/tree/rust-hir-item.h | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'gcc/rust/hir') diff --git a/gcc/rust/hir/rust-ast-lower-type.h b/gcc/rust/hir/rust-ast-lower-type.h index 8205d07..f44825c 100644 --- a/gcc/rust/hir/rust-ast-lower-type.h +++ b/gcc/rust/hir/rust-ast-lower-type.h @@ -479,7 +479,8 @@ public: translated = new HIR::TypeBoundWhereClauseItem (mapping, std::move (for_lifetimes), std::move (bound_type), - std::move (type_param_bounds)); + std::move (type_param_bounds), + item.get_locus ()); } private: diff --git a/gcc/rust/hir/tree/rust-hir-item.h b/gcc/rust/hir/tree/rust-hir-item.h index 21f0781..9b8793f 100644 --- a/gcc/rust/hir/tree/rust-hir-item.h +++ b/gcc/rust/hir/tree/rust-hir-item.h @@ -218,6 +218,7 @@ class TypeBoundWhereClauseItem : public WhereClauseItem std::unique_ptr bound_type; std::vector> type_param_bounds; Analysis::NodeMapping mappings; + Location locus; public: // Returns whether the item has ForLifetimes @@ -229,11 +230,12 @@ public: TypeBoundWhereClauseItem ( Analysis::NodeMapping mappings, std::vector for_lifetimes, std::unique_ptr bound_type, - std::vector> type_param_bounds) + std::vector> type_param_bounds, + Location locus) : for_lifetimes (std::move (for_lifetimes)), bound_type (std::move (bound_type)), type_param_bounds (std::move (type_param_bounds)), - mappings (std::move (mappings)) + mappings (std::move (mappings)), locus (locus) {} // Copy constructor requires clone -- cgit v1.1