summaryrefslogtreecommitdiff
path: root/gcc/ada/sem_ch6.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2007-09-26 10:42:49 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2007-09-26 10:42:49 +0000
commitfdd18a7c94f4cbb499dafb7a1a1467fe861d55d9 (patch)
treecfeb29e644e078a2c07b74278a02a9f14cd72b12 /gcc/ada/sem_ch6.adb
parent83f8f0a61fc2a3e1251c1e13591445e84f6492a7 (diff)
downloadgcc-fdd18a7c94f4cbb499dafb7a1a1467fe861d55d9.tar.gz
2007-09-26 Javier Miranda <miranda@adacore.com>
Gary Dismukes <dismukes@adacore.com> * einfo.adb (Is_Thunk): New attribute applicable to subprograms. True for thunks associated with interface types. * einfo.ads: Improve documentatation of Is_Internal (Is_Thunk): New attribute applicable to subprograms. True for thunks associated with interface types. Extensive comment fixes regarding flags that appear in all entities. The documentation is now consistent for all such flags (there were a number of errors in the documentation in this regard). * exp_attr.adb (Expand_N_Attribute_Reference): Minor code cleanup. * exp_ch6.adb (Make_Build_In_Place_Call_*): Return immediately if any of these procedures are passed a function call that already has build-in-place actuals (testing new flag Is_Expanded_Build_In_Place_Call). Set the flag on the function call in the case where processing continues. (Expand_Call): If the call is generated from a thunk body then we propagate the extra actuals associated with the accessibility level of the access type actuals. * sem_ch6.adb (Analyze_Subprogram_Body): Set the Protected_Formal field of each extra formal of a protected operation to reference the corresponding extra formal of the subprogram denoted by the operation's Protected_Body_Subprogram. * sinfo.ads, sinfo.adb (Is_Expanded_Build_In_Place_Call): New flag on N_Function_Call nodes. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@128786 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/sem_ch6.adb')
-rw-r--r--gcc/ada/sem_ch6.adb31
1 files changed, 31 insertions, 0 deletions
diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb
index 8d233188abb..2cb621bfc91 100644
--- a/gcc/ada/sem_ch6.adb
+++ b/gcc/ada/sem_ch6.adb
@@ -1961,6 +1961,37 @@ package body Sem_Ch6 is
Check_Anonymous_Return;
+ -- Set the Protected_Formal field of each extra formal of the protected
+ -- subprogram to reference the corresponding extra formal of the
+ -- subprogram that implements it. For regular formals this occurs when
+ -- the protected subprogram's declaration is expanded, but the extra
+ -- formals don't get created until the subprogram is frozen. We need to
+ -- do this before analyzing the protected subprogram's body so that any
+ -- references to the original subprogram's extra formals will be changed
+ -- refer to the implementing subprogram's formals (see Expand_Formal).
+
+ if Present (Spec_Id)
+ and then Is_Protected_Type (Scope (Spec_Id))
+ and then Present (Protected_Body_Subprogram (Spec_Id))
+ then
+ declare
+ Impl_Subp : constant Entity_Id :=
+ Protected_Body_Subprogram (Spec_Id);
+ Prot_Ext_Formal : Entity_Id := Extra_Formals (Spec_Id);
+ Impl_Ext_Formal : Entity_Id := Extra_Formals (Impl_Subp);
+
+ begin
+ while Present (Prot_Ext_Formal) loop
+ pragma Assert (Present (Impl_Ext_Formal));
+
+ Set_Protected_Formal (Prot_Ext_Formal, Impl_Ext_Formal);
+
+ Next_Formal_With_Extras (Prot_Ext_Formal);
+ Next_Formal_With_Extras (Impl_Ext_Formal);
+ end loop;
+ end;
+ end if;
+
-- Now we can go on to analyze the body
HSS := Handled_Statement_Sequence (N);