diff options
author | Marc Poulhiès <dkm@kataplop.net> | 2023-06-28 22:02:37 +0200 |
---|---|---|
committer | Philip Herron <philip.herron@embecosm.com> | 2023-06-30 17:15:14 +0000 |
commit | 539e4bcd98bcbbc1b60038a5d355eea24f890bb9 (patch) | |
tree | c9571fae18e0b06f5e018d0adb6e6d79715330d9 /gcc/rust/hir/rust-hir-dump.cc | |
parent | d96093d97b5ab84005a2bc615dda953a53f97cd1 (diff) | |
download | gcc-539e4bcd98bcbbc1b60038a5d355eea24f890bb9.zip gcc-539e4bcd98bcbbc1b60038a5d355eea24f890bb9.tar.gz gcc-539e4bcd98bcbbc1b60038a5d355eea24f890bb9.tar.bz2 |
gccrs: factor out inner attributes in a class
Introduce WithInnerAttrs class that can be inherited instead of
duplicating the same data/method in all HIR classes.
gcc/rust/ChangeLog:
* hir/tree/rust-hir.h (class WithInnerAttrs): New.
(class Item): Adjust to new WithInnerAttrs class.
(struct Crate): Likewise.
* hir/rust-hir-dump.cc (Dump::go): Likewise.
(Dump::visit): Likewise.
* hir/tree/rust-hir-expr.h (class GroupedExpr): Likewise.
(class ArrayExpr): Likewise.
(class TupleExpr): Likewise.
(class StructExprStruct): Likewise.
(class BlockExpr): Likewise.
(class MatchExpr): Likewise.
* hir/tree/rust-hir-item.h (TypeParam::get_outer_attribute): New.
(class Module): Adjust to new WithInnerAttrs class.
(struct StructField): change struct to...
(class StructField): ... a class.
(class ImplBlock): Adjust to new WithInnerAttrs class.
(class ExternBlock): Likewise.
Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
Diffstat (limited to 'gcc/rust/hir/rust-hir-dump.cc')
-rw-r--r-- | gcc/rust/hir/rust-hir-dump.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/gcc/rust/hir/rust-hir-dump.cc b/gcc/rust/hir/rust-hir-dump.cc index 27138df..5f3db42 100644 --- a/gcc/rust/hir/rust-hir-dump.cc +++ b/gcc/rust/hir/rust-hir-dump.cc @@ -28,12 +28,12 @@ Dump::go (HIR::Crate &crate) { stream << "Crate {" << std::endl; // inner attributes - if (!crate.inner_attrs.empty ()) + if (!crate.get_inner_attrs ().empty ()) { indentation.increment (); stream << indentation; stream << "inner_attrs: ["; - for (auto &attr : crate.inner_attrs) + for (auto &attr : crate.get_inner_attrs ()) stream << attr.as_string (); stream << "]," << std::endl; indentation.decrement (); @@ -272,11 +272,11 @@ Dump::visit (BlockExpr &block_expr) indentation.increment (); // TODO: inner attributes - if (!block_expr.inner_attrs.empty ()) + if (!block_expr.get_inner_attrs ().empty ()) { stream << indentation << "inner_attrs: ["; indentation.increment (); - for (auto &attr : block_expr.inner_attrs) + for (auto &attr : block_expr.get_inner_attrs ()) { stream << "\n"; stream << indentation; |