diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-09-01 10:37:18 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-01 10:37:18 +0000 |
commit | c33c6f3676dfca1a6bd7984cebf5028c015ea182 (patch) | |
tree | 0c830b9a468c78f3b0e4a140093cd09ebdda2989 /gcc/rust/expand/rust-macro-expand.cc | |
parent | 82e1061579796adaa39ab34da77b6c8c6ea82539 (diff) | |
parent | 3b5c0f65ef12bd4771f69195d232588cff86b270 (diff) | |
download | gcc-c33c6f3676dfca1a6bd7984cebf5028c015ea182.zip gcc-c33c6f3676dfca1a6bd7984cebf5028c015ea182.tar.gz gcc-c33c6f3676dfca1a6bd7984cebf5028c015ea182.tar.bz2 |
Merge #654
654: Cleanup some StructExpr related classes r=philberty a=dkm
From Mark Wielaard: https://gcc.gnu.org/pipermail/gcc-rust/2021-September/000163.html
> There are various Structure Expressions that don't actually "exist"
> because they are syntactically equivalent to other constructs. So we
> never really construct or use these classes. But they are still listed
> in various visitors, which is somewhat confusing. Removing the AST and
> HIR variants of these classes really cleans up the code IMHO.
Co-authored-by: Mark Wielaard <mark@klomp.org>
Diffstat (limited to 'gcc/rust/expand/rust-macro-expand.cc')
-rw-r--r-- | gcc/rust/expand/rust-macro-expand.cc | 136 |
1 files changed, 0 insertions, 136 deletions
diff --git a/gcc/rust/expand/rust-macro-expand.cc b/gcc/rust/expand/rust-macro-expand.cc index e4855e0..8134f7e 100644 --- a/gcc/rust/expand/rust-macro-expand.cc +++ b/gcc/rust/expand/rust-macro-expand.cc @@ -939,142 +939,6 @@ public: "cannot strip expression in this position - outer " "attributes not allowed"); } - void visit (AST::StructExprTuple &expr) override - { - // initial strip test based on outer attrs - expander.expand_cfg_attrs (expr.get_outer_attrs ()); - if (expander.fails_cfg_with_expand (expr.get_outer_attrs ())) - { - expr.mark_for_strip (); - return; - } - - /* strip test based on inner attrs - spec says these are inner - * attributes, not outer attributes of inner expr */ - expander.expand_cfg_attrs (expr.get_inner_attrs ()); - if (expander.fails_cfg_with_expand (expr.get_inner_attrs ())) - { - expr.mark_for_strip (); - return; - } - - // strip sub-exprs of path - auto &struct_name = expr.get_struct_name (); - visit (struct_name); - if (struct_name.is_marked_for_strip ()) - rust_error_at (struct_name.get_locus (), - "cannot strip path in this position"); - - /* spec says outer attributes are specifically allowed for elements - * of tuple-style struct expressions, so full stripping possible */ - expand_pointer_allow_strip (expr.get_elems ()); - } - void visit (AST::StructExprUnit &expr) override - { - // initial strip test based on outer attrs - expander.expand_cfg_attrs (expr.get_outer_attrs ()); - if (expander.fails_cfg_with_expand (expr.get_outer_attrs ())) - { - expr.mark_for_strip (); - return; - } - - // strip sub-exprs of path - auto &struct_name = expr.get_struct_name (); - visit (struct_name); - if (struct_name.is_marked_for_strip ()) - rust_error_at (struct_name.get_locus (), - "cannot strip path in this position"); - } - void visit (AST::EnumExprFieldIdentifier &) override - { - // as no attrs (at moment, at least), no stripping possible - } - void visit (AST::EnumExprFieldIdentifierValue &field) override - { - /* as no attrs possible (at moment, at least), only sub-expression - * stripping is possible */ - auto &value = field.get_value (); - value->accept_vis (*this); - if (value->is_marked_for_strip ()) - rust_error_at (value->get_locus (), - "cannot strip expression in this position - outer " - "attributes not allowed"); - } - void visit (AST::EnumExprFieldIndexValue &field) override - { - /* as no attrs possible (at moment, at least), only sub-expression - * stripping is possible */ - auto &value = field.get_value (); - value->accept_vis (*this); - if (value->is_marked_for_strip ()) - rust_error_at (value->get_locus (), - "cannot strip expression in this position - outer " - "attributes not allowed"); - } - void visit (AST::EnumExprStruct &expr) override - { - // initial strip test based on outer attrs - expander.expand_cfg_attrs (expr.get_outer_attrs ()); - if (expander.fails_cfg_with_expand (expr.get_outer_attrs ())) - { - expr.mark_for_strip (); - return; - } - - // supposedly spec doesn't allow inner attributes in enum exprs - - // strip sub-exprs of path - auto &enum_path = expr.get_enum_variant_path (); - visit (enum_path); - if (enum_path.is_marked_for_strip ()) - rust_error_at (enum_path.get_locus (), - "cannot strip path in this position"); - - /* spec does not specify whether expressions are allowed to be - * stripped at top level of expression fields, but I wouldn't think - * that they would be, so operating under the assumption that only - * sub-expressions can be stripped. */ - for (auto &field : expr.get_fields ()) - { - field->accept_vis (*this); - // shouldn't strip in this - } - } - void visit (AST::EnumExprTuple &expr) override - { - // initial strip test based on outer attrs - expander.expand_cfg_attrs (expr.get_outer_attrs ()); - if (expander.fails_cfg_with_expand (expr.get_outer_attrs ())) - { - expr.mark_for_strip (); - return; - } - - // supposedly spec doesn't allow inner attributes in enum exprs - - // strip sub-exprs of path - auto &enum_path = expr.get_enum_variant_path (); - visit (enum_path); - if (enum_path.is_marked_for_strip ()) - rust_error_at (enum_path.get_locus (), - "cannot strip path in this position"); - - /* spec says outer attributes are specifically allowed for elements - * of tuple-style enum expressions, so full stripping possible */ - expand_pointer_allow_strip (expr.get_elems ()); - } - void visit (AST::EnumExprFieldless &expr) override - { - // can't be stripped as no attrs - - // strip sub-exprs of path - auto &enum_path = expr.get_enum_variant_path (); - visit (enum_path); - if (enum_path.is_marked_for_strip ()) - rust_error_at (enum_path.get_locus (), - "cannot strip path in this position"); - } void visit (AST::CallExpr &expr) override { // initial strip test based on outer attrs |