aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur Cohen <arthur.cohen@embecosm.com>2022-04-12 10:47:57 +0200
committerArthur Cohen <arthur.cohen@embecosm.com>2022-04-12 15:26:11 +0200
commit1e5126022d8db1adaa925a810dbe0f8f0a13d1fa (patch)
tree5b3e2324d2fb51a8baa0053ed32b215a31b18c56
parent3058b55328a3604d64ac799eaffb089b114e88a3 (diff)
downloadgcc-1e5126022d8db1adaa925a810dbe0f8f0a13d1fa.zip
gcc-1e5126022d8db1adaa925a810dbe0f8f0a13d1fa.tar.gz
gcc-1e5126022d8db1adaa925a810dbe0f8f0a13d1fa.tar.bz2
privacy: reachability: Visit all types of a struct's public fields
-rw-r--r--gcc/rust/privacy/rust-reachability.cc11
1 files changed, 4 insertions, 7 deletions
diff --git a/gcc/rust/privacy/rust-reachability.cc b/gcc/rust/privacy/rust-reachability.cc
index 8c1e9be..82a4827 100644
--- a/gcc/rust/privacy/rust-reachability.cc
+++ b/gcc/rust/privacy/rust-reachability.cc
@@ -110,15 +110,12 @@ ReachabilityVisitor::visit (HIR::StructStruct &struct_item)
}
}
- // for (auto &field : struct_item.get_fields ())
- // if (field.get_visibility ().is_public ())
- // FIXME: How do we visit these fields with the reachability
- // visitor?
+ for (auto &field : struct_item.get_fields ())
+ if (field.get_visibility ().is_public ())
+ ctx.update_reachability (field.get_field_type ()->get_mappings (),
+ struct_reach);
}
- // FIXME: How do we get the constructor from `struct_item`? We need to update
- // its visibility as well. Probably by keeping a reference to the TypeCtx?
-
current_level = old_level;
}