Commit e5f2c03c by Arnaud Charlet

[multiple changes]

2015-10-20  Ed Schonberg  <schonberg@adacore.com>

	* sem_prag.adb: Code clean up.

2015-10-20  Hristian Kirtchev  <kirtchev@adacore.com>

	* exp_ch6.adb (Expand_N_Extended_Return_Statement): Code cleanup.
	(Make_Build_In_Place_Call_In_Object_Declaration): Update the
	parameter profile.  Code cleanup. Request debug info for the
	object renaming declaration.
	(Move_Activation_Chain): Add new formal parameter and update the
	comment on usage.
	* exp_ch6.ads (Make_Build_In_Place_Call_In_Object_Declaration):
	Update the parameter profile and comment on usage.
	* sem_util.ads, sem_util.adb (Remove_Overloaded_Entity): New routine,
	currently unused.

From-SVN: r229067
parent 58ef3d30
2015-10-20 Ed Schonberg <schonberg@adacore.com>
* sem_prag.adb: Code clean up.
2015-10-20 Hristian Kirtchev <kirtchev@adacore.com>
* exp_ch6.adb (Expand_N_Extended_Return_Statement): Code cleanup.
(Make_Build_In_Place_Call_In_Object_Declaration): Update the
parameter profile. Code cleanup. Request debug info for the
object renaming declaration.
(Move_Activation_Chain): Add new formal parameter and update the
comment on usage.
* exp_ch6.ads (Make_Build_In_Place_Call_In_Object_Declaration):
Update the parameter profile and comment on usage.
* sem_util.ads, sem_util.adb (Remove_Overloaded_Entity): New routine,
currently unused.
2015-10-20 Ed Schonberg <schonberg@adacore.com>
* sem_ch13.adb (Analyze_One_Aspect, case
Aspect_Disable_Controlled): If expander is not active, pre-analyze
expression anyway for ASIS and other tools use.
......
......@@ -178,7 +178,7 @@ package Exp_Ch6 is
-- call.
procedure Make_Build_In_Place_Call_In_Object_Declaration
(Object_Decl : Node_Id;
(Obj_Decl : Node_Id;
Function_Call : Node_Id);
-- Ada 2005 (AI-318-02): Handle a call to a build-in-place function that
-- occurs as the expression initializing an object declaration by
......
......@@ -25211,6 +25211,7 @@ package body Sem_Prag is
Root_Typ := Etype (F);
if Is_Access_Type (Etype (F)) then
Root_Typ := Designated_Type (Root_Typ);
New_Typ :=
Make_Defining_Identifier (Loc,
Chars =>
......
......@@ -16961,6 +16961,106 @@ package body Sem_Util is
end if;
end Remove_Homonym;
------------------------------
-- Remove_Overloaded_Entity --
------------------------------
procedure Remove_Overloaded_Entity (Id : Entity_Id) is
procedure Remove_Primitive_Of (Typ : Entity_Id);
-- Remove primitive subprogram Id from the list of primitives that
-- belong to type Typ.
-------------------------
-- Remove_Primitive_Of --
-------------------------
procedure Remove_Primitive_Of (Typ : Entity_Id) is
Prims : Elist_Id;
begin
if Is_Tagged_Type (Typ) then
Prims := Direct_Primitive_Operations (Typ);
if Present (Prims) then
Remove (Prims, Id);
end if;
end if;
end Remove_Primitive_Of;
-- Local variables
Scop : constant Entity_Id := Scope (Id);
Formal : Entity_Id;
Prev_Id : Entity_Id;
-- Start of processing for Remove_Overloaded_Entity
begin
-- Remove the entity from the homonym chain. When the entity is the
-- head of the chain, associate the entry in the name table with its
-- homonym effectively making it the new head of the chain.
if Current_Entity (Id) = Id then
Set_Name_Entity_Id (Chars (Id), Homonym (Id));
-- Otherwise link the previous and next homonyms
else
Prev_Id := Current_Entity (Id);
while Present (Prev_Id) and then Homonym (Prev_Id) /= Id loop
Prev_Id := Homonym (Prev_Id);
end loop;
Set_Homonym (Prev_Id, Homonym (Id));
end if;
-- Remove the entity from the scope entity chain. When the entity is
-- the head of the chain, set the next entity as the new head of the
-- chain.
if First_Entity (Scop) = Id then
Prev_Id := Empty;
Set_First_Entity (Scop, Next_Entity (Id));
-- Otherwise the entity is either in the middle of the chain or it acts
-- as its tail. Traverse and link the previous and next entities.
else
Prev_Id := First_Entity (Scop);
while Present (Prev_Id) and then Next_Entity (Prev_Id) /= Id loop
Next_Entity (Prev_Id);
end loop;
Set_Next_Entity (Prev_Id, Next_Entity (Id));
end if;
-- Handle the case where the entity acts as the tail of the scope entity
-- chain.
if Last_Entity (Scop) = Id then
Set_Last_Entity (Scop, Prev_Id);
end if;
-- The entity denotes a primitive subprogram. Remove it from the list of
-- primitives of the associated controlling type.
if Ekind_In (Id, E_Function, E_Procedure) and then Is_Primitive (Id) then
Formal := First_Formal (Id);
while Present (Formal) loop
if Is_Controlling_Formal (Formal) then
Remove_Primitive_Of (Etype (Formal));
exit;
end if;
Next_Formal (Formal);
end loop;
if Ekind (Id) = E_Function and then Has_Controlling_Result (Id) then
Remove_Primitive_Of (Etype (Id));
end if;
end if;
end Remove_Overloaded_Entity;
---------------------
-- Rep_To_Pos_Flag --
---------------------
......
......@@ -1781,12 +1781,6 @@ package Sem_Util is
-- convenience, qualified expressions applied to object names are also
-- allowed as actuals for this function.
function Original_Corresponding_Operation (S : Entity_Id) return Entity_Id;
-- [Ada 2012: AI05-0125-1]: If S is an inherited dispatching primitive S2,
-- or overrides an inherited dispatching primitive S2, the original
-- corresponding operation of S is the original corresponding operation of
-- S2. Otherwise, it is S itself.
function Original_Aspect_Pragma_Name (N : Node_Id) return Name_Id;
-- Retrieve the name of aspect or pragma N taking into account a possible
-- rewrite and whether the pragma is generated from an aspect as the names
......@@ -1799,6 +1793,12 @@ package Sem_Util is
-- Type_Invariant -> Name_uType_Invariant
-- Type_Invariant'Class -> Name_uType_Invariant
function Original_Corresponding_Operation (S : Entity_Id) return Entity_Id;
-- [Ada 2012: AI05-0125-1]: If S is an inherited dispatching primitive S2,
-- or overrides an inherited dispatching primitive S2, the original
-- corresponding operation of S is the original corresponding operation of
-- S2. Otherwise, it is S itself.
function Policy_In_Effect (Policy : Name_Id) return Name_Id;
-- Given a policy, return the policy identifier associated with it. If no
-- such policy is in effect, the value returned is No_Name.
......@@ -1845,6 +1845,12 @@ package Sem_Util is
procedure Remove_Homonym (E : Entity_Id);
-- Removes E from the homonym chain
procedure Remove_Overloaded_Entity (Id : Entity_Id);
-- Remove arbitrary entity Id from the homonym chain, the scope chain and
-- the primitive operations list of the associated controlling type. NOTE:
-- the removal performed by this routine does not affect the visibility of
-- existing homonyms.
function Rep_To_Pos_Flag (E : Entity_Id; Loc : Source_Ptr) return Node_Id;
-- This is used to construct the second argument in a call to Rep_To_Pos
-- which is Standard_True if range checks are enabled (E is an entity to
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment