https://gcc.gnu.org/g:8d2b60e5d85584648675be0383fa6edbdb322659
commit r17-1167-g8d2b60e5d85584648675be0383fa6edbdb322659 Author: Ronan Desplanques <[email protected]> Date: Mon Mar 30 12:36:02 2026 +0200 ada: Rename Private_Component function 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. Diff: --- gcc/ada/sem_ch3.adb | 4 ++-- gcc/ada/sem_ch7.adb | 2 +- gcc/ada/sem_util.adb | 12 +++++++----- gcc/ada/sem_util.ads | 15 +++++++++------ 4 files changed, 19 insertions(+), 14 deletions(-) diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index 612cf712fd58..7e28881aeb0b 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -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 diff --git a/gcc/ada/sem_ch7.adb b/gcc/ada/sem_ch7.adb index 1f2fe1622ef4..90de70d2568f 100644 --- a/gcc/ada/sem_ch7.adb +++ b/gcc/ada/sem_ch7.adb @@ -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); diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index 863fd4d87b2a..9348bf87d7fa 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -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 -- diff --git a/gcc/ada/sem_util.ads b/gcc/ada/sem_util.ads index fc1845e0b490..9913e9410369 100644 --- a/gcc/ada/sem_util.ads +++ b/gcc/ada/sem_util.ads @@ -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;
