diff options
author | Piotr Trojanek <trojanek@adacore.com> | 2020-05-30 20:02:52 +0200 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2020-07-10 05:16:23 -0400 |
commit | 33502a3a8ce760840d3e71dfe0dab9910514327e (patch) | |
tree | 1bfe298fd7d0ff4ab0f120f46ab9df0bac2d7f92 /gcc | |
parent | 619395467573f4cc869e441d99b112f5c1df9bbe (diff) | |
download | gcc-33502a3a8ce760840d3e71dfe0dab9910514327e.zip gcc-33502a3a8ce760840d3e71dfe0dab9910514327e.tar.gz gcc-33502a3a8ce760840d3e71dfe0dab9910514327e.tar.bz2 |
[Ada] Fix detection of actual parameters for procedure calls
gcc/ada/
* sem_ch8.adb (Is_Actual_Parameter): Fix processing when parent
is a procedure call statement; extend comment.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/sem_ch8.adb | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb index bc52eb0..08414b2 100644 --- a/gcc/ada/sem_ch8.adb +++ b/gcc/ada/sem_ch8.adb @@ -5020,7 +5020,12 @@ package body Sem_Ch8 is -- not know what procedure is being called if the procedure might be -- overloaded, so it is premature to go setting referenced flags or -- making calls to Generate_Reference. We will wait till Resolve_Actuals - -- for that processing + -- for that processing. + -- Note: there is a similar routine Sem_Util.Is_Actual_Parameter, but + -- it works for both function and procedure calls, while here we are + -- only concerned with procedure calls (and with entry calls as well, + -- but they are parsed as procedure calls and only later rewritten to + -- entry calls). function Known_But_Invisible (E : Entity_Id) return Boolean; -- This function determines whether a reference to the entity E, which @@ -5141,15 +5146,24 @@ package body Sem_Ch8 is function Is_Actual_Parameter return Boolean is begin - return - Nkind (N) = N_Identifier - and then - (Nkind (Parent (N)) = N_Procedure_Call_Statement - or else - (Nkind (Parent (N)) = N_Parameter_Association - and then N = Explicit_Actual_Parameter (Parent (N)) - and then Nkind (Parent (Parent (N))) = - N_Procedure_Call_Statement)); + if Nkind (N) = N_Identifier then + case Nkind (Parent (N)) is + when N_Procedure_Call_Statement => + return Is_List_Member (N) + and then List_Containing (N) = + Parameter_Associations (Parent (N)); + + when N_Parameter_Association => + return N = Explicit_Actual_Parameter (Parent (N)) + and then Nkind (Parent (Parent (N))) = + N_Procedure_Call_Statement; + + when others => + return False; + end case; + else + return False; + end if; end Is_Actual_Parameter; ------------------------- |