public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/rust/master] privacy: reachability: Visit all types of a struct's public fields
@ 2022-06-08 12:29 Thomas Schwinge
  0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2022-06-08 12:29 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:1e5126022d8db1adaa925a810dbe0f8f0a13d1fa

commit 1e5126022d8db1adaa925a810dbe0f8f0a13d1fa
Author: Arthur Cohen <arthur.cohen@embecosm.com>
Date:   Tue Apr 12 10:47:57 2022 +0200

    privacy: reachability: Visit all types of a struct's public fields

Diff:
---
 gcc/rust/privacy/rust-reachability.cc | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/gcc/rust/privacy/rust-reachability.cc b/gcc/rust/privacy/rust-reachability.cc
index 8c1e9bedf92..82a48271177 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;
 }


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

only message in thread, other threads:[~2022-06-08 12:29 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:29 [gcc/devel/rust/master] privacy: reachability: Visit all types of a struct's public fields 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).