diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2022-02-03 11:33:00 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-03 11:33:00 +0000 |
commit | 016db703cb0a5c2c4eb52dd8b29bbc01826c4e5c (patch) | |
tree | 4baa7da3f520efec9d02c4d0c44a8b07268a6f5d /gcc/rust/resolve | |
parent | f7f14de056eb3887e70f29b0f29da4025f746559 (diff) | |
parent | 4d1ca35582e69e8677bd96775edbf03b6eec6ab8 (diff) | |
download | gcc-016db703cb0a5c2c4eb52dd8b29bbc01826c4e5c.zip gcc-016db703cb0a5c2c4eb52dd8b29bbc01826c4e5c.tar.gz gcc-016db703cb0a5c2c4eb52dd8b29bbc01826c4e5c.tar.bz2 |
Merge #904
904: Apply the is_marked_for_strip check to the rest of the crate r=philberty a=philberty
We need to apply this to all levels of the crate:
Item
types
impl-item
trait-item
Stmt
expr's
Fixes #872
Co-authored-by: Philip Herron <philip.herron@embecosm.com>
Diffstat (limited to 'gcc/rust/resolve')
-rw-r--r-- | gcc/rust/resolve/rust-ast-resolve-implitem.h | 6 | ||||
-rw-r--r-- | gcc/rust/resolve/rust-ast-resolve-item.h | 53 | ||||
-rw-r--r-- | gcc/rust/resolve/rust-ast-resolve-stmt.h | 35 | ||||
-rw-r--r-- | gcc/rust/resolve/rust-ast-resolve-toplevel.h | 6 |
4 files changed, 80 insertions, 20 deletions
diff --git a/gcc/rust/resolve/rust-ast-resolve-implitem.h b/gcc/rust/resolve/rust-ast-resolve-implitem.h index 074855e..f17b222 100644 --- a/gcc/rust/resolve/rust-ast-resolve-implitem.h +++ b/gcc/rust/resolve/rust-ast-resolve-implitem.h @@ -33,12 +33,18 @@ class ResolveToplevelImplItem : public ResolverBase public: static void go (AST::InherentImplItem *item, const CanonicalPath &prefix) { + if (item->is_marked_for_strip ()) + return; + ResolveToplevelImplItem resolver (prefix); item->accept_vis (resolver); } static void go (AST::TraitImplItem *item, const CanonicalPath &prefix) { + if (item->is_marked_for_strip ()) + return; + ResolveToplevelImplItem resolver (prefix); item->accept_vis (resolver); } diff --git a/gcc/rust/resolve/rust-ast-resolve-item.h b/gcc/rust/resolve/rust-ast-resolve-item.h index cff3dbb..5d32c00 100644 --- a/gcc/rust/resolve/rust-ast-resolve-item.h +++ b/gcc/rust/resolve/rust-ast-resolve-item.h @@ -38,6 +38,9 @@ public: static void go (AST::TraitItem *item, const CanonicalPath &prefix, const CanonicalPath &canonical_prefix) { + if (item->is_marked_for_strip ()) + return; + ResolveTraitItems resolver (prefix, canonical_prefix); item->accept_vis (resolver); }; @@ -303,8 +306,13 @@ public: ResolveWhereClause::Resolve (struct_decl.get_where_clause ()); for (AST::TupleField &field : struct_decl.get_fields ()) - ResolveType::go (field.get_field_type ().get (), - struct_decl.get_node_id ()); + { + if (field.get_field_type ()->is_marked_for_strip ()) + continue; + + ResolveType::go (field.get_field_type ().get (), + struct_decl.get_node_id ()); + } resolver->get_type_scope ().pop (); } @@ -360,7 +368,12 @@ public: item.get_node_id (), cpath); for (auto &field : item.get_tuple_fields ()) - ResolveType::go (field.get_field_type ().get (), item.get_node_id ()); + { + if (field.get_field_type ()->is_marked_for_strip ()) + continue; + + ResolveType::go (field.get_field_type ().get (), item.get_node_id ()); + } } void visit (AST::EnumItemStruct &item) override @@ -373,7 +386,12 @@ public: item.get_node_id (), cpath); for (auto &field : item.get_struct_fields ()) - ResolveType::go (field.get_field_type ().get (), item.get_node_id ()); + { + if (field.get_field_type ()->is_marked_for_strip ()) + continue; + + ResolveType::go (field.get_field_type ().get (), item.get_node_id ()); + } } void visit (AST::EnumItemDiscriminant &item) override @@ -412,8 +430,13 @@ public: ResolveWhereClause::Resolve (struct_decl.get_where_clause ()); for (AST::StructField &field : struct_decl.get_fields ()) - ResolveType::go (field.get_field_type ().get (), - struct_decl.get_node_id ()); + { + if (field.get_field_type ()->is_marked_for_strip ()) + continue; + + ResolveType::go (field.get_field_type ().get (), + struct_decl.get_node_id ()); + } resolver->get_type_scope ().pop (); } @@ -442,8 +465,13 @@ public: ResolveWhereClause::Resolve (union_decl.get_where_clause ()); for (AST::StructField &field : union_decl.get_variants ()) - ResolveType::go (field.get_field_type ().get (), - union_decl.get_node_id ()); + { + if (field.get_field_type ()->is_marked_for_strip ()) + continue; + + ResolveType::go (field.get_field_type ().get (), + union_decl.get_node_id ()); + } resolver->get_type_scope ().pop (); } @@ -486,9 +514,6 @@ public: void visit (AST::Function &function) override { - if (function.is_marked_for_strip ()) - return; - auto decl = ResolveFunctionItemToCanonicalPath::resolve (function); auto path = prefix.append (decl); auto cpath = canonical_prefix.append (decl); @@ -884,6 +909,9 @@ public: static void go (AST::InherentImplItem *item, const CanonicalPath &prefix, const CanonicalPath &canonical_prefix) { + if (item->is_marked_for_strip ()) + return; + ResolveImplItems resolver (prefix, canonical_prefix); item->accept_vis (resolver); }; @@ -891,6 +919,9 @@ public: static void go (AST::TraitImplItem *item, const CanonicalPath &prefix, const CanonicalPath &canonical_prefix) { + if (item->is_marked_for_strip ()) + return; + ResolveImplItems resolver (prefix, canonical_prefix); item->accept_vis (resolver); }; diff --git a/gcc/rust/resolve/rust-ast-resolve-stmt.h b/gcc/rust/resolve/rust-ast-resolve-stmt.h index 308de14..3afed53 100644 --- a/gcc/rust/resolve/rust-ast-resolve-stmt.h +++ b/gcc/rust/resolve/rust-ast-resolve-stmt.h @@ -37,6 +37,9 @@ public: const CanonicalPath &canonical_prefix, const CanonicalPath &enum_prefix) { + if (stmt->is_marked_for_strip ()) + return; + ResolveStmt resolver (parent, prefix, canonical_prefix, enum_prefix); stmt->accept_vis (resolver); }; @@ -208,7 +211,12 @@ public: }); for (auto &field : item.get_tuple_fields ()) - ResolveType::go (field.get_field_type ().get (), item.get_node_id ()); + { + if (field.get_field_type ()->is_marked_for_strip ()) + continue; + + ResolveType::go (field.get_field_type ().get (), item.get_node_id ()); + } } void visit (AST::EnumItemStruct &item) override @@ -229,7 +237,12 @@ public: }); for (auto &field : item.get_struct_fields ()) - ResolveType::go (field.get_field_type ().get (), item.get_node_id ()); + { + if (field.get_field_type ()->is_marked_for_strip ()) + continue; + + ResolveType::go (field.get_field_type ().get (), item.get_node_id ()); + } } void visit (AST::EnumItemDiscriminant &item) override @@ -282,8 +295,13 @@ public: } for (AST::StructField &field : struct_decl.get_fields ()) - ResolveType::go (field.get_field_type ().get (), - struct_decl.get_node_id ()); + { + if (field.get_field_type ()->is_marked_for_strip ()) + continue; + + ResolveType::go (field.get_field_type ().get (), + struct_decl.get_node_id ()); + } resolver->get_type_scope ().pop (); } @@ -317,8 +335,13 @@ public: } for (AST::StructField &field : union_decl.get_variants ()) - ResolveType::go (field.get_field_type ().get (), - union_decl.get_node_id ()); + { + if (field.get_field_type ()->is_marked_for_strip ()) + continue; + + ResolveType::go (field.get_field_type ().get (), + union_decl.get_node_id ()); + } resolver->get_type_scope ().pop (); } diff --git a/gcc/rust/resolve/rust-ast-resolve-toplevel.h b/gcc/rust/resolve/rust-ast-resolve-toplevel.h index 56962f6..7aba67f 100644 --- a/gcc/rust/resolve/rust-ast-resolve-toplevel.h +++ b/gcc/rust/resolve/rust-ast-resolve-toplevel.h @@ -36,6 +36,9 @@ public: static void go (AST::Item *item, const CanonicalPath &prefix, const CanonicalPath &canonical_prefix) { + if (item->is_marked_for_strip ()) + return; + ResolveTopLevel resolver (prefix, canonical_prefix); item->accept_vis (resolver); }; @@ -286,9 +289,6 @@ public: void visit (AST::Function &function) override { - if (function.is_marked_for_strip ()) - return; - auto decl = ResolveFunctionItemToCanonicalPath::resolve (function); auto path = prefix.append (decl); auto cpath = canonical_prefix.append (decl); |