aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPiotr Trojanek <trojanek@adacore.com>2024-12-05 17:12:55 +0100
committerMarc Poulhiès <dkm@gcc.gnu.org>2025-01-03 16:39:14 +0100
commitc20458a12d21a93f4ad5596f64545d6142a7d2dc (patch)
tree7355226ad4d5f80e75002f99406f472337c6b334
parentd9a51b704fe521fecb2e77931226c8e8798a9910 (diff)
downloadgcc-c20458a12d21a93f4ad5596f64545d6142a7d2dc.zip
gcc-c20458a12d21a93f4ad5596f64545d6142a7d2dc.tar.gz
gcc-c20458a12d21a93f4ad5596f64545d6142a7d2dc.tar.bz2
ada: Simplify code for obtaining function entity from a function call
Code cleanup; behavior is unaffected. gcc/ada/ChangeLog: * sem_ch5.adb (Check_Call): Reuse Get_Called_Entity.
-rw-r--r--gcc/ada/sem_ch5.adb24
1 files changed, 2 insertions, 22 deletions
diff --git a/gcc/ada/sem_ch5.adb b/gcc/ada/sem_ch5.adb
index 2a5c8dc..944259a 100644
--- a/gcc/ada/sem_ch5.adb
+++ b/gcc/ada/sem_ch5.adb
@@ -4536,34 +4536,14 @@ package body Sem_Ch5 is
----------------
function Check_Call (N : Node_Id) return Traverse_Result is
- Nam : Node_Id;
Subp : Entity_Id;
- Typ : Entity_Id;
begin
if Nkind (N) = N_Function_Call then
- Nam := Name (N);
-
- -- Obtain the subprogram being invoked
-
- loop
- if Nkind (Nam) = N_Explicit_Dereference then
- Nam := Prefix (Nam);
-
- elsif Nkind (Nam) = N_Selected_Component then
- Nam := Selector_Name (Nam);
-
- else
- exit;
- end if;
- end loop;
-
- Subp := Entity (Nam);
+ Subp := Get_Called_Entity (N);
if Present (Subp) then
- Typ := Etype (Subp);
-
- if Requires_Transient_Scope (Typ) then
+ if Requires_Transient_Scope (Etype (Subp)) then
return Abandon;
elsif Sec_Stack_Needed_For_Return (Subp) then