diff options
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 |