public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Thomas Schwinge <tschwinge@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc/devel/rust/master] privacy: reach: Rename ReachLevel enum Date: Wed, 8 Jun 2022 12:28:49 +0000 (GMT) [thread overview] Message-ID: <20220608122849.62AF7386DC69@sourceware.org> (raw) https://gcc.gnu.org/g:e01a8140613da2a7aeab99362c38a0e7b2e1e9e6 commit e01a8140613da2a7aeab99362c38a0e7b2e1e9e6 Author: Arthur Cohen <arthur.cohen@embecosm.com> Date: Tue Apr 5 12:11:34 2022 +0200 privacy: reach: Rename ReachLevel enum Diff: --- gcc/rust/privacy/rust-privacy-ctx.h | 4 ++-- gcc/rust/privacy/rust-reachability.cc | 7 +++++-- 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 2f10fd35cc5..2a11b56f3ca 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 3d6ae824354..5cab439739c 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 157ef740c73..6d8edc409cc 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);
reply other threads:[~2022-06-08 12:28 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220608122849.62AF7386DC69@sourceware.org \ --to=tschwinge@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).