https://gcc.gnu.org/g:0ab32e590fa97e7dc54e171f1a7b5f9b7069c309
commit r16-1329-g0ab32e590fa97e7dc54e171f1a7b5f9b7069c309 Author: Piotr Trojanek <troja...@adacore.com> Date: Fri Mar 7 12:08:44 2025 +0100 ada: Simplify handling of selected components as name references The selector_name of a selected_component always points to an identifier than is an object name, i.e. specifically, name of a component or discriminant. There is no need to examine this. Code cleanup; behavior is unaffected. gcc/ada/ChangeLog: * sem_util.adb (Is_Name_Reference): Remove check for selector_name of a selected_component; reuse existing code for indexed components and slices. (Statically_Names_Object): Remove dead code. Diff: --- gcc/ada/sem_util.adb | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index 2b7296b67e8c..3c80d236af81 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -18375,6 +18375,7 @@ package body Sem_Util is case Nkind (N) is when N_Indexed_Component + | N_Selected_Component | N_Slice => return @@ -18386,13 +18387,6 @@ package body Sem_Util is when N_Attribute_Reference => return Attribute_Name (N) in Name_Input | Name_Old | Name_Result; - when N_Selected_Component => - return - Is_Name_Reference (Selector_Name (N)) - and then - (Is_Name_Reference (Prefix (N)) - or else Is_Access_Type (Etype (Prefix (N)))); - when N_Explicit_Dereference => return True; @@ -28517,12 +28511,6 @@ package body Sem_Util is return False; end if; - if Ekind (Entity (Selector_Name (N))) not in - E_Component | E_Discriminant - then - return False; - end if; - declare Comp : constant Entity_Id := Original_Record_Component (Entity (Selector_Name (N)));