diff options
author | Arthur Cohen <arthur.cohen@embecosm.com> | 2022-04-05 12:11:34 +0200 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2022-04-12 14:20:28 +0200 |
commit | e01a8140613da2a7aeab99362c38a0e7b2e1e9e6 (patch) | |
tree | c6d7b981f9524e24ab72af6439244f82b92a7e3d /gcc | |
parent | 8bf037fede04cd8539add51310464f121c7af613 (diff) | |
download | gcc-e01a8140613da2a7aeab99362c38a0e7b2e1e9e6.zip gcc-e01a8140613da2a7aeab99362c38a0e7b2e1e9e6.tar.gz gcc-e01a8140613da2a7aeab99362c38a0e7b2e1e9e6.tar.bz2 |
privacy: reach: Rename ReachLevel enum
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/rust/privacy/rust-privacy-ctx.h | 4 | ||||
-rw-r--r-- | gcc/rust/privacy/rust-reachability.cc | 7 | ||||
-rw-r--r-- | gcc/rust/privacy/rust-reachability.h | 2 |
3 files changed, 8 insertions, 5 deletions
diff --git a/gcc/rust/privacy/rust-privacy-ctx.h b/gcc/rust/privacy/rust-privacy-ctx.h index 2f10fd3..2a11b56 100644 --- a/gcc/rust/privacy/rust-privacy-ctx.h +++ b/gcc/rust/privacy/rust-privacy-ctx.h @@ -28,8 +28,8 @@ namespace Privacy { */ enum ReachLevel { - Private, - Public, + Unreachable, + Reachable, }; class PrivacyContext diff --git a/gcc/rust/privacy/rust-reachability.cc b/gcc/rust/privacy/rust-reachability.cc index 3d6ae82..5cab439 100644 --- a/gcc/rust/privacy/rust-reachability.cc +++ b/gcc/rust/privacy/rust-reachability.cc @@ -56,16 +56,19 @@ ReachabilityVisitor::visit (HIR::TypeAlias &type_alias) void ReachabilityVisitor::visit (HIR::StructStruct &struct_item) { - auto struct_reach = ReachLevel::Private; + auto struct_reach = ReachLevel::Unreachable; // FIXME: This feels very wrong. Should we check for `has_visibility` // beforehand? Is it just private otherwise? Should the `HIR::Visibility` also // keep variants for private items? if (struct_item.get_visibility ().get_vis_type () == HIR::Visibility::NONE) - struct_reach = ReachLevel::Public; + struct_reach = ReachLevel::Reachable; // FIXME: Here we want to update only if the visibility is higher ctx.insert_reachability (struct_item.get_mappings (), struct_reach); + // FIXME: We need to also visit the fields as they might have their own set + // of reachability levels + for (auto &field : struct_item.get_fields ()) ctx.insert_reachability (field.get_mappings (), struct_reach); diff --git a/gcc/rust/privacy/rust-reachability.h b/gcc/rust/privacy/rust-reachability.h index 157ef74..6d8edc4 100644 --- a/gcc/rust/privacy/rust-reachability.h +++ b/gcc/rust/privacy/rust-reachability.h @@ -37,7 +37,7 @@ class ReachabilityVisitor : public HIR::HIRVisItemVisitor { public: ReachabilityVisitor (PrivacyContext &ctx) - : current_level (ReachLevel::Private), ctx (ctx) + : current_level (ReachLevel::Unreachable), ctx (ctx) {} virtual void visit (HIR::Module &mod); |