diff options
author | mxlol233 <mxlol233@outlook.com> | 2023-01-11 23:24:07 +0800 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2023-04-06 10:47:17 +0200 |
commit | 8e2abbef4cc04adf048730b1a608cf95b6d5cc4f (patch) | |
tree | 5177d795ae3869d51033bf92cbd9baee9f72ef8d /gcc/rust/ast/rust-expr.h | |
parent | 364f4cd3072cb1fa99431fe001f03451059f075e (diff) | |
download | gcc-8e2abbef4cc04adf048730b1a608cf95b6d5cc4f.zip gcc-8e2abbef4cc04adf048730b1a608cf95b6d5cc4f.tar.gz gcc-8e2abbef4cc04adf048730b1a608cf95b6d5cc4f.tar.bz2 |
gccrs: Add get_locus function for abstract class MetaItemInner.
This commit adds virtual function get_locus to base class MetaItemInner,
which is helpful when we need to print diagnostics on some sub-classes of
MetaItemInner.
gcc/rust/ChangeLog:
* ast/rust-ast.h: Add get_locus method.
* ast/rust-expr.h: Likewise.
* ast/rust-macro.h: Likewise.
Signed-off-by: Xiao Ma <mxlol233@outlook.com>
Diffstat (limited to 'gcc/rust/ast/rust-expr.h')
-rw-r--r-- | gcc/rust/ast/rust-expr.h | 8 |
1 files changed, 8 insertions, 0 deletions
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; |