diff options
author | Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com> | 2023-03-30 20:05:14 +0200 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2024-01-16 18:28:44 +0100 |
commit | 36bca0cc1bbdb9da64a58cd1a7afaad30634e456 (patch) | |
tree | 29e657800ff613a31a49d0711bd6e0b2d365f408 /gcc/rust/ast/rust-path.h | |
parent | 0c985f7d309d321482833d409df8864820c778eb (diff) | |
download | gcc-36bca0cc1bbdb9da64a58cd1a7afaad30634e456.zip gcc-36bca0cc1bbdb9da64a58cd1a7afaad30634e456.tar.gz gcc-36bca0cc1bbdb9da64a58cd1a7afaad30634e456.tar.bz2 |
gccrs: ast: Add outer attribute getter to Expr class
We need to retrieve outer attributes from some Expressions depending on
their context. This means this should be retrieved from their parent
node. But expr did not have a getter for outer attributes since some
expr can't have any outer attribute.
gcc/rust/ChangeLog:
* ast/rust-ast.h: Add getter to Expr class.
* ast/rust-expr.h: Add override attribute to existing getters.
Also implement it for RangeExpr, attempting to retrieve outer
attributes on those types will crash the compiler.
* ast/rust-macro.h: Add override attribute to existing getters.
* ast/rust-path.h: Likewise.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Diffstat (limited to 'gcc/rust/ast/rust-path.h')
-rw-r--r-- | gcc/rust/ast/rust-path.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/rust/ast/rust-path.h b/gcc/rust/ast/rust-path.h index 0b9c280..8e4eb19 100644 --- a/gcc/rust/ast/rust-path.h +++ b/gcc/rust/ast/rust-path.h @@ -636,7 +636,7 @@ public: NodeId get_node_id () const override { return _node_id; } const std::vector<Attribute> &get_outer_attrs () const { return outer_attrs; } - std::vector<Attribute> &get_outer_attrs () { return outer_attrs; } + std::vector<Attribute> &get_outer_attrs () override { return outer_attrs; } void set_outer_attrs (std::vector<Attribute> new_attrs) override { @@ -1233,7 +1233,7 @@ public: } const std::vector<Attribute> &get_outer_attrs () const { return outer_attrs; } - std::vector<Attribute> &get_outer_attrs () { return outer_attrs; } + std::vector<Attribute> &get_outer_attrs () override { return outer_attrs; } void set_outer_attrs (std::vector<Attribute> new_attrs) override { |