aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/hir
diff options
context:
space:
mode:
authorNirmal Patel <npate012@gmail.com>2021-10-29 14:27:50 -0400
committerNirmal Patel <npate012@gmail.com>2021-10-29 14:27:50 -0400
commita66dd96413432095ef13e6429f7acb3cb06f4f0f (patch)
treee20c3965e480c2ce76ee5276a2b8a3b96fd3ba9a /gcc/rust/hir
parentcba61d8dcbe1ac0fb23a96b2974541b201292465 (diff)
downloadgcc-a66dd96413432095ef13e6429f7acb3cb06f4f0f.zip
gcc-a66dd96413432095ef13e6429f7acb3cb06f4f0f.tar.gz
gcc-a66dd96413432095ef13e6429f7acb3cb06f4f0f.tar.bz2
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 <npate012@gmail.com>
Diffstat (limited to 'gcc/rust/hir')
-rw-r--r--gcc/rust/hir/rust-ast-lower-type.h3
-rw-r--r--gcc/rust/hir/tree/rust-hir-item.h6
2 files changed, 6 insertions, 3 deletions
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<Type> bound_type;
std::vector<std::unique_ptr<TypeParamBound>> 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<LifetimeParam> for_lifetimes,
std::unique_ptr<Type> bound_type,
- std::vector<std::unique_ptr<TypeParamBound>> type_param_bounds)
+ std::vector<std::unique_ptr<TypeParamBound>> 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