public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/rust/master] privacy: reach: Rename ReachLevel enum
@ 2022-06-08 12:28 Thomas Schwinge
  0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2022-06-08 12:28 UTC (permalink / raw)
  To: gcc-cvs

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);


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-06-08 12:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-08 12:28 [gcc/devel/rust/master] privacy: reach: Rename ReachLevel enum Thomas Schwinge

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).