[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.
This commit is contained in:
Piotr Trojanek 2020-05-30 20:02:52 +02:00 committed by Pierre-Marie de Rodat
parent 6193954675
commit 33502a3a8c

View File

@ -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;
-------------------------