aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/hir/tree
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/rust/hir/tree')
-rw-r--r--gcc/rust/hir/tree/rust-hir-expr.h181
-rw-r--r--gcc/rust/hir/tree/rust-hir-item.h137
-rw-r--r--gcc/rust/hir/tree/rust-hir-path.h52
-rw-r--r--gcc/rust/hir/tree/rust-hir-pattern.h48
-rw-r--r--gcc/rust/hir/tree/rust-hir-stmt.h14
-rw-r--r--gcc/rust/hir/tree/rust-hir-type.h35
-rw-r--r--gcc/rust/hir/tree/rust-hir.cc2
-rw-r--r--gcc/rust/hir/tree/rust-hir.h18
8 files changed, 246 insertions, 241 deletions
diff --git a/gcc/rust/hir/tree/rust-hir-expr.h b/gcc/rust/hir/tree/rust-hir-expr.h
index 46d7a80..f4f08d5 100644
--- a/gcc/rust/hir/tree/rust-hir-expr.h
+++ b/gcc/rust/hir/tree/rust-hir-expr.h
@@ -64,7 +64,7 @@ public:
class LiteralExpr : public ExprWithoutBlock
{
Literal literal;
- Location locus;
+ location_t locus;
public:
std::string as_string () const override
@@ -77,13 +77,13 @@ public:
LiteralExpr (Analysis::NodeMapping mappings, std::string value_as_string,
Literal::LitType type, PrimitiveCoreType type_hint,
- Location locus, AST::AttrVec outer_attrs)
+ location_t locus, AST::AttrVec outer_attrs)
: ExprWithoutBlock (std::move (mappings), std::move (outer_attrs)),
literal (std::move (value_as_string), type, type_hint), locus (locus)
{}
- LiteralExpr (Analysis::NodeMapping mappings, Literal literal, Location locus,
- AST::AttrVec outer_attrs)
+ LiteralExpr (Analysis::NodeMapping mappings, Literal literal,
+ location_t locus, AST::AttrVec outer_attrs)
: ExprWithoutBlock (std::move (mappings), std::move (outer_attrs)),
literal (std::move (literal)), locus (locus)
{}
@@ -133,7 +133,7 @@ class OperatorExpr : public ExprWithoutBlock
{
// TODO: create binary and unary operator subclasses?
public:
- Location locus;
+ location_t locus;
protected:
/* Variable must be protected to allow derived classes to use it as a first
@@ -143,7 +143,7 @@ protected:
// Constructor (only for initialisation of expr purposes)
OperatorExpr (Analysis::NodeMapping mappings,
std::unique_ptr<Expr> main_or_left_expr,
- AST::AttrVec outer_attribs, Location locus)
+ AST::AttrVec outer_attribs, location_t locus)
: ExprWithoutBlock (std::move (mappings), std::move (outer_attribs)),
locus (locus), main_or_left_expr (std::move (main_or_left_expr))
{}
@@ -192,7 +192,7 @@ public:
BorrowExpr (Analysis::NodeMapping mappings,
std::unique_ptr<Expr> borrow_lvalue, Mutability mut,
- AST::AttrVec outer_attribs, Location locus)
+ AST::AttrVec outer_attribs, location_t locus)
: OperatorExpr (std::move (mappings), std::move (borrow_lvalue),
std::move (outer_attribs), locus),
mut (mut)
@@ -231,7 +231,7 @@ public:
// Constructor calls OperatorExpr's protected constructor
DereferenceExpr (Analysis::NodeMapping mappings,
std::unique_ptr<Expr> deref_lvalue,
- AST::AttrVec outer_attribs, Location locus)
+ AST::AttrVec outer_attribs, location_t locus)
: OperatorExpr (std::move (mappings), std::move (deref_lvalue),
std::move (outer_attribs), locus)
{}
@@ -264,7 +264,7 @@ public:
// Constructor calls OperatorExpr's protected constructor
ErrorPropagationExpr (Analysis::NodeMapping mappings,
std::unique_ptr<Expr> potential_error_value,
- AST::AttrVec outer_attribs, Location locus)
+ AST::AttrVec outer_attribs, location_t locus)
: OperatorExpr (std::move (mappings), std::move (potential_error_value),
std::move (outer_attribs), locus)
{}
@@ -308,7 +308,7 @@ public:
// Constructor calls OperatorExpr's protected constructor
NegationExpr (Analysis::NodeMapping mappings,
std::unique_ptr<Expr> negated_value, ExprType expr_kind,
- AST::AttrVec outer_attribs, Location locus)
+ AST::AttrVec outer_attribs, location_t locus)
: OperatorExpr (std::move (mappings), std::move (negated_value),
std::move (outer_attribs), locus),
expr_type (expr_kind)
@@ -354,7 +354,7 @@ public:
ArithmeticOrLogicalExpr (Analysis::NodeMapping mappings,
std::unique_ptr<Expr> left_value,
std::unique_ptr<Expr> right_value,
- ExprType expr_kind, Location locus)
+ ExprType expr_kind, location_t locus)
: OperatorExpr (std::move (mappings), std::move (left_value),
AST::AttrVec (), locus),
expr_type (expr_kind), right_expr (std::move (right_value))
@@ -429,7 +429,7 @@ public:
ComparisonExpr (Analysis::NodeMapping mappings,
std::unique_ptr<Expr> left_value,
std::unique_ptr<Expr> right_value, ExprType comparison_kind,
- Location locus)
+ location_t locus)
: OperatorExpr (std::move (mappings), std::move (left_value),
AST::AttrVec (), locus),
expr_type (comparison_kind), right_expr (std::move (right_value))
@@ -500,7 +500,7 @@ public:
LazyBooleanExpr (Analysis::NodeMapping mappings,
std::unique_ptr<Expr> left_bool_expr,
std::unique_ptr<Expr> right_bool_expr, ExprType expr_kind,
- Location locus)
+ location_t locus)
: OperatorExpr (std::move (mappings), std::move (left_bool_expr),
AST::AttrVec (), locus),
expr_type (expr_kind), right_expr (std::move (right_bool_expr))
@@ -566,7 +566,7 @@ public:
// Constructor requires calling protected constructor of OperatorExpr
TypeCastExpr (Analysis::NodeMapping mappings,
std::unique_ptr<Expr> expr_to_cast,
- std::unique_ptr<Type> type_to_cast_to, Location locus)
+ std::unique_ptr<Type> type_to_cast_to, location_t locus)
: OperatorExpr (std::move (mappings), std::move (expr_to_cast),
AST::AttrVec (), locus),
type_to_convert_to (std::move (type_to_cast_to))
@@ -631,7 +631,7 @@ public:
// Call OperatorExpr constructor to initialise left_expr
AssignmentExpr (Analysis::NodeMapping mappings,
std::unique_ptr<Expr> value_to_assign_to,
- std::unique_ptr<Expr> value_to_assign, Location locus)
+ std::unique_ptr<Expr> value_to_assign, location_t locus)
: OperatorExpr (std::move (mappings), std::move (value_to_assign_to),
AST::AttrVec (), locus),
right_expr (std::move (value_to_assign))
@@ -702,7 +702,7 @@ public:
CompoundAssignmentExpr (Analysis::NodeMapping mappings,
std::unique_ptr<Expr> value_to_assign_to,
std::unique_ptr<Expr> value_to_assign,
- ExprType expr_kind, Location locus)
+ ExprType expr_kind, location_t locus)
: OperatorExpr (std::move (mappings), std::move (value_to_assign_to),
AST::AttrVec (), locus),
expr_type (expr_kind), right_expr (std::move (value_to_assign))
@@ -755,7 +755,7 @@ class GroupedExpr : public ExprWithoutBlock, public WithInnerAttrs
{
std::unique_ptr<Expr> expr_in_parens;
- Location locus;
+ location_t locus;
public:
std::string as_string () const override;
@@ -763,7 +763,7 @@ public:
GroupedExpr (Analysis::NodeMapping mappings,
std::unique_ptr<Expr> parenthesised_expr,
AST::AttrVec inner_attribs, AST::AttrVec outer_attribs,
- Location locus)
+ location_t locus)
: ExprWithoutBlock (std::move (mappings), std::move (outer_attribs)),
WithInnerAttrs (std::move (inner_attribs)),
expr_in_parens (std::move (parenthesised_expr)), locus (locus)
@@ -969,7 +969,7 @@ class ArrayExpr : public ExprWithoutBlock, public WithInnerAttrs
{
std::unique_ptr<ArrayElems> internal_elements;
- Location locus;
+ location_t locus;
public:
std::string as_string () const override;
@@ -981,7 +981,7 @@ public:
ArrayExpr (Analysis::NodeMapping mappings,
std::unique_ptr<ArrayElems> array_elems,
AST::AttrVec inner_attribs, AST::AttrVec outer_attribs,
- Location locus)
+ location_t locus)
: ExprWithoutBlock (std::move (mappings), std::move (outer_attribs)),
WithInnerAttrs (std::move (inner_attribs)),
internal_elements (std::move (array_elems)), locus (locus)
@@ -1046,7 +1046,7 @@ class ArrayIndexExpr : public ExprWithoutBlock
std::unique_ptr<Expr> array_expr;
std::unique_ptr<Expr> index_expr;
- Location locus;
+ location_t locus;
public:
std::string as_string () const override;
@@ -1054,7 +1054,7 @@ public:
ArrayIndexExpr (Analysis::NodeMapping mappings,
std::unique_ptr<Expr> array_expr,
std::unique_ptr<Expr> array_index_expr,
- AST::AttrVec outer_attribs, Location locus)
+ AST::AttrVec outer_attribs, location_t locus)
: ExprWithoutBlock (std::move (mappings), std::move (outer_attribs)),
array_expr (std::move (array_expr)),
index_expr (std::move (array_index_expr)), locus (locus)
@@ -1117,7 +1117,7 @@ class TupleExpr : public ExprWithoutBlock, public WithInnerAttrs
std::vector<std::unique_ptr<Expr> > tuple_elems;
// replaces (inlined version of) TupleElements
- Location locus;
+ location_t locus;
public:
std::string as_string () const override;
@@ -1125,7 +1125,7 @@ public:
TupleExpr (Analysis::NodeMapping mappings,
std::vector<std::unique_ptr<Expr> > tuple_elements,
AST::AttrVec inner_attribs, AST::AttrVec outer_attribs,
- Location locus)
+ location_t locus)
: ExprWithoutBlock (std::move (mappings), std::move (outer_attribs)),
WithInnerAttrs (std::move (inner_attribs)),
tuple_elems (std::move (tuple_elements)), locus (locus)
@@ -1200,7 +1200,7 @@ class TupleIndexExpr : public ExprWithoutBlock
{
std::unique_ptr<Expr> tuple_expr;
TupleIndex tuple_index;
- Location locus;
+ location_t locus;
public:
std::string as_string () const override;
@@ -1209,7 +1209,7 @@ public:
TupleIndexExpr (Analysis::NodeMapping mappings,
std::unique_ptr<Expr> tuple_expr, TupleIndex index,
- AST::AttrVec outer_attribs, Location locus)
+ AST::AttrVec outer_attribs, location_t locus)
: ExprWithoutBlock (std::move (mappings), std::move (outer_attribs)),
tuple_expr (std::move (tuple_expr)), tuple_index (index), locus (locus)
{}
@@ -1291,7 +1291,7 @@ public:
// Actual HIR node of the struct creator (with no fields). Not abstract!
class StructExprStruct : public StructExpr, public WithInnerAttrs
{
- Location locus;
+ location_t locus;
public:
std::string as_string () const override;
@@ -1299,7 +1299,7 @@ public:
// Constructor has to call protected constructor of base class
StructExprStruct (Analysis::NodeMapping mappings,
PathInExpression struct_path, AST::AttrVec inner_attribs,
- AST::AttrVec outer_attribs, Location locus)
+ AST::AttrVec outer_attribs, location_t locus)
: StructExpr (std::move (mappings), std::move (struct_path),
std::move (outer_attribs)),
WithInnerAttrs (std::move (inner_attribs)), locus (locus)
@@ -1408,12 +1408,12 @@ protected:
// pure virtual clone implementation
virtual StructExprField *clone_struct_expr_field_impl () const = 0;
- StructExprField (Analysis::NodeMapping mapping, Location locus)
+ StructExprField (Analysis::NodeMapping mapping, location_t locus)
: mappings (mapping), locus (locus)
{}
Analysis::NodeMapping mappings;
- Location locus;
+ location_t locus;
};
// Identifier-only variant of StructExprField HIR node
@@ -1425,7 +1425,7 @@ private:
// TODO: should this store location data?
public:
StructExprFieldIdentifier (Analysis::NodeMapping mapping,
- Identifier field_identifier, Location locus)
+ Identifier field_identifier, location_t locus)
: StructExprField (mapping, locus),
field_name (std::move (field_identifier))
{}
@@ -1459,7 +1459,7 @@ class StructExprFieldWithVal : public StructExprField
protected:
StructExprFieldWithVal (Analysis::NodeMapping mapping,
- std::unique_ptr<Expr> field_value, Location locus)
+ std::unique_ptr<Expr> field_value, location_t locus)
: StructExprField (mapping, locus), value (std::move (field_value))
{}
@@ -1500,7 +1500,7 @@ public:
StructExprFieldIdentifierValue (Analysis::NodeMapping mapping,
Identifier field_identifier,
std::unique_ptr<Expr> field_value,
- Location locus)
+ location_t locus)
: StructExprFieldWithVal (mapping, std::move (field_value), locus),
field_name (std::move (field_identifier))
{}
@@ -1534,7 +1534,8 @@ public:
StructExprFieldIndexValue (Analysis::NodeMapping mapping,
TupleIndex tuple_index,
- std::unique_ptr<Expr> field_value, Location locus)
+ std::unique_ptr<Expr> field_value,
+ location_t locus)
: StructExprFieldWithVal (mapping, std::move (field_value), locus),
index (tuple_index)
{}
@@ -1582,8 +1583,9 @@ public:
// Constructor for StructExprStructFields when no struct base is used
StructExprStructFields (
Analysis::NodeMapping mappings, PathInExpression struct_path,
- std::vector<std::unique_ptr<StructExprField> > expr_fields, Location locus,
- StructBase *base_struct, AST::AttrVec inner_attribs = AST::AttrVec (),
+ std::vector<std::unique_ptr<StructExprField> > expr_fields,
+ location_t locus, StructBase *base_struct,
+ AST::AttrVec inner_attribs = AST::AttrVec (),
AST::AttrVec outer_attribs = AST::AttrVec ())
: StructExprStruct (std::move (mappings), std::move (struct_path),
std::move (inner_attribs), std::move (outer_attribs),
@@ -1671,7 +1673,7 @@ public:
StructExprStructBase (Analysis::NodeMapping mappings,
PathInExpression struct_path, StructBase base_struct,
AST::AttrVec inner_attribs, AST::AttrVec outer_attribs,
- Location locus)
+ location_t locus)
: StructExprStruct (std::move (mappings), std::move (struct_path),
std::move (inner_attribs), std::move (outer_attribs),
locus),
@@ -1704,14 +1706,14 @@ class CallExpr : public ExprWithoutBlock
{
std::unique_ptr<Expr> function;
std::vector<std::unique_ptr<Expr> > params;
- Location locus;
+ location_t locus;
public:
std::string as_string () const override;
CallExpr (Analysis::NodeMapping mappings, std::unique_ptr<Expr> function_expr,
std::vector<std::unique_ptr<Expr> > function_params,
- AST::AttrVec outer_attribs, Location locus)
+ AST::AttrVec outer_attribs, location_t locus)
: ExprWithoutBlock (std::move (mappings), std::move (outer_attribs)),
function (std::move (function_expr)),
params (std::move (function_params)), locus (locus)
@@ -1790,7 +1792,7 @@ class MethodCallExpr : public ExprWithoutBlock
std::unique_ptr<Expr> receiver;
PathExprSegment method_name;
std::vector<std::unique_ptr<Expr> > params;
- Location locus;
+ location_t locus;
public:
std::string as_string () const override;
@@ -1799,7 +1801,7 @@ public:
std::unique_ptr<Expr> call_receiver,
PathExprSegment method_path,
std::vector<std::unique_ptr<Expr> > method_params,
- AST::AttrVec outer_attribs, Location locus)
+ AST::AttrVec outer_attribs, location_t locus)
: ExprWithoutBlock (std::move (mappings), std::move (outer_attribs)),
receiver (std::move (call_receiver)),
method_name (std::move (method_path)), params (std::move (method_params)),
@@ -1885,7 +1887,7 @@ class FieldAccessExpr : public ExprWithoutBlock
std::unique_ptr<Expr> receiver;
Identifier field;
- Location locus;
+ location_t locus;
public:
std::string as_string () const override;
@@ -1893,7 +1895,7 @@ public:
FieldAccessExpr (Analysis::NodeMapping mappings,
std::unique_ptr<Expr> field_access_receiver,
Identifier field_name, AST::AttrVec outer_attribs,
- Location locus)
+ location_t locus)
: ExprWithoutBlock (std::move (mappings), std::move (outer_attribs)),
receiver (std::move (field_access_receiver)),
field (std::move (field_name)), locus (locus)
@@ -1958,14 +1960,14 @@ private:
std::vector<AST::Attribute> outer_attrs;
std::unique_ptr<Pattern> pattern;
std::unique_ptr<Type> type;
- Location locus;
+ location_t locus;
public:
// Returns whether the type of the parameter has been given.
bool has_type_given () const { return type != nullptr; }
// Constructor for closure parameter
- ClosureParam (std::unique_ptr<Pattern> param_pattern, Location locus,
+ ClosureParam (std::unique_ptr<Pattern> param_pattern, location_t locus,
std::unique_ptr<Type> param_type = nullptr,
std::vector<AST::Attribute> outer_attrs = {})
: outer_attrs (std::move (outer_attrs)),
@@ -2029,7 +2031,7 @@ class ClosureExpr : public ExprWithoutBlock
private:
bool has_move;
std::vector<ClosureParam> params;
- Location locus;
+ location_t locus;
std::unique_ptr<Type> return_type;
std::unique_ptr<Expr> expr;
@@ -2038,7 +2040,7 @@ public:
std::vector<ClosureParam> closure_params,
std::unique_ptr<Type> closure_return_type,
std::unique_ptr<Expr> closure_expr, bool has_move,
- AST::AttrVec outer_attribs, Location locus)
+ AST::AttrVec outer_attribs, location_t locus)
: ExprWithoutBlock (std::move (mappings), std::move (outer_attribs)),
has_move (has_move), params (std::move (closure_params)), locus (locus),
return_type (std::move (closure_return_type)),
@@ -2236,7 +2238,7 @@ protected:
class ContinueExpr : public ExprWithoutBlock
{
Lifetime label;
- Location locus;
+ location_t locus;
public:
std::string as_string () const override;
@@ -2245,8 +2247,8 @@ public:
bool has_label () const { return !label.is_error (); }
// Constructor for a ContinueExpr with a label.
- ContinueExpr (Analysis::NodeMapping mappings, Location locus, Lifetime label,
- AST::AttrVec outer_attribs = AST::AttrVec ())
+ ContinueExpr (Analysis::NodeMapping mappings, location_t locus,
+ Lifetime label, AST::AttrVec outer_attribs = AST::AttrVec ())
: ExprWithoutBlock (std::move (mappings), std::move (outer_attribs)),
label (std::move (label)), locus (locus)
{}
@@ -2288,7 +2290,7 @@ class BreakExpr : public ExprWithoutBlock
// bool has_break_expr;
std::unique_ptr<Expr> break_expr;
- Location locus;
+ location_t locus;
public:
std::string as_string () const override;
@@ -2301,7 +2303,7 @@ public:
bool has_break_expr () const { return break_expr != nullptr; }
// Constructor for a break expression
- BreakExpr (Analysis::NodeMapping mappings, Location locus,
+ BreakExpr (Analysis::NodeMapping mappings, location_t locus,
Lifetime break_label,
std::unique_ptr<Expr> expr_in_break = nullptr,
AST::AttrVec outer_attribs = AST::AttrVec ())
@@ -2365,11 +2367,11 @@ protected:
// Base range expression HIR node object - abstract
class RangeExpr : public ExprWithoutBlock
{
- Location locus;
+ location_t locus;
protected:
// outer attributes not allowed before range expressions
- RangeExpr (Analysis::NodeMapping mappings, Location locus)
+ RangeExpr (Analysis::NodeMapping mappings, location_t locus)
: ExprWithoutBlock (std::move (mappings), AST::AttrVec ()), locus (locus)
{}
@@ -2394,7 +2396,7 @@ public:
RangeFromToExpr (Analysis::NodeMapping mappings,
std::unique_ptr<Expr> range_from,
- std::unique_ptr<Expr> range_to, Location locus)
+ std::unique_ptr<Expr> range_to, location_t locus)
: RangeExpr (std::move (mappings), locus), from (std::move (range_from)),
to (std::move (range_to))
{}
@@ -2451,7 +2453,7 @@ public:
std::string as_string () const override;
RangeFromExpr (Analysis::NodeMapping mappings,
- std::unique_ptr<Expr> range_from, Location locus)
+ std::unique_ptr<Expr> range_from, location_t locus)
: RangeExpr (std::move (mappings), locus), from (std::move (range_from))
{}
@@ -2505,7 +2507,7 @@ public:
// outer attributes not allowed
RangeToExpr (Analysis::NodeMapping mappings, std::unique_ptr<Expr> range_to,
- Location locus)
+ location_t locus)
: RangeExpr (std::move (mappings), locus), to (std::move (range_to))
{}
@@ -2555,7 +2557,7 @@ class RangeFullExpr : public RangeExpr
public:
std::string as_string () const override;
- RangeFullExpr (Analysis::NodeMapping mappings, Location locus)
+ RangeFullExpr (Analysis::NodeMapping mappings, location_t locus)
: RangeExpr (std::move (mappings), locus)
{}
// outer attributes not allowed
@@ -2591,7 +2593,7 @@ public:
RangeFromToInclExpr (Analysis::NodeMapping mappings,
std::unique_ptr<Expr> range_from,
- std::unique_ptr<Expr> range_to, Location locus)
+ std::unique_ptr<Expr> range_to, location_t locus)
: RangeExpr (std::move (mappings), locus), from (std::move (range_from)),
to (std::move (range_to))
{}
@@ -2649,7 +2651,7 @@ public:
std::string as_string () const override;
RangeToInclExpr (Analysis::NodeMapping mappings,
- std::unique_ptr<Expr> range_to, Location locus)
+ std::unique_ptr<Expr> range_to, location_t locus)
: RangeExpr (std::move (mappings), locus), to (std::move (range_to))
{}
// outer attributes not allowed
@@ -2699,7 +2701,7 @@ class ReturnExpr : public ExprWithoutBlock
public:
std::unique_ptr<Expr> return_expr;
- Location locus;
+ location_t locus;
std::string as_string () const override;
@@ -2708,7 +2710,7 @@ public:
bool has_return_expr () const { return return_expr != nullptr; }
// Constructor for ReturnExpr.
- ReturnExpr (Analysis::NodeMapping mappings, Location locus,
+ ReturnExpr (Analysis::NodeMapping mappings, location_t locus,
std::unique_ptr<Expr> returned_expr = nullptr,
AST::AttrVec outer_attribs = AST::AttrVec ())
: ExprWithoutBlock (std::move (mappings), std::move (outer_attribs)),
@@ -2772,14 +2774,14 @@ class UnsafeBlockExpr : public ExprWithBlock
{
// Or just have it extend BlockExpr
std::unique_ptr<BlockExpr> expr;
- Location locus;
+ location_t locus;
public:
std::string as_string () const override;
UnsafeBlockExpr (Analysis::NodeMapping mappings,
std::unique_ptr<BlockExpr> block_expr,
- AST::AttrVec outer_attribs, Location locus)
+ AST::AttrVec outer_attribs, location_t locus)
: ExprWithBlock (std::move (mappings), std::move (outer_attribs)),
expr (std::move (block_expr)), locus (locus)
{}
@@ -2839,14 +2841,15 @@ class LoopLabel /*: public Node*/
{
Lifetime label; // or type LIFETIME_OR_LABEL
- Location locus;
+ location_t locus;
Analysis::NodeMapping mappings;
public:
std::string as_string () const;
- LoopLabel (Analysis::NodeMapping mapping, Lifetime loop_label, Location locus)
+ LoopLabel (Analysis::NodeMapping mapping, Lifetime loop_label,
+ location_t locus)
: label (std::move (loop_label)), locus (locus), mappings (mapping)
{}
@@ -2868,12 +2871,12 @@ protected:
std::unique_ptr<BlockExpr> loop_block;
private:
- Location locus;
+ location_t locus;
protected:
// Constructor for BaseLoopExpr
BaseLoopExpr (Analysis::NodeMapping mappings,
- std::unique_ptr<BlockExpr> loop_block, Location locus,
+ std::unique_ptr<BlockExpr> loop_block, location_t locus,
LoopLabel loop_label,
AST::AttrVec outer_attribs = AST::AttrVec ())
: ExprWithBlock (std::move (mappings), std::move (outer_attribs)),
@@ -2926,7 +2929,7 @@ public:
// Constructor for LoopExpr
LoopExpr (Analysis::NodeMapping mappings,
- std::unique_ptr<BlockExpr> loop_block, Location locus,
+ std::unique_ptr<BlockExpr> loop_block, location_t locus,
LoopLabel loop_label, AST::AttrVec outer_attribs = AST::AttrVec ())
: BaseLoopExpr (std::move (mappings), std::move (loop_block), locus,
std::move (loop_label), std::move (outer_attribs))
@@ -2959,7 +2962,7 @@ public:
// Constructor for while loop with loop label
WhileLoopExpr (Analysis::NodeMapping mappings,
std::unique_ptr<Expr> loop_condition,
- std::unique_ptr<BlockExpr> loop_block, Location locus,
+ std::unique_ptr<BlockExpr> loop_block, location_t locus,
LoopLabel loop_label,
AST::AttrVec outer_attribs = AST::AttrVec ())
: BaseLoopExpr (std::move (mappings), std::move (loop_block), locus,
@@ -3023,7 +3026,7 @@ public:
WhileLetLoopExpr (Analysis::NodeMapping mappings,
std::vector<std::unique_ptr<Pattern> > match_arm_patterns,
std::unique_ptr<Expr> condition,
- std::unique_ptr<BlockExpr> loop_block, Location locus,
+ std::unique_ptr<BlockExpr> loop_block, location_t locus,
LoopLabel loop_label,
AST::AttrVec outer_attribs = AST::AttrVec ())
: BaseLoopExpr (std::move (mappings), std::move (loop_block), locus,
@@ -3102,7 +3105,7 @@ public:
ForLoopExpr (Analysis::NodeMapping mappings,
std::unique_ptr<Pattern> loop_pattern,
std::unique_ptr<Expr> iterator_expr,
- std::unique_ptr<BlockExpr> loop_body, Location locus,
+ std::unique_ptr<BlockExpr> loop_body, location_t locus,
LoopLabel loop_label,
AST::AttrVec outer_attribs = AST::AttrVec ())
: BaseLoopExpr (std::move (mappings), std::move (loop_body), locus,
@@ -3165,13 +3168,13 @@ class IfExpr : public ExprWithBlock
std::unique_ptr<Expr> condition;
std::unique_ptr<BlockExpr> if_block;
- Location locus;
+ location_t locus;
public:
std::string as_string () const override;
IfExpr (Analysis::NodeMapping mappings, std::unique_ptr<Expr> condition,
- std::unique_ptr<BlockExpr> if_block, Location locus)
+ std::unique_ptr<BlockExpr> if_block, location_t locus)
: ExprWithBlock (std::move (mappings), AST::AttrVec ()),
condition (std::move (condition)), if_block (std::move (if_block)),
locus (locus)
@@ -3249,7 +3252,7 @@ public:
IfExprConseqElse (Analysis::NodeMapping mappings,
std::unique_ptr<Expr> condition,
std::unique_ptr<BlockExpr> if_block,
- std::unique_ptr<ExprWithBlock> else_block, Location locus)
+ std::unique_ptr<ExprWithBlock> else_block, location_t locus)
: IfExpr (std::move (mappings), std::move (condition), std::move (if_block),
locus),
else_block (std::move (else_block))
@@ -3314,7 +3317,7 @@ class IfLetExpr : public ExprWithBlock
std::unique_ptr<Expr> value;
std::unique_ptr<BlockExpr> if_block;
- Location locus;
+ location_t locus;
public:
std::string as_string () const override;
@@ -3322,7 +3325,7 @@ public:
IfLetExpr (Analysis::NodeMapping mappings,
std::vector<std::unique_ptr<Pattern> > match_arm_patterns,
std::unique_ptr<Expr> value, std::unique_ptr<BlockExpr> if_block,
- Location locus)
+ location_t locus)
: ExprWithBlock (std::move (mappings), AST::AttrVec ()),
match_arm_patterns (std::move (match_arm_patterns)),
value (std::move (value)), if_block (std::move (if_block)), locus (locus)
@@ -3418,7 +3421,7 @@ public:
Analysis::NodeMapping mappings,
std::vector<std::unique_ptr<Pattern> > match_arm_patterns,
std::unique_ptr<Expr> value, std::unique_ptr<BlockExpr> if_block,
- std::unique_ptr<ExprWithBlock> else_block, Location locus)
+ std::unique_ptr<ExprWithBlock> else_block, location_t locus)
: IfLetExpr (std::move (mappings), std::move (match_arm_patterns),
std::move (value), std::move (if_block), locus),
else_block (std::move (else_block))
@@ -3484,7 +3487,7 @@ private:
AST::AttrVec outer_attrs;
std::vector<std::unique_ptr<Pattern> > match_arm_patterns;
std::unique_ptr<Expr> guard_expr;
- Location locus;
+ location_t locus;
public:
// Returns whether the MatchArm has a match arm guard expression
@@ -3492,7 +3495,7 @@ public:
// Constructor for match arm with a guard expression
MatchArm (std::vector<std::unique_ptr<Pattern> > match_arm_patterns,
- Location locus, std::unique_ptr<Expr> guard_expr = nullptr,
+ location_t locus, std::unique_ptr<Expr> guard_expr = nullptr,
AST::AttrVec outer_attrs = AST::AttrVec ())
: outer_attrs (std::move (outer_attrs)),
match_arm_patterns (std::move (match_arm_patterns)),
@@ -3541,7 +3544,7 @@ public:
// Creates a match arm in an error state.
static MatchArm create_error ()
{
- Location locus = UNDEF_LOCATION;
+ location_t locus = UNDEF_LOCATION;
return MatchArm (std::vector<std::unique_ptr<Pattern> > (), locus);
}
@@ -3604,7 +3607,7 @@ class MatchExpr : public ExprWithBlock, public WithInnerAttrs
{
std::unique_ptr<Expr> branch_value;
std::vector<MatchCase> match_arms;
- Location locus;
+ location_t locus;
public:
std::string as_string () const override;
@@ -3613,7 +3616,7 @@ public:
MatchExpr (Analysis::NodeMapping mappings, std::unique_ptr<Expr> branch_value,
std::vector<MatchCase> match_arms, AST::AttrVec inner_attrs,
- AST::AttrVec outer_attrs, Location locus)
+ AST::AttrVec outer_attrs, location_t locus)
: ExprWithBlock (std::move (mappings), std::move (outer_attrs)),
WithInnerAttrs (std::move (inner_attrs)),
branch_value (std::move (branch_value)),
@@ -3684,12 +3687,12 @@ protected:
class AwaitExpr : public ExprWithoutBlock
{
std::unique_ptr<Expr> awaited_expr;
- Location locus;
+ location_t locus;
public:
// TODO: ensure outer attributes are actually allowed
AwaitExpr (Analysis::NodeMapping mappings, std::unique_ptr<Expr> awaited_expr,
- AST::AttrVec outer_attrs, Location locus)
+ AST::AttrVec outer_attrs, location_t locus)
: ExprWithoutBlock (std::move (mappings), std::move (outer_attrs)),
awaited_expr (std::move (awaited_expr)), locus (locus)
{}
@@ -3742,12 +3745,12 @@ class AsyncBlockExpr : public ExprWithBlock
{
bool has_move;
std::unique_ptr<BlockExpr> block_expr;
- Location locus;
+ location_t locus;
public:
AsyncBlockExpr (Analysis::NodeMapping mappings,
std::unique_ptr<BlockExpr> block_expr, bool has_move,
- AST::AttrVec outer_attrs, Location locus)
+ AST::AttrVec outer_attrs, location_t locus)
: ExprWithBlock (std::move (mappings), std::move (outer_attrs)),
has_move (has_move), block_expr (std::move (block_expr)), locus (locus)
{}
@@ -3843,7 +3846,7 @@ public:
private:
const Analysis::NodeMapping node_mappings;
const Analysis::NodeMapping lvalue_mappings;
- Location locus;
+ location_t locus;
};
class InlineAsmReg
@@ -3919,7 +3922,7 @@ struct InlineAsmRegOrRegClass
};
Identifier name;
- Location locus;
+ location_t locus;
};
// Inline Assembly Node
diff --git a/gcc/rust/hir/tree/rust-hir-item.h b/gcc/rust/hir/tree/rust-hir-item.h
index 3ba7571..70393f3 100644
--- a/gcc/rust/hir/tree/rust-hir-item.h
+++ b/gcc/rust/hir/tree/rust-hir-item.h
@@ -48,7 +48,7 @@ class TypeParam : public GenericParam
// bool has_type;
std::unique_ptr<Type> type;
- Location locus;
+ location_t locus;
public:
// Returns whether the type of the type param has been specified.
@@ -62,7 +62,7 @@ public:
AST::Attribute &get_outer_attribute () { return outer_attr; }
TypeParam (Analysis::NodeMapping mappings, Identifier type_representation,
- Location locus = UNDEF_LOCATION,
+ location_t locus = UNDEF_LOCATION,
std::vector<std::unique_ptr<TypeParamBound>> type_param_bounds
= std::vector<std::unique_ptr<TypeParamBound>> (),
std::unique_ptr<Type> type = nullptr,
@@ -177,13 +177,13 @@ class LifetimeWhereClauseItem : public WhereClauseItem
{
Lifetime lifetime;
std::vector<Lifetime> lifetime_bounds;
- Location locus;
+ location_t locus;
Analysis::NodeMapping mappings;
public:
LifetimeWhereClauseItem (Analysis::NodeMapping mappings, Lifetime lifetime,
std::vector<Lifetime> lifetime_bounds,
- Location locus)
+ location_t locus)
: lifetime (std::move (lifetime)),
lifetime_bounds (std::move (lifetime_bounds)), locus (locus),
mappings (std::move (mappings))
@@ -222,7 +222,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;
+ location_t locus;
public:
// Returns whether the item has ForLifetimes
@@ -235,7 +235,7 @@ public:
Analysis::NodeMapping mappings, std::vector<LifetimeParam> for_lifetimes,
std::unique_ptr<Type> bound_type,
std::vector<std::unique_ptr<TypeParamBound>> type_param_bounds,
- Location locus)
+ location_t locus)
: for_lifetimes (std::move (for_lifetimes)),
bound_type (std::move (bound_type)),
type_param_bounds (std::move (type_param_bounds)),
@@ -376,7 +376,7 @@ private:
ImplicitSelfKind self_kind;
Lifetime lifetime;
std::unique_ptr<Type> type;
- Location locus;
+ location_t locus;
Analysis::NodeMapping mappings;
SelfParam (Analysis::NodeMapping mappings, ImplicitSelfKind self_kind,
@@ -388,7 +388,7 @@ private:
public:
// Type-based self parameter (not ref, no lifetime)
SelfParam (Analysis::NodeMapping mappings, std::unique_ptr<Type> type,
- bool is_mut, Location locus)
+ bool is_mut, location_t locus)
: self_kind (is_mut ? ImplicitSelfKind::MUT : ImplicitSelfKind::IMM),
lifetime (
Lifetime (mappings, AST::Lifetime::LifetimeType::NAMED, "", locus)),
@@ -397,7 +397,7 @@ public:
// Lifetime-based self parameter (is ref, no type)
SelfParam (Analysis::NodeMapping mappings, Lifetime lifetime, bool is_mut,
- Location locus)
+ location_t locus)
: self_kind (is_mut ? ImplicitSelfKind::MUT_REF
: ImplicitSelfKind::IMM_REF),
lifetime (std::move (lifetime)), locus (locus), mappings (mappings)
@@ -507,13 +507,13 @@ struct FunctionParam
{
std::unique_ptr<Pattern> param_name;
std::unique_ptr<Type> type;
- Location locus;
+ location_t locus;
Analysis::NodeMapping mappings;
public:
FunctionParam (Analysis::NodeMapping mappings,
std::unique_ptr<Pattern> param_name,
- std::unique_ptr<Type> param_type, Location locus)
+ std::unique_ptr<Type> param_type, location_t locus)
: param_name (std::move (param_name)), type (std::move (param_type)),
locus (locus), mappings (mappings)
{}
@@ -566,14 +566,14 @@ public:
private:
VisType vis_type;
HIR::SimplePath path;
- Location locus;
+ location_t locus;
// should this store location info?
public:
Visibility (VisType vis_type,
HIR::SimplePath path = HIR::SimplePath::create_empty (),
- Location locus = UNDEF_LOCATION)
+ location_t locus = UNDEF_LOCATION)
: vis_type (vis_type), path (std::move (path)), locus (locus)
{}
@@ -655,7 +655,7 @@ public:
class Module : public VisItem, public WithInnerAttrs
{
Identifier module_name;
- Location locus;
+ location_t locus;
// bool has_items;
std::vector<std::unique_ptr<Item>> items;
@@ -667,7 +667,7 @@ public:
// Full constructor
Module (Analysis::NodeMapping mappings, Identifier module_name,
- Location locus, std::vector<std::unique_ptr<Item>> items,
+ location_t locus, std::vector<std::unique_ptr<Item>> items,
Visibility visibility = Visibility::create_error (),
AST::AttrVec inner_attrs = AST::AttrVec (),
AST::AttrVec outer_attrs = AST::AttrVec ())
@@ -740,7 +740,7 @@ class ExternCrate : public VisItem
// this is either an identifier or "_", with _ parsed to string
std::string as_clause_name;
- Location locus;
+ location_t locus;
/* e.g.
"extern crate foo as _"
@@ -758,8 +758,8 @@ public:
// Constructor
ExternCrate (Analysis::NodeMapping mappings, std::string referenced_crate,
- Visibility visibility, AST::AttrVec outer_attrs, Location locus,
- std::string as_clause_name = std::string ())
+ Visibility visibility, AST::AttrVec outer_attrs,
+ location_t locus, std::string as_clause_name = std::string ())
: VisItem (std::move (mappings), std::move (visibility),
std::move (outer_attrs)),
referenced_crate (std::move (referenced_crate)),
@@ -800,7 +800,7 @@ protected:
// The path-ish thing referred to in a use declaration - abstract base class
class UseTree : public FullVisitable
{
- Location locus;
+ location_t locus;
public:
virtual ~UseTree () {}
@@ -819,7 +819,7 @@ protected:
// Clone function implementation as pure virtual method
virtual UseTree *clone_use_tree_impl () const = 0;
- UseTree (Location locus) : locus (locus) {}
+ UseTree (location_t locus) : locus (locus) {}
};
// Use tree with a glob (wildcard) operator
@@ -838,7 +838,7 @@ private:
AST::SimplePath path;
public:
- UseTreeGlob (PathType glob_type, AST::SimplePath path, Location locus)
+ UseTreeGlob (PathType glob_type, AST::SimplePath path, location_t locus)
: UseTree (locus), glob_type (glob_type), path (std::move (path))
{
if (this->glob_type != PATH_PREFIXED)
@@ -892,7 +892,7 @@ private:
public:
UseTreeList (PathType path_type, AST::SimplePath path,
- std::vector<std::unique_ptr<UseTree>> trees, Location locus)
+ std::vector<std::unique_ptr<UseTree>> trees, location_t locus)
: UseTree (locus), path_type (path_type), path (std::move (path)),
trees (std::move (trees))
{
@@ -976,7 +976,7 @@ private:
Identifier identifier; // only if NewBindType is IDENTIFIER
public:
- UseTreeRebind (NewBindType bind_type, AST::SimplePath path, Location locus,
+ UseTreeRebind (NewBindType bind_type, AST::SimplePath path, location_t locus,
Identifier identifier = std::string ())
: UseTree (locus), path (std::move (path)), bind_type (bind_type),
identifier (std::move (identifier))
@@ -1013,14 +1013,14 @@ protected:
class UseDeclaration : public VisItem
{
std::unique_ptr<UseTree> use_tree;
- Location locus;
+ location_t locus;
public:
std::string as_string () const override;
UseDeclaration (Analysis::NodeMapping mappings,
std::unique_ptr<UseTree> use_tree, Visibility visibility,
- AST::AttrVec outer_attrs, Location locus)
+ AST::AttrVec outer_attrs, location_t locus)
: VisItem (std::move (mappings), std::move (visibility),
std::move (outer_attrs)),
use_tree (std::move (use_tree)), locus (locus)
@@ -1084,7 +1084,7 @@ class Function : public VisItem, public ImplItem
WhereClause where_clause;
std::unique_ptr<BlockExpr> function_body;
SelfParam self;
- Location locus;
+ location_t locus;
public:
std::string as_string () const override;
@@ -1115,7 +1115,7 @@ public:
std::vector<FunctionParam> function_params,
std::unique_ptr<Type> return_type, WhereClause where_clause,
std::unique_ptr<BlockExpr> function_body, Visibility vis,
- AST::AttrVec outer_attrs, SelfParam self, Location locus)
+ AST::AttrVec outer_attrs, SelfParam self, location_t locus)
: VisItem (std::move (mappings), std::move (vis), std::move (outer_attrs)),
qualifiers (std::move (qualifiers)),
function_name (std::move (function_name)),
@@ -1255,7 +1255,7 @@ class TypeAlias : public VisItem, public ImplItem
std::unique_ptr<Type> existing_type;
- Location locus;
+ location_t locus;
public:
std::string as_string () const override;
@@ -1275,7 +1275,7 @@ public:
TypeAlias (Analysis::NodeMapping mappings, Identifier new_type_name,
std::vector<std::unique_ptr<GenericParam>> generic_params,
WhereClause where_clause, std::unique_ptr<Type> existing_type,
- Visibility vis, AST::AttrVec outer_attrs, Location locus)
+ Visibility vis, AST::AttrVec outer_attrs, location_t locus)
: VisItem (std::move (mappings), std::move (vis), std::move (outer_attrs)),
new_type_name (std::move (new_type_name)),
generic_params (std::move (generic_params)),
@@ -1375,7 +1375,7 @@ protected:
// bool has_where_clause;
WhereClause where_clause;
- Location locus;
+ location_t locus;
public:
Identifier get_identifier () const { return struct_name; }
@@ -1399,7 +1399,7 @@ public:
protected:
Struct (Analysis::NodeMapping mappings, Identifier struct_name,
std::vector<std::unique_ptr<GenericParam>> generic_params,
- WhereClause where_clause, Visibility vis, Location locus,
+ WhereClause where_clause, Visibility vis, location_t locus,
AST::AttrVec outer_attrs = AST::AttrVec ())
: VisItem (std::move (mappings), std::move (vis), std::move (outer_attrs)),
struct_name (std::move (struct_name)),
@@ -1453,7 +1453,7 @@ public:
Analysis::NodeMapping mappings;
- Location locus;
+ location_t locus;
// Returns whether struct field has any outer attributes.
bool has_outer_attributes () const { return !outer_attrs.empty (); }
@@ -1462,8 +1462,8 @@ public:
bool has_visibility () const { return !visibility.is_error (); }
StructField (Analysis::NodeMapping mappings, Identifier field_name,
- std::unique_ptr<Type> field_type, Visibility vis, Location locus,
- AST::AttrVec outer_attrs = AST::AttrVec ())
+ std::unique_ptr<Type> field_type, Visibility vis,
+ location_t locus, AST::AttrVec outer_attrs = AST::AttrVec ())
: outer_attrs (std::move (outer_attrs)), visibility (std::move (vis)),
field_name (std::move (field_name)), field_type (std::move (field_type)),
mappings (mappings), locus (locus)
@@ -1521,7 +1521,7 @@ public:
Identifier struct_name,
std::vector<std::unique_ptr<GenericParam>> generic_params,
WhereClause where_clause, bool is_unit, Visibility vis,
- AST::AttrVec outer_attrs, Location locus)
+ AST::AttrVec outer_attrs, location_t locus)
: Struct (std::move (mappings), std::move (struct_name),
std::move (generic_params), std::move (where_clause),
std::move (vis), locus, std::move (outer_attrs)),
@@ -1532,7 +1532,7 @@ public:
StructStruct (Analysis::NodeMapping mappings, Identifier struct_name,
std::vector<std::unique_ptr<GenericParam>> generic_params,
WhereClause where_clause, Visibility vis,
- AST::AttrVec outer_attrs, Location locus)
+ AST::AttrVec outer_attrs, location_t locus)
: Struct (std::move (mappings), std::move (struct_name),
std::move (generic_params), std::move (where_clause),
std::move (vis), locus, std::move (outer_attrs)),
@@ -1578,7 +1578,7 @@ private:
std::unique_ptr<Type> field_type;
- Location locus;
+ location_t locus;
Analysis::NodeMapping mappings;
@@ -1592,7 +1592,7 @@ public:
// Complete constructor
TupleField (Analysis::NodeMapping mapping, std::unique_ptr<Type> field_type,
- Visibility vis, Location locus,
+ Visibility vis, location_t locus,
AST::AttrVec outer_attrs = AST::AttrVec ())
: outer_attrs (std::move (outer_attrs)), visibility (std::move (vis)),
field_type (std::move (field_type)), locus (locus), mappings (mapping)
@@ -1651,7 +1651,7 @@ public:
Identifier struct_name,
std::vector<std::unique_ptr<GenericParam>> generic_params,
WhereClause where_clause, Visibility vis,
- AST::AttrVec outer_attrs, Location locus)
+ AST::AttrVec outer_attrs, location_t locus)
: Struct (std::move (mappings), std::move (struct_name),
std::move (generic_params), std::move (where_clause),
std::move (vis), locus, std::move (outer_attrs)),
@@ -1687,7 +1687,7 @@ protected:
class EnumItem : public Item
{
Identifier variant_name;
- Location locus;
+ location_t locus;
public:
virtual ~EnumItem () {}
@@ -1701,7 +1701,7 @@ public:
};
EnumItem (Analysis::NodeMapping mappings, Identifier variant_name,
- AST::AttrVec outer_attrs, Location locus)
+ AST::AttrVec outer_attrs, location_t locus)
: Item (std::move (mappings), std::move (outer_attrs)),
variant_name (std::move (variant_name)), locus (locus)
{}
@@ -1747,7 +1747,7 @@ public:
EnumItemTuple (Analysis::NodeMapping mappings, Identifier variant_name,
std::vector<TupleField> tuple_fields, AST::AttrVec outer_attrs,
- Location locus)
+ location_t locus)
: EnumItem (std::move (mappings), std::move (variant_name),
std::move (outer_attrs), locus),
tuple_fields (std::move (tuple_fields))
@@ -1785,7 +1785,7 @@ public:
EnumItemStruct (Analysis::NodeMapping mappings, Identifier variant_name,
std::vector<StructField> struct_fields,
- AST::AttrVec outer_attrs, Location locus)
+ AST::AttrVec outer_attrs, location_t locus)
: EnumItem (std::move (mappings), std::move (variant_name),
std::move (outer_attrs), locus),
struct_fields (std::move (struct_fields))
@@ -1814,7 +1814,7 @@ class EnumItemDiscriminant : public EnumItem
public:
EnumItemDiscriminant (Analysis::NodeMapping mappings, Identifier variant_name,
std::unique_ptr<Expr> expr, AST::AttrVec outer_attrs,
- Location locus)
+ location_t locus)
: EnumItem (std::move (mappings), std::move (variant_name),
std::move (outer_attrs), locus),
expression (std::move (expr))
@@ -1874,7 +1874,7 @@ class Enum : public VisItem
std::vector<std::unique_ptr<EnumItem>> items;
- Location locus;
+ location_t locus;
public:
std::string as_string () const override;
@@ -1893,7 +1893,7 @@ public:
Enum (Analysis::NodeMapping mappings, Identifier enum_name, Visibility vis,
std::vector<std::unique_ptr<GenericParam>> generic_params,
WhereClause where_clause, std::vector<std::unique_ptr<EnumItem>> items,
- AST::AttrVec outer_attrs, Location locus)
+ AST::AttrVec outer_attrs, location_t locus)
: VisItem (std::move (mappings), std::move (vis), std::move (outer_attrs)),
enum_name (std::move (enum_name)),
generic_params (std::move (generic_params)),
@@ -1988,7 +1988,7 @@ class Union : public VisItem
std::vector<StructField> variants;
- Location locus;
+ location_t locus;
public:
std::string as_string () const override;
@@ -2002,7 +2002,7 @@ public:
Union (Analysis::NodeMapping mappings, Identifier union_name, Visibility vis,
std::vector<std::unique_ptr<GenericParam>> generic_params,
WhereClause where_clause, std::vector<StructField> variants,
- AST::AttrVec outer_attrs, Location locus)
+ AST::AttrVec outer_attrs, location_t locus)
: VisItem (std::move (mappings), std::move (vis), std::move (outer_attrs)),
union_name (std::move (union_name)),
generic_params (std::move (generic_params)),
@@ -2071,7 +2071,7 @@ class ConstantItem : public VisItem, public ImplItem
Identifier identifier;
std::unique_ptr<Type> type;
std::unique_ptr<Expr> const_expr;
- Location locus;
+ location_t locus;
public:
std::string as_string () const override;
@@ -2079,7 +2079,7 @@ public:
ConstantItem (Analysis::NodeMapping mappings, Identifier ident,
Visibility vis, std::unique_ptr<Type> type,
std::unique_ptr<Expr> const_expr, AST::AttrVec outer_attrs,
- Location locus)
+ location_t locus)
: VisItem (std::move (mappings), std::move (vis), std::move (outer_attrs)),
identifier (std::move (ident)), type (std::move (type)),
const_expr (std::move (const_expr)), locus (locus)
@@ -2168,14 +2168,14 @@ class StaticItem : public VisItem
Identifier name;
std::unique_ptr<Type> type;
std::unique_ptr<Expr> expr;
- Location locus;
+ location_t locus;
public:
std::string as_string () const override;
StaticItem (Analysis::NodeMapping mappings, Identifier name, Mutability mut,
std::unique_ptr<Type> type, std::unique_ptr<Expr> expr,
- Visibility vis, AST::AttrVec outer_attrs, Location locus)
+ Visibility vis, AST::AttrVec outer_attrs, location_t locus)
: VisItem (std::move (mappings), std::move (vis), std::move (outer_attrs)),
mut (mut), name (std::move (name)), type (std::move (type)),
expr (std::move (expr)), locus (locus)
@@ -2332,7 +2332,7 @@ class TraitItemFunc : public TraitItem
AST::AttrVec outer_attrs;
TraitFunctionDecl decl;
std::unique_ptr<BlockExpr> block_expr;
- Location locus;
+ location_t locus;
public:
// Returns whether function has a definition or is just a declaration.
@@ -2340,7 +2340,7 @@ public:
TraitItemFunc (Analysis::NodeMapping mappings, TraitFunctionDecl decl,
std::unique_ptr<BlockExpr> block_expr,
- AST::AttrVec outer_attrs, Location locus)
+ AST::AttrVec outer_attrs, location_t locus)
: TraitItem (mappings), outer_attrs (std::move (outer_attrs)),
decl (std::move (decl)), block_expr (std::move (block_expr)),
locus (locus)
@@ -2421,7 +2421,7 @@ class TraitItemConst : public TraitItem
Identifier name;
std::unique_ptr<Type> type;
std::unique_ptr<Expr> expr;
- Location locus;
+ location_t locus;
public:
// Whether the constant item has an associated expression.
@@ -2429,7 +2429,7 @@ public:
TraitItemConst (Analysis::NodeMapping mappings, Identifier name,
std::unique_ptr<Type> type, std::unique_ptr<Expr> expr,
- AST::AttrVec outer_attrs, Location locus)
+ AST::AttrVec outer_attrs, location_t locus)
: TraitItem (mappings), outer_attrs (std::move (outer_attrs)),
name (std::move (name)), type (std::move (type)), expr (std::move (expr)),
locus (locus)
@@ -2509,7 +2509,7 @@ class TraitItemType : public TraitItem
Identifier name;
std::vector<std::unique_ptr<TypeParamBound>>
type_param_bounds; // inlined form
- Location locus;
+ location_t locus;
public:
// Returns whether trait item type has type param bounds.
@@ -2517,7 +2517,7 @@ public:
TraitItemType (Analysis::NodeMapping mappings, Identifier name,
std::vector<std::unique_ptr<TypeParamBound>> type_param_bounds,
- AST::AttrVec outer_attrs, Location locus)
+ AST::AttrVec outer_attrs, location_t locus)
: TraitItem (mappings), outer_attrs (std::move (outer_attrs)),
name (std::move (name)),
type_param_bounds (std::move (type_param_bounds)), locus (locus)
@@ -2602,7 +2602,7 @@ class Trait : public VisItem
std::vector<std::unique_ptr<TypeParamBound>> type_param_bounds;
WhereClause where_clause;
std::vector<std::unique_ptr<TraitItem>> trait_items;
- Location locus;
+ location_t locus;
public:
std::string as_string () const override;
@@ -2635,7 +2635,7 @@ public:
std::vector<std::unique_ptr<TypeParamBound>> type_param_bounds,
WhereClause where_clause,
std::vector<std::unique_ptr<TraitItem>> trait_items, Visibility vis,
- AST::AttrVec outer_attrs, Location locus)
+ AST::AttrVec outer_attrs, location_t locus)
: VisItem (std::move (mappings), std::move (vis), std::move (outer_attrs)),
unsafety (unsafety), name (std::move (name)),
generic_params (std::move (generic_params)),
@@ -2732,7 +2732,7 @@ class ImplBlock : public VisItem, public WithInnerAttrs
std::unique_ptr<TypePath> trait_ref;
WhereClause where_clause;
Polarity polarity;
- Location locus;
+ location_t locus;
std::vector<std::unique_ptr<ImplItem>> impl_items;
public:
@@ -2742,7 +2742,7 @@ public:
std::unique_ptr<Type> impl_type,
std::unique_ptr<TypePath> trait_ref, WhereClause where_clause,
Polarity polarity, Visibility vis, AST::AttrVec inner_attrs,
- AST::AttrVec outer_attrs, Location locus)
+ AST::AttrVec outer_attrs, location_t locus)
: VisItem (std::move (mappings), std::move (vis), std::move (outer_attrs)),
WithInnerAttrs (std::move (inner_attrs)),
generic_params (std::move (generic_params)),
@@ -2845,7 +2845,7 @@ class ExternalItem : public Node
AST::AttrVec outer_attrs;
Visibility visibility;
Identifier item_name;
- Location locus;
+ location_t locus;
public:
enum class ExternKind
@@ -2888,7 +2888,7 @@ public:
protected:
ExternalItem (Analysis::NodeMapping mappings, Identifier item_name,
- Visibility vis, AST::AttrVec outer_attrs, Location locus)
+ Visibility vis, AST::AttrVec outer_attrs, location_t locus)
: mappings (mappings), outer_attrs (std::move (outer_attrs)),
visibility (std::move (vis)), item_name (std::move (item_name)),
locus (locus)
@@ -2930,7 +2930,8 @@ class ExternalStaticItem : public ExternalItem
public:
ExternalStaticItem (Analysis::NodeMapping mappings, Identifier item_name,
std::unique_ptr<Type> item_type, Mutability mut,
- Visibility vis, AST::AttrVec outer_attrs, Location locus)
+ Visibility vis, AST::AttrVec outer_attrs,
+ location_t locus)
: ExternalItem (std::move (mappings), std::move (item_name),
std::move (vis), std::move (outer_attrs), locus),
mut (mut), item_type (std::move (item_type))
@@ -3059,7 +3060,7 @@ public:
std::vector<std::unique_ptr<GenericParam>> generic_params,
std::unique_ptr<Type> return_type, WhereClause where_clause,
std::vector<NamedFunctionParam> function_params, bool has_variadics,
- Visibility vis, AST::AttrVec outer_attrs, Location locus)
+ Visibility vis, AST::AttrVec outer_attrs, location_t locus)
: ExternalItem (std::move (mappings), std::move (item_name),
std::move (vis), std::move (outer_attrs), locus),
generic_params (std::move (generic_params)),
@@ -3136,7 +3137,7 @@ class ExternBlock : public VisItem, public WithInnerAttrs
{
ABI abi;
std::vector<std::unique_ptr<ExternalItem>> extern_items;
- Location locus;
+ location_t locus;
public:
std::string as_string () const override;
@@ -3149,7 +3150,7 @@ public:
ExternBlock (Analysis::NodeMapping mappings, ABI abi,
std::vector<std::unique_ptr<ExternalItem>> extern_items,
Visibility vis, AST::AttrVec inner_attrs,
- AST::AttrVec outer_attrs, Location locus)
+ AST::AttrVec outer_attrs, location_t locus)
: VisItem (std::move (mappings), std::move (vis), std::move (outer_attrs)),
WithInnerAttrs (std::move (inner_attrs)), abi (abi),
extern_items (std::move (extern_items)), locus (locus)
diff --git a/gcc/rust/hir/tree/rust-hir-path.h b/gcc/rust/hir/tree/rust-hir-path.h
index a41aa2d1..f726a43 100644
--- a/gcc/rust/hir/tree/rust-hir-path.h
+++ b/gcc/rust/hir/tree/rust-hir-path.h
@@ -58,7 +58,7 @@ class GenericArgsBinding
Identifier identifier;
std::unique_ptr<Type> type;
- Location locus;
+ location_t locus;
public:
// Returns whether binding is in an error state.
@@ -76,7 +76,7 @@ public:
// Pointer type for type in constructor to enable polymorphism
GenericArgsBinding (Identifier ident, std::unique_ptr<Type> type_ptr,
- Location locus = UNDEF_LOCATION)
+ location_t locus = UNDEF_LOCATION)
: identifier (std::move (ident)), type (std::move (type_ptr)), locus (locus)
{}
@@ -119,7 +119,7 @@ class ConstGenericArg
// at name-resolution, hence no need for ambiguities here
public:
- ConstGenericArg (std::unique_ptr<Expr> expression, Location locus)
+ ConstGenericArg (std::unique_ptr<Expr> expression, location_t locus)
: expression (std::move (expression)), locus (locus)
{}
@@ -140,7 +140,7 @@ public:
private:
std::unique_ptr<Expr> expression;
- Location locus;
+ location_t locus;
};
class GenericArgs
@@ -149,7 +149,7 @@ class GenericArgs
std::vector<std::unique_ptr<Type> > type_args;
std::vector<GenericArgsBinding> binding_args;
std::vector<ConstGenericArg> const_args;
- Location locus;
+ location_t locus;
public:
// Returns true if there are any generic arguments
@@ -162,7 +162,7 @@ public:
GenericArgs (std::vector<Lifetime> lifetime_args,
std::vector<std::unique_ptr<Type> > type_args,
std::vector<GenericArgsBinding> binding_args,
- std::vector<ConstGenericArg> const_args, Location locus)
+ std::vector<ConstGenericArg> const_args, location_t locus)
: lifetime_args (std::move (lifetime_args)),
type_args (std::move (type_args)),
binding_args (std::move (binding_args)),
@@ -204,7 +204,7 @@ public:
GenericArgs &operator= (GenericArgs &&other) = default;
// Creates an empty GenericArgs (no arguments)
- static GenericArgs create_empty (Location locus = UNDEF_LOCATION)
+ static GenericArgs create_empty (location_t locus = UNDEF_LOCATION)
{
return GenericArgs ({}, {}, {}, {}, locus);
}
@@ -236,11 +236,11 @@ private:
Analysis::NodeMapping mappings;
PathIdentSegment segment_name;
GenericArgs generic_args;
- Location locus;
+ location_t locus;
public:
PathExprSegment (Analysis::NodeMapping mappings,
- PathIdentSegment segment_name, Location locus,
+ PathIdentSegment segment_name, location_t locus,
GenericArgs generic_args)
: mappings (std::move (mappings)), segment_name (std::move (segment_name)),
generic_args (std::move (generic_args)), locus (locus)
@@ -334,7 +334,7 @@ public:
class PathInExpression : public PathPattern, public PathExpr
{
bool has_opening_scope_resolution;
- Location locus;
+ location_t locus;
public:
std::string as_string () const override;
@@ -342,7 +342,7 @@ public:
// Constructor
PathInExpression (Analysis::NodeMapping mappings,
std::vector<PathExprSegment> path_segments,
- Location locus = UNDEF_LOCATION,
+ location_t locus = UNDEF_LOCATION,
bool has_opening_scope_resolution = false,
std::vector<AST::Attribute> outer_attrs
= std::vector<AST::Attribute> ())
@@ -426,7 +426,7 @@ public:
private:
Analysis::NodeMapping mappings;
PathIdentSegment ident_segment;
- Location locus;
+ location_t locus;
protected:
bool has_separating_scope_resolution;
@@ -452,7 +452,7 @@ public:
TypePathSegment (Analysis::NodeMapping mappings,
PathIdentSegment ident_segment,
- bool has_separating_scope_resolution, Location locus)
+ bool has_separating_scope_resolution, location_t locus)
: mappings (std::move (mappings)),
ident_segment (std::move (ident_segment)), locus (locus),
has_separating_scope_resolution (has_separating_scope_resolution),
@@ -460,7 +460,7 @@ public:
{}
TypePathSegment (Analysis::NodeMapping mappings, std::string segment_name,
- bool has_separating_scope_resolution, Location locus)
+ bool has_separating_scope_resolution, location_t locus)
: mappings (std::move (mappings)),
ident_segment (PathIdentSegment (std::move (segment_name))),
locus (locus),
@@ -507,7 +507,7 @@ public:
TypePathSegmentGeneric (Analysis::NodeMapping mappings,
PathIdentSegment ident_segment,
bool has_separating_scope_resolution,
- GenericArgs generic_args, Location locus)
+ GenericArgs generic_args, location_t locus)
: TypePathSegment (std::move (mappings), std::move (ident_segment),
has_separating_scope_resolution, locus),
generic_args (std::move (generic_args))
@@ -521,7 +521,7 @@ public:
std::vector<std::unique_ptr<Type> > type_args,
std::vector<GenericArgsBinding> binding_args,
std::vector<ConstGenericArg> const_args,
- Location locus)
+ location_t locus)
: TypePathSegment (std::move (mappings), std::move (segment_name),
has_separating_scope_resolution, locus),
generic_args (
@@ -620,7 +620,7 @@ public:
TypePathSegmentFunction (Analysis::NodeMapping mappings,
PathIdentSegment ident_segment,
bool has_separating_scope_resolution,
- TypePathFunction function_path, Location locus)
+ TypePathFunction function_path, location_t locus)
: TypePathSegment (std::move (mappings), std::move (ident_segment),
has_separating_scope_resolution, locus),
function_path (std::move (function_path))
@@ -630,7 +630,7 @@ public:
TypePathSegmentFunction (Analysis::NodeMapping mappings,
std::string segment_name,
bool has_separating_scope_resolution,
- TypePathFunction function_path, Location locus)
+ TypePathFunction function_path, location_t locus)
: TypePathSegment (std::move (mappings), std::move (segment_name),
has_separating_scope_resolution, locus),
function_path (std::move (function_path))
@@ -694,7 +694,7 @@ public:
// Constructor
TypePath (Analysis::NodeMapping mappings,
std::vector<std::unique_ptr<TypePathSegment> > segments,
- Location locus, bool has_opening_scope_resolution = false)
+ location_t locus, bool has_opening_scope_resolution = false)
: TypeNoBounds (mappings, locus),
has_opening_scope_resolution (has_opening_scope_resolution),
segments (std::move (segments))
@@ -757,13 +757,13 @@ class QualifiedPathType
{
std::unique_ptr<Type> type;
std::unique_ptr<TypePath> trait;
- Location locus;
+ location_t locus;
Analysis::NodeMapping mappings;
public:
// Constructor
QualifiedPathType (Analysis::NodeMapping mappings, std::unique_ptr<Type> type,
- std::unique_ptr<TypePath> trait, Location locus)
+ std::unique_ptr<TypePath> trait, location_t locus)
: type (std::move (type)), trait (std::move (trait)), locus (locus),
mappings (mappings)
{}
@@ -838,7 +838,7 @@ public:
class QualifiedPathInExpression : public PathPattern, public PathExpr
{
QualifiedPathType path_type;
- Location locus;
+ location_t locus;
public:
std::string as_string () const override;
@@ -846,7 +846,7 @@ public:
QualifiedPathInExpression (Analysis::NodeMapping mappings,
QualifiedPathType qual_path_type,
std::vector<PathExprSegment> path_segments,
- Location locus = UNDEF_LOCATION,
+ location_t locus = UNDEF_LOCATION,
std::vector<AST::Attribute> outer_attrs
= std::vector<AST::Attribute> ())
: PathPattern (std::move (path_segments)),
@@ -913,7 +913,7 @@ public:
Analysis::NodeMapping mappings, QualifiedPathType qual_path_type,
std::unique_ptr<TypePathSegment> associated_segment,
std::vector<std::unique_ptr<TypePathSegment> > path_segments,
- Location locus = UNDEF_LOCATION)
+ location_t locus = UNDEF_LOCATION)
: TypeNoBounds (mappings, locus), path_type (std::move (qual_path_type)),
associated_segment (std::move (associated_segment)),
segments (std::move (path_segments))
@@ -984,11 +984,11 @@ class SimplePath
{
std::vector<SimplePathSegment> segments;
Analysis::NodeMapping mappings;
- Location locus;
+ location_t locus;
public:
SimplePath (std::vector<SimplePathSegment> segments,
- Analysis::NodeMapping mappings, Location locus)
+ Analysis::NodeMapping mappings, location_t locus)
: segments (std::move (segments)), mappings (mappings), locus (locus)
{}
diff --git a/gcc/rust/hir/tree/rust-hir-pattern.h b/gcc/rust/hir/tree/rust-hir-pattern.h
index 93770a0..882aa11 100644
--- a/gcc/rust/hir/tree/rust-hir-pattern.h
+++ b/gcc/rust/hir/tree/rust-hir-pattern.h
@@ -29,19 +29,19 @@ namespace HIR {
class LiteralPattern : public Pattern
{
Literal lit;
- Location locus;
+ location_t locus;
Analysis::NodeMapping mappings;
public:
std::string as_string () const override;
// Constructor for a literal pattern
- LiteralPattern (Analysis::NodeMapping mappings, Literal lit, Location locus)
+ LiteralPattern (Analysis::NodeMapping mappings, Literal lit, location_t locus)
: lit (std::move (lit)), locus (locus), mappings (mappings)
{}
LiteralPattern (Analysis::NodeMapping mappings, std::string val,
- Literal::LitType type, Location locus)
+ Literal::LitType type, location_t locus)
: lit (Literal (std::move (val), type, PrimitiveCoreType::CORETYPE_STR)),
locus (locus), mappings (mappings)
{}
@@ -80,7 +80,7 @@ class IdentifierPattern : public Pattern
bool is_ref;
Mutability mut;
std::unique_ptr<Pattern> to_bind;
- Location locus;
+ location_t locus;
Analysis::NodeMapping mappings;
public:
@@ -91,7 +91,7 @@ public:
// Constructor
IdentifierPattern (Analysis::NodeMapping mappings, Identifier ident,
- Location locus, bool is_ref = false,
+ location_t locus, bool is_ref = false,
Mutability mut = Mutability::Imm,
std::unique_ptr<Pattern> to_bind = nullptr)
: variable_ident (std::move (ident)), is_ref (is_ref), mut (mut),
@@ -161,13 +161,13 @@ protected:
// HIR node for using the '_' wildcard "match any value" pattern
class WildcardPattern : public Pattern
{
- Location locus;
+ location_t locus;
Analysis::NodeMapping mappings;
public:
std::string as_string () const override { return std::string (1, '_'); }
- WildcardPattern (Analysis::NodeMapping mappings, Location locus)
+ WildcardPattern (Analysis::NodeMapping mappings, location_t locus)
: locus (locus), mappings (mappings)
{}
@@ -236,11 +236,11 @@ class RangePatternBoundLiteral : public RangePatternBound
// Minus prefixed to literal (if integer or floating-point)
bool has_minus;
- Location locus;
+ location_t locus;
public:
// Constructor
- RangePatternBoundLiteral (Literal literal, Location locus,
+ RangePatternBoundLiteral (Literal literal, location_t locus,
bool has_minus = false)
: literal (literal), has_minus (has_minus), locus (locus)
{}
@@ -348,7 +348,7 @@ class RangePattern : public Pattern
/* location only stored to avoid a dereference - lower pattern should give
* correct location so maybe change in future */
- Location locus;
+ location_t locus;
Analysis::NodeMapping mappings;
public:
@@ -357,7 +357,7 @@ public:
// Constructor
RangePattern (Analysis::NodeMapping mappings,
std::unique_ptr<RangePatternBound> lower,
- std::unique_ptr<RangePatternBound> upper, Location locus,
+ std::unique_ptr<RangePatternBound> upper, location_t locus,
bool has_ellipsis_syntax = false)
: lower (std::move (lower)), upper (std::move (upper)),
has_ellipsis_syntax (has_ellipsis_syntax), locus (locus),
@@ -423,7 +423,7 @@ class ReferencePattern : public Pattern
{
Mutability mut;
std::unique_ptr<Pattern> pattern;
- Location locus;
+ location_t locus;
Analysis::NodeMapping mappings;
public:
@@ -431,7 +431,7 @@ public:
ReferencePattern (Analysis::NodeMapping mappings,
std::unique_ptr<Pattern> pattern, Mutability reference_mut,
- Location locus)
+ location_t locus)
: mut (reference_mut), pattern (std::move (pattern)), locus (locus),
mappings (mappings)
{}
@@ -491,7 +491,7 @@ protected:
class StructPatternField
{
AST::AttrVec outer_attrs;
- Location locus;
+ location_t locus;
Analysis::NodeMapping mappings;
public:
@@ -521,7 +521,7 @@ public:
protected:
StructPatternField (Analysis::NodeMapping mappings,
- AST::AttrVec outer_attribs, Location locus)
+ AST::AttrVec outer_attribs, location_t locus)
: outer_attrs (std::move (outer_attribs)), locus (locus),
mappings (mappings)
{}
@@ -539,7 +539,7 @@ class StructPatternFieldTuplePat : public StructPatternField
public:
StructPatternFieldTuplePat (Analysis::NodeMapping mappings, TupleIndex index,
std::unique_ptr<Pattern> tuple_pattern,
- AST::AttrVec outer_attribs, Location locus)
+ AST::AttrVec outer_attribs, location_t locus)
: StructPatternField (mappings, std::move (outer_attribs), locus),
index (index), tuple_pattern (std::move (tuple_pattern))
{}
@@ -594,7 +594,7 @@ class StructPatternFieldIdentPat : public StructPatternField
public:
StructPatternFieldIdentPat (Analysis::NodeMapping mappings, Identifier ident,
std::unique_ptr<Pattern> ident_pattern,
- AST::AttrVec outer_attrs, Location locus)
+ AST::AttrVec outer_attrs, location_t locus)
: StructPatternField (mappings, std::move (outer_attrs), locus),
ident (std::move (ident)), ident_pattern (std::move (ident_pattern))
{}
@@ -651,7 +651,7 @@ class StructPatternFieldIdent : public StructPatternField
public:
StructPatternFieldIdent (Analysis::NodeMapping mappings, Identifier ident,
bool is_ref, Mutability mut,
- AST::AttrVec outer_attrs, Location locus)
+ AST::AttrVec outer_attrs, location_t locus)
: StructPatternField (mappings, std::move (outer_attrs), locus),
has_ref (is_ref), mut (mut), ident (std::move (ident))
{}
@@ -1184,7 +1184,7 @@ protected:
class TuplePattern : public Pattern
{
std::unique_ptr<TuplePatternItems> items;
- Location locus;
+ location_t locus;
Analysis::NodeMapping mappings;
public:
@@ -1194,7 +1194,7 @@ public:
bool has_tuple_pattern_items () const { return items != nullptr; }
TuplePattern (Analysis::NodeMapping mappings,
- std::unique_ptr<TuplePatternItems> items, Location locus)
+ std::unique_ptr<TuplePatternItems> items, location_t locus)
: items (std::move (items)), locus (locus), mappings (mappings)
{}
@@ -1245,14 +1245,14 @@ protected:
class SlicePattern : public Pattern
{
std::vector<std::unique_ptr<Pattern>> items;
- Location locus;
+ location_t locus;
Analysis::NodeMapping mappings;
public:
std::string as_string () const override;
SlicePattern (Analysis::NodeMapping mappings,
- std::vector<std::unique_ptr<Pattern>> items, Location locus)
+ std::vector<std::unique_ptr<Pattern>> items, location_t locus)
: items (std::move (items)), locus (locus), mappings (mappings)
{}
@@ -1317,14 +1317,14 @@ protected:
class AltPattern : public Pattern
{
std::vector<std::unique_ptr<Pattern>> alts;
- Location locus;
+ location_t locus;
Analysis::NodeMapping mappings;
public:
std::string as_string () const override;
AltPattern (Analysis::NodeMapping mappings,
- std::vector<std::unique_ptr<Pattern>> alts, Location locus)
+ std::vector<std::unique_ptr<Pattern>> alts, location_t locus)
: alts (std::move (alts)), locus (locus), mappings (mappings)
{}
diff --git a/gcc/rust/hir/tree/rust-hir-stmt.h b/gcc/rust/hir/tree/rust-hir-stmt.h
index 3e27438..212bf2a 100644
--- a/gcc/rust/hir/tree/rust-hir-stmt.h
+++ b/gcc/rust/hir/tree/rust-hir-stmt.h
@@ -28,12 +28,12 @@ namespace HIR {
// Just a semi-colon, which apparently is a statement.
class EmptyStmt : public Stmt
{
- Location locus;
+ location_t locus;
public:
std::string as_string () const override { return std::string (1, ';'); }
- EmptyStmt (Analysis::NodeMapping mappings, Location locus)
+ EmptyStmt (Analysis::NodeMapping mappings, location_t locus)
: Stmt (std::move (mappings)), locus (locus)
{}
@@ -65,7 +65,7 @@ class LetStmt : public Stmt
// bool has_init_expr;
std::unique_ptr<Expr> init_expr;
- Location locus;
+ location_t locus;
public:
// Returns whether let statement has outer attributes.
@@ -82,7 +82,7 @@ public:
LetStmt (Analysis::NodeMapping mappings,
std::unique_ptr<Pattern> variables_pattern,
std::unique_ptr<Expr> init_expr, std::unique_ptr<Type> type,
- AST::AttrVec outer_attrs, Location locus)
+ AST::AttrVec outer_attrs, location_t locus)
: Stmt (std::move (mappings)), outer_attrs (std::move (outer_attrs)),
variables_pattern (std::move (variables_pattern)),
type (std::move (type)), init_expr (std::move (init_expr)), locus (locus)
@@ -162,18 +162,18 @@ protected:
class ExprStmt : public Stmt
{
std::unique_ptr<Expr> expr;
- Location locus;
+ location_t locus;
bool must_be_unit;
public:
ExprStmt (Analysis::NodeMapping mappings, std::unique_ptr<Expr> expr,
- Location locus, bool must_be_unit)
+ location_t locus, bool must_be_unit)
: Stmt (std::move (mappings)), expr (std::move (expr)), locus (locus),
must_be_unit (must_be_unit)
{}
ExprStmt (Analysis::NodeMapping mappings, std::unique_ptr<Expr> expr,
- Location locus)
+ location_t locus)
: ExprStmt (std::move (mappings), std::move (expr), locus, false)
{}
diff --git a/gcc/rust/hir/tree/rust-hir-type.h b/gcc/rust/hir/tree/rust-hir-type.h
index f6d5ab2..91ac1d4 100644
--- a/gcc/rust/hir/tree/rust-hir-type.h
+++ b/gcc/rust/hir/tree/rust-hir-type.h
@@ -36,7 +36,7 @@ class TraitBound : public TypeParamBound
bool opening_question_mark;
std::vector<LifetimeParam> for_lifetimes;
TypePath type_path;
- Location locus;
+ location_t locus;
Analysis::NodeMapping mappings;
@@ -44,8 +44,9 @@ public:
// Returns whether trait bound has "for" lifetimes
bool has_for_lifetimes () const { return !for_lifetimes.empty (); }
- TraitBound (Analysis::NodeMapping mapping, TypePath type_path, Location locus,
- bool in_parens = false, bool opening_question_mark = false,
+ TraitBound (Analysis::NodeMapping mapping, TypePath type_path,
+ location_t locus, bool in_parens = false,
+ bool opening_question_mark = false,
std::vector<LifetimeParam> for_lifetimes
= std::vector<LifetimeParam> ())
: in_parens (in_parens), opening_question_mark (opening_question_mark),
@@ -104,7 +105,7 @@ protected:
public:
ImplTraitType (Analysis::NodeMapping mappings,
std::vector<std::unique_ptr<TypeParamBound>> type_param_bounds,
- Location locus)
+ location_t locus)
: Type (mappings, locus), type_param_bounds (std::move (type_param_bounds))
{}
@@ -161,7 +162,7 @@ public:
TraitObjectType (
Analysis::NodeMapping mappings,
std::vector<std::unique_ptr<TypeParamBound>> type_param_bounds,
- Location locus, bool is_dyn_dispatch)
+ location_t locus, bool is_dyn_dispatch)
: Type (mappings, locus), has_dyn (is_dyn_dispatch),
type_param_bounds (std::move (type_param_bounds))
{}
@@ -232,7 +233,7 @@ protected:
public:
// Constructor uses Type pointer for polymorphism
ParenthesisedType (Analysis::NodeMapping mappings,
- std::unique_ptr<Type> type_inside_parens, Location locus)
+ std::unique_ptr<Type> type_inside_parens, location_t locus)
: TypeNoBounds (mappings, locus),
type_in_parens (std::move (type_inside_parens))
{}
@@ -297,7 +298,7 @@ protected:
public:
ImplTraitTypeOneBound (Analysis::NodeMapping mappings, TraitBound trait_bound,
- Location locus)
+ location_t locus)
: TypeNoBounds (mappings, locus), trait_bound (std::move (trait_bound))
{}
@@ -320,7 +321,7 @@ public:
bool is_unit_type () const { return elems.empty (); }
TupleType (Analysis::NodeMapping mappings,
- std::vector<std::unique_ptr<Type>> elems, Location locus)
+ std::vector<std::unique_ptr<Type>> elems, location_t locus)
: TypeNoBounds (mappings, locus), elems (std::move (elems))
{}
@@ -389,7 +390,7 @@ protected:
}
public:
- NeverType (Analysis::NodeMapping mappings, Location locus)
+ NeverType (Analysis::NodeMapping mappings, location_t locus)
: TypeNoBounds (mappings, locus)
{}
@@ -409,7 +410,7 @@ private:
public:
// Constructor requires pointer for polymorphism reasons
RawPointerType (Analysis::NodeMapping mappings, Mutability mut,
- std::unique_ptr<Type> type, Location locus)
+ std::unique_ptr<Type> type, location_t locus)
: TypeNoBounds (mappings, locus), mut (mut), type (std::move (type))
{}
@@ -482,7 +483,7 @@ public:
// Constructor
ReferenceType (Analysis::NodeMapping mappings, Mutability mut,
- std::unique_ptr<Type> type_no_bounds, Location locus,
+ std::unique_ptr<Type> type_no_bounds, location_t locus,
Lifetime lifetime)
: TypeNoBounds (mappings, locus), lifetime (std::move (lifetime)),
mut (mut), type (std::move (type_no_bounds))
@@ -546,7 +547,7 @@ class ArrayType : public TypeNoBounds
public:
// Constructor requires pointers for polymorphism
ArrayType (Analysis::NodeMapping mappings, std::unique_ptr<Type> type,
- std::unique_ptr<Expr> array_size, Location locus)
+ std::unique_ptr<Expr> array_size, location_t locus)
: TypeNoBounds (mappings, locus), elem_type (std::move (type)),
size (std::move (array_size))
{}
@@ -603,7 +604,7 @@ class SliceType : public TypeNoBounds
public:
// Constructor requires pointer for polymorphism
SliceType (Analysis::NodeMapping mappings, std::unique_ptr<Type> type,
- Location locus)
+ location_t locus)
: TypeNoBounds (mappings, locus), elem_type (std::move (type))
{}
@@ -668,7 +669,7 @@ protected:
}
public:
- InferredType (Analysis::NodeMapping mappings, Location locus)
+ InferredType (Analysis::NodeMapping mappings, location_t locus)
: TypeNoBounds (mappings, locus)
{}
@@ -697,11 +698,11 @@ private:
ParamKind param_kind;
Identifier name; // technically, can be an identifier or '_'
- Location locus;
+ location_t locus;
public:
MaybeNamedParam (Identifier name, ParamKind param_kind,
- std::unique_ptr<Type> param_type, Location locus)
+ std::unique_ptr<Type> param_type, location_t locus)
: param_type (std::move (param_type)), param_kind (param_kind),
name (std::move (name)), locus (locus)
{}
@@ -774,7 +775,7 @@ public:
std::vector<LifetimeParam> lifetime_params,
FunctionQualifiers qualifiers,
std::vector<MaybeNamedParam> named_params, bool is_variadic,
- std::unique_ptr<Type> type, Location locus)
+ std::unique_ptr<Type> type, location_t locus)
: TypeNoBounds (mappings, locus),
for_lifetimes (std::move (lifetime_params)),
function_qualifiers (std::move (qualifiers)),
diff --git a/gcc/rust/hir/tree/rust-hir.cc b/gcc/rust/hir/tree/rust-hir.cc
index b5e88d4..276c1a7 100644
--- a/gcc/rust/hir/tree/rust-hir.cc
+++ b/gcc/rust/hir/tree/rust-hir.cc
@@ -2173,7 +2173,7 @@ PathPattern::convert_to_simple_path (bool with_opening_scope_resolution) const
}
// kind of a HACK to get locus depending on opening scope resolution
- Location locus = UNKNOWN_LOCATION;
+ location_t locus = UNKNOWN_LOCATION;
if (with_opening_scope_resolution)
{
locus = simple_segments[0].get_locus () - 2; // minus 2 chars for ::
diff --git a/gcc/rust/hir/tree/rust-hir.h b/gcc/rust/hir/tree/rust-hir.h
index 578e126..c5a027a 100644
--- a/gcc/rust/hir/tree/rust-hir.h
+++ b/gcc/rust/hir/tree/rust-hir.h
@@ -467,7 +467,7 @@ public:
virtual Location get_locus () const { return locus; }
protected:
- Type (Analysis::NodeMapping mappings, Location locus)
+ Type (Analysis::NodeMapping mappings, location_t locus)
: mappings (mappings), locus (locus)
{}
@@ -475,7 +475,7 @@ protected:
virtual Type *clone_type_impl () const = 0;
Analysis::NodeMapping mappings;
- Location locus;
+ location_t locus;
};
// A type without parentheses? - abstract
@@ -489,7 +489,7 @@ public:
}
protected:
- TypeNoBounds (Analysis::NodeMapping mappings, Location locus)
+ TypeNoBounds (Analysis::NodeMapping mappings, location_t locus)
: Type (mappings, locus)
{}
@@ -544,13 +544,13 @@ class Lifetime : public TypeParamBound
private:
AST::Lifetime::LifetimeType lifetime_type;
std::string lifetime_name;
- Location locus;
+ location_t locus;
Analysis::NodeMapping mappings;
public:
// Constructor
Lifetime (Analysis::NodeMapping mapping, AST::Lifetime::LifetimeType type,
- std::string name, Location locus)
+ std::string name, location_t locus)
: lifetime_type (type), lifetime_name (std::move (name)), locus (locus),
mappings (mapping)
{}
@@ -654,7 +654,7 @@ class LifetimeParam : public GenericParam
// std::unique_ptr<Attribute> outer_attr;
AST::Attribute outer_attr;
- Location locus;
+ location_t locus;
public:
Lifetime get_lifetime () { return lifetime; }
@@ -670,7 +670,7 @@ public:
// Constructor
LifetimeParam (Analysis::NodeMapping mappings, Lifetime lifetime,
- Location locus = UNDEF_LOCATION,
+ location_t locus = UNDEF_LOCATION,
std::vector<Lifetime> lifetime_bounds
= std::vector<Lifetime> (),
AST::Attribute outer_attr = AST::Attribute::create_empty ())
@@ -725,7 +725,7 @@ class ConstGenericParam : public GenericParam
public:
ConstGenericParam (std::string name, std::unique_ptr<Type> type,
std::unique_ptr<Expr> default_expression,
- Analysis::NodeMapping mapping, Location locus)
+ Analysis::NodeMapping mapping, location_t locus)
: GenericParam (mapping, GenericKind::CONST), name (std::move (name)),
type (std::move (type)),
default_expression (std::move (default_expression)), locus (locus)
@@ -772,7 +772,7 @@ private:
/* Optional - can be a null pointer if there is no default expression */
std::unique_ptr<Expr> default_expression;
- Location locus;
+ location_t locus;
};
// Item used in trait declarations - abstract base class