From: Piotr Trojanek <[email protected]>
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.
Tested on x86_64-pc-linux-gnu, committed on master.
---
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 2b7296b67e8..3c80d236af8 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)));
--
2.43.0