aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/ast
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/rust/ast')
-rw-r--r--gcc/rust/ast/rust-ast-builder.h4
-rw-r--r--gcc/rust/ast/rust-ast.h11
-rw-r--r--gcc/rust/ast/rust-expr.h18
-rw-r--r--gcc/rust/ast/rust-item.h16
-rw-r--r--gcc/rust/ast/rust-macro.h42
-rw-r--r--gcc/rust/ast/rust-path.h2
6 files changed, 48 insertions, 45 deletions
diff --git a/gcc/rust/ast/rust-ast-builder.h b/gcc/rust/ast/rust-ast-builder.h
index 524b390..0ee36ff 100644
--- a/gcc/rust/ast/rust-ast-builder.h
+++ b/gcc/rust/ast/rust-ast-builder.h
@@ -31,7 +31,7 @@ namespace AST {
class AstBuilder
{
public:
- AstBuilder (Location loc) : loc (loc) {}
+ AstBuilder (location_t loc) : loc (loc) {}
/* Create an identifier expression (`variable`) */
std::unique_ptr<Expr> identifier (std::string name);
@@ -107,7 +107,7 @@ private:
/**
* Location of the generated AST nodes
*/
- Location loc;
+ location_t loc;
};
} // namespace AST
diff --git a/gcc/rust/ast/rust-ast.h b/gcc/rust/ast/rust-ast.h
index f46925a..3f154ef 100644
--- a/gcc/rust/ast/rust-ast.h
+++ b/gcc/rust/ast/rust-ast.h
@@ -41,7 +41,7 @@ public:
loc (UNDEF_LOCATION)
{}
// Create identifier with dummy location
- Identifier (std::string ident, Location loc = UNDEF_LOCATION)
+ Identifier (std::string ident, location_t loc = UNDEF_LOCATION)
: ident (ident), node_id (Analysis::Mappings::get ()->get_next_node_id ()),
loc (loc)
{}
@@ -66,7 +66,7 @@ public:
private:
std::string ident;
NodeId node_id;
- Location loc;
+ location_t loc;
};
std::ostream &
@@ -157,7 +157,7 @@ public:
virtual ~MacroMatch () {}
virtual std::string as_string () const = 0;
- virtual Location get_match_locus () const = 0;
+ virtual location_t get_match_locus () const = 0;
// Unique pointer custom clone function
std::unique_ptr<MacroMatch> clone_macro_match () const
@@ -264,7 +264,10 @@ public:
}
std::string as_string () const override;
- Location get_match_locus () const override { return tok_ref->get_locus (); };
+ location_t get_match_locus () const override
+ {
+ return tok_ref->get_locus ();
+ };
void accept_vis (ASTVisitor &vis) override;
diff --git a/gcc/rust/ast/rust-expr.h b/gcc/rust/ast/rust-expr.h
index b3aa417..69937bf 100644
--- a/gcc/rust/ast/rust-expr.h
+++ b/gcc/rust/ast/rust-expr.h
@@ -2396,8 +2396,8 @@ class BlockExpr : public ExprWithBlock
std::vector<Attribute> inner_attrs;
std::vector<std::unique_ptr<Stmt> > statements;
std::unique_ptr<Expr> expr;
- Location start_locus;
- Location end_locus;
+ location_t start_locus;
+ location_t end_locus;
bool marked_for_strip = false;
public:
@@ -2412,8 +2412,8 @@ public:
BlockExpr (std::vector<std::unique_ptr<Stmt> > block_statements,
std::unique_ptr<Expr> block_expr,
std::vector<Attribute> inner_attribs,
- std::vector<Attribute> outer_attribs, Location start_locus,
- Location end_locus)
+ std::vector<Attribute> outer_attribs, location_t start_locus,
+ location_t end_locus)
: outer_attrs (std::move (outer_attribs)),
inner_attrs (std::move (inner_attribs)),
statements (std::move (block_statements)), expr (std::move (block_expr)),
@@ -2470,8 +2470,8 @@ public:
location_t get_locus () const override final { return start_locus; }
- Location get_start_locus () const { return start_locus; }
- Location get_end_locus () const { return end_locus; }
+ location_t get_start_locus () const { return start_locus; }
+ location_t get_end_locus () const { return end_locus; }
void accept_vis (ASTVisitor &vis) override;
@@ -4596,7 +4596,7 @@ struct TupleClobber
{
// as gccrs still doesen't contain a symbol class I have put them as strings
std::string symbol;
- Location loc;
+ location_t loc;
};
struct TupleTemplateStr
@@ -4604,7 +4604,7 @@ struct TupleTemplateStr
// as gccrs still doesen't contain a symbol class I have put them as strings
std::string symbol;
std::string optional_symbol;
- Location loc;
+ location_t loc;
};
// Inline Assembly Node
@@ -4616,7 +4616,7 @@ public:
std::vector<InlineAsmOperand> operands;
TupleClobber clobber_abi;
InlineAsmOptions options;
- std::vector<Location> line_spans;
+ std::vector<location_t> line_spans;
};
} // namespace AST
diff --git a/gcc/rust/ast/rust-item.h b/gcc/rust/ast/rust-item.h
index 365b20b..dad20c7 100644
--- a/gcc/rust/ast/rust-item.h
+++ b/gcc/rust/ast/rust-item.h
@@ -667,14 +667,14 @@ public:
// Creates a public visibility with no further features/arguments.
// empty?
- static Visibility create_public (Location pub_vis_location)
+ static Visibility create_public (location_t pub_vis_location)
{
return Visibility (PUB, SimplePath::create_empty (), pub_vis_location);
}
// Creates a public visibility with crate-relative paths
- static Visibility create_crate (Location crate_tok_location,
- Location crate_vis_location)
+ static Visibility create_crate (location_t crate_tok_location,
+ location_t crate_vis_location)
{
return Visibility (PUB_CRATE,
SimplePath::from_str ("crate", crate_tok_location),
@@ -682,8 +682,8 @@ public:
}
// Creates a public visibility with self-relative paths
- static Visibility create_self (Location self_tok_location,
- Location self_vis_location)
+ static Visibility create_self (location_t self_tok_location,
+ location_t self_vis_location)
{
return Visibility (PUB_SELF,
SimplePath::from_str ("self", self_tok_location),
@@ -691,8 +691,8 @@ public:
}
// Creates a public visibility with parent module-relative paths
- static Visibility create_super (Location super_tok_location,
- Location super_vis_location)
+ static Visibility create_super (location_t super_tok_location,
+ location_t super_vis_location)
{
return Visibility (PUB_SUPER,
SimplePath::from_str ("super", super_tok_location),
@@ -707,7 +707,7 @@ public:
// Creates a public visibility with a given path or whatever.
static Visibility create_in_path (SimplePath in_path,
- Location in_path_vis_location)
+ location_t in_path_vis_location)
{
return Visibility (PUB_IN_PATH, std::move (in_path), in_path_vis_location);
}
diff --git a/gcc/rust/ast/rust-macro.h b/gcc/rust/ast/rust-macro.h
index 78941f8..a9d5b95 100644
--- a/gcc/rust/ast/rust-macro.h
+++ b/gcc/rust/ast/rust-macro.h
@@ -190,7 +190,7 @@ public:
}
std::string as_string () const override;
- Location get_match_locus () const override { return locus; };
+ location_t get_match_locus () const override { return locus; };
void accept_vis (ASTVisitor &vis) override;
@@ -281,7 +281,7 @@ public:
MacroMatchRepetition &operator= (MacroMatchRepetition &&other) = default;
std::string as_string () const override;
- Location get_match_locus () const override { return locus; };
+ location_t get_match_locus () const override { return locus; };
void accept_vis (ASTVisitor &vis) override;
@@ -359,7 +359,7 @@ public:
// Returns whether MacroMatcher is in an error state.
bool is_error () const { return is_invalid; }
- Location get_match_locus () const override { return locus; }
+ location_t get_match_locus () const override { return locus; }
std::string as_string () const override;
@@ -468,7 +468,7 @@ private:
std::vector<MacroRule> rules; // inlined form
location_t locus;
- std::function<Fragment (Location, MacroInvocData &)> associated_transcriber;
+ std::function<Fragment (location_t, MacroInvocData &)> associated_transcriber;
// Since we can't compare std::functions, we need to use an extra boolean
bool is_builtin_rule;
MacroKind kind;
@@ -480,7 +480,7 @@ private:
* should make use of the actual rules. If the macro is builtin, then another
* associated transcriber should be used
*/
- static Fragment dummy_builtin (Location, MacroInvocData &)
+ static Fragment dummy_builtin (location_t, MacroInvocData &)
{
rust_unreachable ();
return Fragment::create_error ();
@@ -502,10 +502,10 @@ private:
kind (kind)
{}
- MacroRulesDefinition (
- Identifier builtin_name, DelimType delim_type,
- std::function<Fragment (Location, MacroInvocData &)> associated_transcriber,
- MacroKind kind, Visibility vis)
+ MacroRulesDefinition (Identifier builtin_name, DelimType delim_type,
+ std::function<Fragment (location_t, MacroInvocData &)>
+ associated_transcriber,
+ MacroKind kind, Visibility vis)
: VisItem (std::move (vis), std::vector<Attribute> ()),
outer_attrs (std::vector<Attribute> ()), rule_name (builtin_name),
delim_type (delim_type), rules (std::vector<MacroRule> ()),
@@ -560,14 +560,14 @@ public:
const std::vector<MacroRule> &get_rules () const { return rules; }
bool is_builtin () const { return is_builtin_rule; }
- const std::function<Fragment (Location, MacroInvocData &)> &
+ const std::function<Fragment (location_t, MacroInvocData &)> &
get_builtin_transcriber () const
{
rust_assert (is_builtin ());
return associated_transcriber;
}
void set_builtin_transcriber (
- std::function<Fragment (Location, MacroInvocData &)> transcriber)
+ std::function<Fragment (location_t, MacroInvocData &)> transcriber)
{
associated_transcriber = transcriber;
is_builtin_rule = true;
@@ -926,10 +926,10 @@ protected:
class MetaWord : public MetaItem
{
Identifier ident;
- Location ident_locus;
+ location_t ident_locus;
public:
- MetaWord (Identifier ident, Location ident_locus)
+ MetaWord (Identifier ident, location_t ident_locus)
: ident (std::move (ident)), ident_locus (ident_locus)
{}
@@ -962,15 +962,15 @@ protected:
class MetaNameValueStr : public MetaItem
{
Identifier ident;
- Location ident_locus;
+ location_t ident_locus;
// NOTE: str stored without quotes
std::string str;
- Location str_locus;
+ location_t str_locus;
public:
- MetaNameValueStr (Identifier ident, Location ident_locus, std::string str,
- Location str_locus)
+ MetaNameValueStr (Identifier ident, location_t ident_locus, std::string str,
+ location_t str_locus)
: ident (std::move (ident)), ident_locus (ident_locus),
str (std::move (str)), str_locus (str_locus)
{}
@@ -1019,11 +1019,11 @@ protected:
class MetaListPaths : public MetaItem
{
Identifier ident;
- Location ident_locus;
+ location_t ident_locus;
std::vector<SimplePath> paths;
public:
- MetaListPaths (Identifier ident, Location ident_locus,
+ MetaListPaths (Identifier ident, location_t ident_locus,
std::vector<SimplePath> paths)
: ident (std::move (ident)), ident_locus (ident_locus),
paths (std::move (paths))
@@ -1064,11 +1064,11 @@ protected:
class MetaListNameValueStr : public MetaItem
{
Identifier ident;
- Location ident_locus;
+ location_t ident_locus;
std::vector<MetaNameValueStr> strs;
public:
- MetaListNameValueStr (Identifier ident, Location ident_locus,
+ MetaListNameValueStr (Identifier ident, location_t ident_locus,
std::vector<MetaNameValueStr> strs)
: ident (std::move (ident)), ident_locus (ident_locus),
strs (std::move (strs))
diff --git a/gcc/rust/ast/rust-path.h b/gcc/rust/ast/rust-path.h
index 12326a3..14524c7 100644
--- a/gcc/rust/ast/rust-path.h
+++ b/gcc/rust/ast/rust-path.h
@@ -209,7 +209,7 @@ public:
bool is_error () const { return kind == Kind::Error; }
Kind get_kind () const { return kind; }
- const Location &get_locus () const { return locus; }
+ location_t get_locus () const { return locus; }
void accept_vis (AST::ASTVisitor &visitor)
{