public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Ada] Remove bypass for instance bodies from Is_Visible_Component
@ 2020-06-09  8:10 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2020-06-09  8:10 UTC (permalink / raw)
  To: gcc-patches; +Cc: Eric Botcazou

[-- Attachment #1: Type: text/plain, Size: 520 bytes --]

This removes an obsolete bypass present for long in the predicate
Is_Visible_Component, which is responsible for determining whether
a component present in a private tagged record type is visible in
its extensions.  This bypass would essentially always return true
in bodies of instances, but there is no real basis to do so.

Tested on x86_64-pc-linux-gnu, committed on trunk

2020-06-09  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

	* sem_ch3.adb (Is_Visible_Component): Do not special-case
	bodies of instances.

[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 1417 bytes --]

--- gcc/ada/sem_ch3.adb
+++ gcc/ada/sem_ch3.adb
@@ -18762,39 +18762,6 @@ package body Sem_Ch3 is
       then
          return True;
 
-      --  In the body of an instantiation, check the visibility of a component
-      --  in case it has a homograph that is a primitive operation of a private
-      --  type which was not visible in the generic unit.
-
-      --  Should Is_Prefixed_Call be propagated from template to instance???
-
-      elsif In_Instance_Body then
-         if not Is_Tagged_Type (Original_Type)
-           or else not Is_Private_Type (Original_Type)
-         then
-            return True;
-
-         else
-            declare
-               Subp_Elmt : Elmt_Id;
-
-            begin
-               Subp_Elmt := First_Elmt (Primitive_Operations (Original_Type));
-               while Present (Subp_Elmt) loop
-
-                  --  The component is hidden by a primitive operation
-
-                  if Chars (Node (Subp_Elmt)) = Chars (C) then
-                     return False;
-                  end if;
-
-                  Next_Elmt (Subp_Elmt);
-               end loop;
-
-               return True;
-            end;
-         end if;
-
       --  If the component has been declared in an ancestor which is currently
       --  a private type, then it is not visible. The same applies if the
       --  component's containing type is not in an open scope and the original


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

only message in thread, other threads:[~2020-06-09  8:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-09  8:10 [Ada] Remove bypass for instance bodies from Is_Visible_Component Pierre-Marie de Rodat

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