]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Rename Private_Component function
authorRonan Desplanques <desplanques@adacore.com>
Mon, 30 Mar 2026 10:36:02 +0000 (12:36 +0200)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Tue, 2 Jun 2026 08:42:20 +0000 (10:42 +0200)
The expression "private component" is best reserved for components of
protected objects' private sections. This renames a function from
"Private_Component" to a more explicit name because that function is not
about the protected object component case.

gcc/ada/ChangeLog:

* sem_util.ads, sem_util.adb (Private_Component): Rename into...
(Partially_Visible_Subcomponent): ...this.
* sem_ch3.adb (Analyze_Component_Declaration, Array_Type_Declaration):
Adapt to above renaming.
* sem_ch7.adb (Install_Composite_Operations): Likewise.

gcc/ada/sem_ch3.adb
gcc/ada/sem_ch7.adb
gcc/ada/sem_util.adb
gcc/ada/sem_util.ads

index 612cf712fd58c2aabbfe67431a5b65bb1b5c0dbb..7e28881aeb0bf6d51f7e12aa156ef26b0adda564 100644 (file)
@@ -2222,7 +2222,7 @@ package body Sem_Ch3 is
       --  If this component is private (or depends on a private type), flag the
       --  record type to indicate that some operations are not available.
 
-      P := Private_Component (T);
+      P := Partially_Visible_Subcomponent (T);
 
       if Present (P) then
 
@@ -6814,7 +6814,7 @@ package body Sem_Ch3 is
          end if;
       end if;
 
-      Priv := Private_Component (Element_Type);
+      Priv := Partially_Visible_Subcomponent (Element_Type);
 
       if Present (Priv) then
 
index 1f2fe1622ef42a297ed91eec39b6862dc8841607..90de70d2568f26a077f6b19780e25e657a262f76 100644 (file)
@@ -697,7 +697,7 @@ package body Sem_Ch7 is
             if Is_Type (Id)
               and then (Is_Limited_Composite (Id)
                          or else Is_Private_Composite (Id))
-              and then No (Private_Component (Id))
+              and then No (Partially_Visible_Subcomponent (Id))
             then
                Set_Is_Limited_Composite (Id, False);
                Set_Is_Private_Composite (Id, False);
index 863fd4d87b2aa80a042f830e9355202ac8ea735d..9348bf87d7faf41496d35fe86eb6ddf83de3a9f2 100644 (file)
@@ -27240,11 +27240,13 @@ package body Sem_Util is
       end if;
    end Predicate_Tests_On_Arguments;
 
-   -----------------------
-   -- Private_Component --
-   -----------------------
+   ------------------------------------
+   -- Partially_Visible_Subcomponent --
+   ------------------------------------
 
-   function Private_Component (Type_Id : Entity_Id) return Entity_Id is
+   function Partially_Visible_Subcomponent
+     (Type_Id : Entity_Id) return Entity_Id
+   is
       Ancestor  : constant Entity_Id := Base_Type (Type_Id);
 
       function Trace_Components
@@ -27329,7 +27331,7 @@ package body Sem_Util is
 
    begin
       return Trace_Components (Type_Id, False);
-   end Private_Component;
+   end Partially_Visible_Subcomponent;
 
    ---------------------------
    -- Primitive_Names_Match --
index fc1845e0b4908d6b96ad28b7d49f32eb63e354c2..9913e94103690f30657f77783996ba4ee6e42772 100644 (file)
@@ -3092,12 +3092,15 @@ package Sem_Util is
    --  with a special name to avoid being overridden (i.e. return true in case
    --  of entities with names "nameP" and "name" or vice versa).
 
-   function Private_Component (Type_Id : Entity_Id) return Entity_Id;
-   --  Returns some private component (if any) of the given Type_Id.
-   --  Used to enforce the rules on visibility of operations on composite
-   --  types, that depend on the full view of the component type. For a
-   --  record type there may be several such components, we just return
-   --  the first one.
+   function Partially_Visible_Subcomponent
+     (Type_Id : Entity_Id) return Entity_Id;
+   --  If there exist any subcomponents of Type_Id whose types are currently
+   --  only partially visible, returns one such subcomponent. Otherwise returns
+   --  Empty. Used to enforce the rules on visibility of operations on
+   --  composite types, that depend on the full view of the subcomponent types.
+   --
+   --  We say that a type is "partially visible" when it has a partial view
+   --  that is currently visible but no full view that is currently visible.
 
    procedure Process_End_Label
      (N   : Node_Id;