aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/resolve
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/rust/resolve')
-rw-r--r--gcc/rust/resolve/rust-ast-resolve-implitem.h6
-rw-r--r--gcc/rust/resolve/rust-ast-resolve-item.h53
-rw-r--r--gcc/rust/resolve/rust-ast-resolve-stmt.h35
-rw-r--r--gcc/rust/resolve/rust-ast-resolve-toplevel.h6
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);