aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/rust/ast/rust-ast.h2
-rw-r--r--gcc/rust/ast/rust-expr.h8
-rw-r--r--gcc/rust/ast/rust-macro.h12
3 files changed, 22 insertions, 0 deletions
diff --git a/gcc/rust/ast/rust-ast.h b/gcc/rust/ast/rust-ast.h
index 5f18233..d30e6d4 100644
--- a/gcc/rust/ast/rust-ast.h
+++ b/gcc/rust/ast/rust-ast.h
@@ -630,6 +630,8 @@ public:
virtual ~MetaItemInner ();
+ virtual Location get_locus () const = 0;
+
virtual std::string as_string () const = 0;
virtual void accept_vis (ASTVisitor &vis) = 0;
diff --git a/gcc/rust/ast/rust-expr.h b/gcc/rust/ast/rust-expr.h
index c58fae5..34bc699 100644
--- a/gcc/rust/ast/rust-expr.h
+++ b/gcc/rust/ast/rust-expr.h
@@ -150,6 +150,8 @@ public:
std::string as_string () const override { return lit_expr.as_string (); }
+ Location get_locus () const override { return lit_expr.get_locus (); }
+
void accept_vis (ASTVisitor &vis) override;
bool check_cfg_predicate (const Session &session) const override;
@@ -178,6 +180,12 @@ public:
return path.as_string () + " = " + lit.as_string ();
}
+ // There are two Locations in MetaItemPathLit (path and lit_expr),
+ // we have no idea use which of them, just simply return UNKNOWN_LOCATION
+ // now.
+ // Maybe we will figure out when we really need the location in the future.
+ Location get_locus () const override { return Location (UNKNOWN_LOCATION); }
+
void accept_vis (ASTVisitor &vis) override;
bool check_cfg_predicate (const Session &session) const override;
diff --git a/gcc/rust/ast/rust-macro.h b/gcc/rust/ast/rust-macro.h
index bff8c7a..4226c69 100644
--- a/gcc/rust/ast/rust-macro.h
+++ b/gcc/rust/ast/rust-macro.h
@@ -725,6 +725,8 @@ public:
return path;
}
+ Location get_locus () const override { return path.get_locus (); }
+
bool check_cfg_predicate (const Session &session) const override;
Attribute to_attribute () const override;
@@ -778,6 +780,8 @@ public:
void accept_vis (ASTVisitor &vis) override;
+ Location get_locus () const override { return path.get_locus (); }
+
bool check_cfg_predicate (const Session &session) const override;
Attribute to_attribute () const override;
@@ -805,6 +809,8 @@ public:
void accept_vis (ASTVisitor &vis) override;
+ Location get_locus () const override { return ident_locus; }
+
bool check_cfg_predicate (const Session &session) const override;
Attribute to_attribute () const override;
@@ -847,6 +853,8 @@ public:
return std::unique_ptr<MetaNameValueStr> (clone_meta_item_inner_impl ());
}
+ Location get_locus () const override { return ident_locus; }
+
bool check_cfg_predicate (const Session &session) const override;
Attribute to_attribute () const override;
@@ -885,6 +893,8 @@ public:
void accept_vis (ASTVisitor &vis) override;
+ Location get_locus () const override { return ident_locus; }
+
bool check_cfg_predicate (const Session &session) const override;
Attribute to_attribute () const override;
@@ -919,6 +929,8 @@ public:
void accept_vis (ASTVisitor &vis) override;
+ Location get_locus () const override { return ident_locus; }
+
bool check_cfg_predicate (const Session &session) const override;
Attribute to_attribute () const override;