Commit 5b42c035 by Arnaud Charlet

[multiple changes]

2016-10-12  Hristian Kirtchev  <kirtchev@adacore.com>

	* einfo.adb Add new usage for Elist29 and Node35.
	(Anonymous_Designated_Type): New routine.
	(Anonymous_Master): Removed.
	(Anonymous_Masters): New routine.
	(Set_Anonymous_Designated_Type): New routine.
	(Set_Anonymous_Master): Removed.
	(Set_Anonymous_Masters): New routine.
	(Write_Field29_Name): Add output for Anonymous_Masters.
	(Write_Field35_Name): Remove the output for Anonymous_Master. Add
	output for Anonymous_Designated_Type.
	* einfo.ads Remove attribute Anonymous_Master along with
	usage in entities. Add attributes Anonymous_Designated_Type
	and Anonymous_Masters along with usage in entities.
	(Anonymous_Designated_Type): New routine along with pragma Inline.
	(Anonymous_Master): Removed along with pragma Inline.
	(Anonymous_Masters): New routine along with pragma Inline.
	(Set_Anonymous_Designated_Type): New routine along with pragma Inline.
	(Set_Anonymous_Master): Removed along with pragma Inline.
	(Set_Anonymous_Masters): New routine along with pragma Inline.
	* exp_ch7.adb (Build_Anonymous_Master): Reuse an anonymous master
	defined in the same unit if it services the same designated
	type, otherwise create a new one.
	(Create_Anonymous_Master): Reimplemented.
	(Current_Anonymous_Master): New routine.
	(In_Subtree): Removed.

2016-10-12  Ed Schonberg  <schonberg@adacore.com>

	* sem_prag.adb (Analyze_Pragma, case Dynamic_Predicate):
	Check properly whether there is an explicit assertion policy
	for predicate checking, even in the presence of a general Ignore
	assertion policy.

2016-10-12  Steve Baird  <baird@adacore.com>

	* sem.adb (Walk_Library_Items): Cope with ignored ghost units.

From-SVN: r241049
parent d89ce432
2016-10-12 Hristian Kirtchev <kirtchev@adacore.com>
* einfo.adb Add new usage for Elist29 and Node35.
(Anonymous_Designated_Type): New routine.
(Anonymous_Master): Removed.
(Anonymous_Masters): New routine.
(Set_Anonymous_Designated_Type): New routine.
(Set_Anonymous_Master): Removed.
(Set_Anonymous_Masters): New routine.
(Write_Field29_Name): Add output for Anonymous_Masters.
(Write_Field35_Name): Remove the output for Anonymous_Master. Add
output for Anonymous_Designated_Type.
* einfo.ads Remove attribute Anonymous_Master along with
usage in entities. Add attributes Anonymous_Designated_Type
and Anonymous_Masters along with usage in entities.
(Anonymous_Designated_Type): New routine along with pragma Inline.
(Anonymous_Master): Removed along with pragma Inline.
(Anonymous_Masters): New routine along with pragma Inline.
(Set_Anonymous_Designated_Type): New routine along with pragma Inline.
(Set_Anonymous_Master): Removed along with pragma Inline.
(Set_Anonymous_Masters): New routine along with pragma Inline.
* exp_ch7.adb (Build_Anonymous_Master): Reuse an anonymous master
defined in the same unit if it services the same designated
type, otherwise create a new one.
(Create_Anonymous_Master): Reimplemented.
(Current_Anonymous_Master): New routine.
(In_Subtree): Removed.
2016-10-12 Ed Schonberg <schonberg@adacore.com>
* sem_prag.adb (Analyze_Pragma, case Dynamic_Predicate):
Check properly whether there is an explicit assertion policy
for predicate checking, even in the presence of a general Ignore
assertion policy.
2016-10-12 Steve Baird <baird@adacore.com>
* sem.adb (Walk_Library_Items): Cope with ignored ghost units.
2016-10-12 Ed Schonberg <schonberg@adacore.com> 2016-10-12 Ed Schonberg <schonberg@adacore.com>
* lib-writ.adb (Write_ALI): Removal of unused file entries from * lib-writ.adb (Write_ALI): Removal of unused file entries from
......
...@@ -244,6 +244,7 @@ package body Einfo is ...@@ -244,6 +244,7 @@ package body Einfo is
-- Relative_Deadline_Variable Node28 -- Relative_Deadline_Variable Node28
-- Underlying_Record_View Node28 -- Underlying_Record_View Node28
-- Anonymous_Masters Elist29
-- BIP_Initialization_Call Node29 -- BIP_Initialization_Call Node29
-- Subprograms_For_Type Elist29 -- Subprograms_For_Type Elist29
...@@ -265,7 +266,7 @@ package body Einfo is ...@@ -265,7 +266,7 @@ package body Einfo is
-- Contract Node34 -- Contract Node34
-- Anonymous_Master Node35 -- Anonymous_Designated_Type Node35
-- Import_Pragma Node35 -- Import_Pragma Node35
-- Class_Wide_Preconds List38 -- Class_Wide_Preconds List38
...@@ -766,11 +767,20 @@ package body Einfo is ...@@ -766,11 +767,20 @@ package body Einfo is
return Uint14 (Id); return Uint14 (Id);
end Alignment; end Alignment;
function Anonymous_Master (Id : E) return E is function Anonymous_Designated_Type (Id : E) return E is
begin begin
pragma Assert (Is_Type (Id)); pragma Assert (Ekind (Id) = E_Variable);
return Node35 (Id); return Node35 (Id);
end Anonymous_Master; end Anonymous_Designated_Type;
function Anonymous_Masters (Id : E) return L is
begin
pragma Assert (Ekind_In (Id, E_Function,
E_Package,
E_Procedure,
E_Subprogram_Body));
return Elist29 (Id);
end Anonymous_Masters;
function Anonymous_Object (Id : E) return E is function Anonymous_Object (Id : E) return E is
begin begin
...@@ -3726,11 +3736,20 @@ package body Einfo is ...@@ -3726,11 +3736,20 @@ package body Einfo is
Set_Elist16 (Id, V); Set_Elist16 (Id, V);
end Set_Access_Disp_Table; end Set_Access_Disp_Table;
procedure Set_Anonymous_Master (Id : E; V : E) is procedure Set_Anonymous_Designated_Type (Id : E; V : E) is
begin begin
pragma Assert (Is_Type (Id)); pragma Assert (Ekind (Id) = E_Variable);
Set_Node35 (Id, V); Set_Node35 (Id, V);
end Set_Anonymous_Master; end Set_Anonymous_Designated_Type;
procedure Set_Anonymous_Masters (Id : E; V : L) is
begin
pragma Assert (Ekind_In (Id, E_Function,
E_Package,
E_Procedure,
E_Subprogram_Body));
Set_Elist29 (Id, V);
end Set_Anonymous_Masters;
procedure Set_Anonymous_Object (Id : E; V : E) is procedure Set_Anonymous_Object (Id : E; V : E) is
begin begin
...@@ -10503,6 +10522,12 @@ package body Einfo is ...@@ -10503,6 +10522,12 @@ package body Einfo is
procedure Write_Field29_Name (Id : Entity_Id) is procedure Write_Field29_Name (Id : Entity_Id) is
begin begin
case Ekind (Id) is case Ekind (Id) is
when E_Function |
E_Package |
E_Procedure |
E_Subprogram_Body =>
Write_Str ("Anonymous_Masters");
when E_Constant | when E_Constant |
E_Variable => E_Variable =>
Write_Str ("BIP_Initialization_Call"); Write_Str ("BIP_Initialization_Call");
...@@ -10650,8 +10675,8 @@ package body Einfo is ...@@ -10650,8 +10675,8 @@ package body Einfo is
procedure Write_Field35_Name (Id : Entity_Id) is procedure Write_Field35_Name (Id : Entity_Id) is
begin begin
case Ekind (Id) is case Ekind (Id) is
when Type_Kind => when E_Variable =>
Write_Str ("Anonymous_Master"); Write_Str ("Anonymous_Designated_Type");
when Subprogram_Kind => when Subprogram_Kind =>
Write_Str ("Import_Pragma"); Write_Str ("Import_Pragma");
......
...@@ -438,11 +438,15 @@ package Einfo is ...@@ -438,11 +438,15 @@ package Einfo is
-- definition clause with an (obsolescent) mod clause is converted -- definition clause with an (obsolescent) mod clause is converted
-- into an attribute definition clause for this purpose. -- into an attribute definition clause for this purpose.
-- Anonymous_Master (Node35) -- Anonymous_Designated_Type (Node35)
-- Defined in all types. Contains the entity of an anonymous finalization -- Defined in variables which represent anonymous finalization masters.
-- master which services all anonymous access types associated with the -- Contains the designated type which is being services by the master.
-- same designated type within the current semantic unit. The attribute
-- is set reactively during the expansion of allocators. -- Anonymous_Masters (Elist29)
-- Defined in packages, subprograms, and subprogram bodies. Contains a
-- list of anonymous finalization masters declared within the related
-- unit. The list acts as a mapping between a master and a designated
-- type.
-- Anonymous_Object (Node30) -- Anonymous_Object (Node30)
-- Present in protected and task type entities. Contains the entity of -- Present in protected and task type entities. Contains the entity of
...@@ -5530,7 +5534,6 @@ package Einfo is ...@@ -5530,7 +5534,6 @@ package Einfo is
-- Derived_Type_Link (Node31) -- Derived_Type_Link (Node31)
-- No_Tagged_Streams_Pragma (Node32) -- No_Tagged_Streams_Pragma (Node32)
-- Linker_Section_Pragma (Node33) -- Linker_Section_Pragma (Node33)
-- Anonymous_Master (Node35)
-- Depends_On_Private (Flag14) -- Depends_On_Private (Flag14)
-- Disable_Controlled (Flag253) -- Disable_Controlled (Flag253)
...@@ -5982,6 +5985,7 @@ package Einfo is ...@@ -5982,6 +5985,7 @@ package Einfo is
-- Overridden_Operation (Node26) -- Overridden_Operation (Node26)
-- Wrapped_Entity (Node27) (non-generic case only) -- Wrapped_Entity (Node27) (non-generic case only)
-- Extra_Formals (Node28) -- Extra_Formals (Node28)
-- Anonymous_Masters (Elist29) (non-generic case only)
-- Corresponding_Equality (Node30) (implicit /= only) -- Corresponding_Equality (Node30) (implicit /= only)
-- Thunk_Entity (Node31) (thunk case only) -- Thunk_Entity (Node31) (thunk case only)
-- Corresponding_Procedure (Node32) (generate C code only) -- Corresponding_Procedure (Node32) (generate C code only)
...@@ -6207,6 +6211,7 @@ package Einfo is ...@@ -6207,6 +6211,7 @@ package Einfo is
-- Package_Instantiation (Node26) -- Package_Instantiation (Node26)
-- Current_Use_Clause (Node27) -- Current_Use_Clause (Node27)
-- Finalizer (Node28) (non-generic case only) -- Finalizer (Node28) (non-generic case only)
-- Anonymous_Masters (Elist29) (non-generic case only)
-- Contract (Node34) -- Contract (Node34)
-- SPARK_Pragma (Node40) -- SPARK_Pragma (Node40)
-- SPARK_Aux_Pragma (Node41) -- SPARK_Aux_Pragma (Node41)
...@@ -6292,6 +6297,7 @@ package Einfo is ...@@ -6292,6 +6297,7 @@ package Einfo is
-- Overridden_Operation (Node26) (never for init proc) -- Overridden_Operation (Node26) (never for init proc)
-- Wrapped_Entity (Node27) (non-generic case only) -- Wrapped_Entity (Node27) (non-generic case only)
-- Extra_Formals (Node28) -- Extra_Formals (Node28)
-- Anonymous_Masters (Elist29) (non-generic case only)
-- Static_Initialization (Node30) (init_proc only) -- Static_Initialization (Node30) (init_proc only)
-- Thunk_Entity (Node31) (thunk case only) -- Thunk_Entity (Node31) (thunk case only)
-- Corresponding_Function (Node32) (generate C code only) -- Corresponding_Function (Node32) (generate C code only)
...@@ -6483,6 +6489,7 @@ package Einfo is ...@@ -6483,6 +6489,7 @@ package Einfo is
-- Last_Entity (Node20) -- Last_Entity (Node20)
-- Scope_Depth_Value (Uint22) -- Scope_Depth_Value (Uint22)
-- Extra_Formals (Node28) -- Extra_Formals (Node28)
-- Anonymous_Masters (Elist29)
-- Contract (Node34) -- Contract (Node34)
-- SPARK_Pragma (Node40) -- SPARK_Pragma (Node40)
-- Contains_Ignored_Ghost_Code (Flag279) -- Contains_Ignored_Ghost_Code (Flag279)
...@@ -6564,6 +6571,7 @@ package Einfo is ...@@ -6564,6 +6571,7 @@ package Einfo is
-- Encapsulating_State (Node32) -- Encapsulating_State (Node32)
-- Linker_Section_Pragma (Node33) -- Linker_Section_Pragma (Node33)
-- Contract (Node34) -- Contract (Node34)
-- Anonymous_Designated_Type (Node35)
-- SPARK_Pragma (Node40) -- SPARK_Pragma (Node40)
-- Has_Alignment_Clause (Flag46) -- Has_Alignment_Clause (Flag46)
-- Has_Atomic_Components (Flag86) -- Has_Atomic_Components (Flag86)
...@@ -6837,7 +6845,8 @@ package Einfo is ...@@ -6837,7 +6845,8 @@ package Einfo is
function Address_Taken (Id : E) return B; function Address_Taken (Id : E) return B;
function Alias (Id : E) return E; function Alias (Id : E) return E;
function Alignment (Id : E) return U; function Alignment (Id : E) return U;
function Anonymous_Master (Id : E) return E; function Anonymous_Designated_Type (Id : E) return E;
function Anonymous_Masters (Id : E) return L;
function Anonymous_Object (Id : E) return E; function Anonymous_Object (Id : E) return E;
function Associated_Entity (Id : E) return E; function Associated_Entity (Id : E) return E;
function Associated_Formal_Package (Id : E) return E; function Associated_Formal_Package (Id : E) return E;
...@@ -7516,7 +7525,8 @@ package Einfo is ...@@ -7516,7 +7525,8 @@ package Einfo is
procedure Set_Address_Taken (Id : E; V : B := True); procedure Set_Address_Taken (Id : E; V : B := True);
procedure Set_Alias (Id : E; V : E); procedure Set_Alias (Id : E; V : E);
procedure Set_Alignment (Id : E; V : U); procedure Set_Alignment (Id : E; V : U);
procedure Set_Anonymous_Master (Id : E; V : E); procedure Set_Anonymous_Designated_Type (Id : E; V : E);
procedure Set_Anonymous_Masters (Id : E; V : L);
procedure Set_Anonymous_Object (Id : E; V : E); procedure Set_Anonymous_Object (Id : E; V : E);
procedure Set_Associated_Entity (Id : E; V : E); procedure Set_Associated_Entity (Id : E; V : E);
procedure Set_Associated_Formal_Package (Id : E; V : E); procedure Set_Associated_Formal_Package (Id : E; V : E);
...@@ -8314,7 +8324,8 @@ package Einfo is ...@@ -8314,7 +8324,8 @@ package Einfo is
pragma Inline (Address_Taken); pragma Inline (Address_Taken);
pragma Inline (Alias); pragma Inline (Alias);
pragma Inline (Alignment); pragma Inline (Alignment);
pragma Inline (Anonymous_Master); pragma Inline (Anonymous_Designated_Type);
pragma Inline (Anonymous_Masters);
pragma Inline (Anonymous_Object); pragma Inline (Anonymous_Object);
pragma Inline (Associated_Entity); pragma Inline (Associated_Entity);
pragma Inline (Associated_Formal_Package); pragma Inline (Associated_Formal_Package);
...@@ -8832,7 +8843,8 @@ package Einfo is ...@@ -8832,7 +8843,8 @@ package Einfo is
pragma Inline (Set_Address_Taken); pragma Inline (Set_Address_Taken);
pragma Inline (Set_Alias); pragma Inline (Set_Alias);
pragma Inline (Set_Alignment); pragma Inline (Set_Alignment);
pragma Inline (Set_Anonymous_Master); pragma Inline (Set_Anonymous_Designated_Type);
pragma Inline (Set_Anonymous_Masters);
pragma Inline (Set_Anonymous_Object); pragma Inline (Set_Anonymous_Object);
pragma Inline (Set_Associated_Entity); pragma Inline (Set_Associated_Entity);
pragma Inline (Set_Associated_Formal_Package); pragma Inline (Set_Associated_Formal_Package);
......
...@@ -541,14 +541,16 @@ package body Exp_Ch7 is ...@@ -541,14 +541,16 @@ package body Exp_Ch7 is
(Desig_Typ : Entity_Id; (Desig_Typ : Entity_Id;
Unit_Id : Entity_Id; Unit_Id : Entity_Id;
Unit_Decl : Node_Id) return Entity_Id; Unit_Decl : Node_Id) return Entity_Id;
-- Create a new anonymous finalization master for access type Ptr_Typ -- Create a new anonymous master for access type Ptr_Typ with designated
-- with designated type Desig_Typ. The declaration of the master along -- type Desig_Typ. The declaration of the master and its initialization
-- with its specialized initialization is inserted in the declarative -- are inserted in the declarative part of unit Unit_Decl. Unit_Id is
-- part of unit Unit_Decl. Unit_Id denotes the entity of Unit_Decl. -- the entity of Unit_Decl.
function In_Subtree (N : Node_Id; Root : Node_Id) return Boolean; function Current_Anonymous_Master
-- Determine whether arbitrary node N appears within the subtree rooted (Desig_Typ : Entity_Id;
-- at node Root. Unit_Id : Entity_Id) return Entity_Id;
-- Find an anonymous master declared within unit Unit_Id which services
-- designated type Desig_Typ. If there is no such master, return Empty.
----------------------------- -----------------------------
-- Create_Anonymous_Master -- -- Create_Anonymous_Master --
...@@ -560,15 +562,41 @@ package body Exp_Ch7 is ...@@ -560,15 +562,41 @@ package body Exp_Ch7 is
Unit_Decl : Node_Id) return Entity_Id Unit_Decl : Node_Id) return Entity_Id
is is
Loc : constant Source_Ptr := Sloc (Unit_Id); Loc : constant Source_Ptr := Sloc (Unit_Id);
Spec_Id : constant Entity_Id := Unique_Defining_Entity (Unit_Decl);
All_FMs : Elist_Id;
Decls : List_Id; Decls : List_Id;
FM_Decl : Node_Id; FM_Decl : Node_Id;
FM_Id : Entity_Id; FM_Id : Entity_Id;
FM_Init : Node_Id; FM_Init : Node_Id;
Pref : Character;
Unit_Spec : Node_Id; Unit_Spec : Node_Id;
begin begin
-- Generate:
-- <FM_Id> : Finalization_Master;
FM_Id := Make_Temporary (Loc, 'A');
FM_Decl :=
Make_Object_Declaration (Loc,
Defining_Identifier => FM_Id,
Object_Definition =>
New_Occurrence_Of (RTE (RE_Finalization_Master), Loc));
-- Generate:
-- Set_Base_Pool
-- (<FM_Id>, Global_Pool_Object'Unrestricted_Access);
FM_Init :=
Make_Procedure_Call_Statement (Loc,
Name =>
New_Occurrence_Of (RTE (RE_Set_Base_Pool), Loc),
Parameter_Associations => New_List (
New_Occurrence_Of (FM_Id, Loc),
Make_Attribute_Reference (Loc,
Prefix =>
New_Occurrence_Of (RTE (RE_Global_Pool_Object), Loc),
Attribute_Name => Name_Unrestricted_Access)));
-- Find the declarative list of the unit -- Find the declarative list of the unit
if Nkind (Unit_Decl) = N_Package_Declaration then if Nkind (Unit_Decl) = N_Package_Declaration then
...@@ -588,8 +616,8 @@ package body Exp_Ch7 is ...@@ -588,8 +616,8 @@ package body Exp_Ch7 is
-- procedure Comp_Unit_Proc (Param : access Ctrl := new Ctrl); -- procedure Comp_Unit_Proc (Param : access Ctrl := new Ctrl);
-- There is no suitable place to create the anonymous master as the -- There is no suitable place to create the master as the subprogram
-- subprogram is not in a declarative list. -- is not in a declarative list.
else else
Decls := Declarations (Unit_Decl); Decls := Declarations (Unit_Decl);
...@@ -600,100 +628,74 @@ package body Exp_Ch7 is ...@@ -600,100 +628,74 @@ package body Exp_Ch7 is
end if; end if;
end if; end if;
-- Step 1: Anonymous master creation Prepend_To (Decls, FM_Init);
Prepend_To (Decls, FM_Decl);
-- Use a unique prefix in case the same unit requires two anonymous
-- masters, one for the spec (S) and one for the body (B).
if Ekind_In (Unit_Id, E_Function, E_Package, E_Procedure) then
Pref := 'S';
else
Pref := 'B';
end if;
-- The name of the anonymous master has the following format:
-- [BS]scopN__scop1__chars_of_desig_typAM
-- The name utilizes the fully qualified name of the designated type
-- in case two controlled types with the same name are declared in
-- different scopes and both have anonymous access types.
FM_Id :=
Make_Defining_Identifier (Loc,
New_External_Name
(Related_Id => Get_Qualified_Name (Desig_Typ),
Suffix => "AM",
Prefix => Pref));
-- Associate the anonymous master with the designated type. This
-- ensures that any additional anonymous access types with the same
-- designated type will share the same anonymous master within the
-- same unit.
Set_Anonymous_Master (Desig_Typ, FM_Id);
-- Generate: -- Use the scope of the unit when analyzing the declaration of the
-- <FM_Id> : Finalization_Master; -- master and its initialization actions.
FM_Decl := Push_Scope (Unit_Id);
Make_Object_Declaration (Loc, Analyze (FM_Decl);
Defining_Identifier => FM_Id, Analyze (FM_Init);
Object_Definition => Pop_Scope;
New_Occurrence_Of (RTE (RE_Finalization_Master), Loc));
-- Step 2: Initialization actions -- Mark the master as servicing this specific designated type
-- Generate: Set_Anonymous_Designated_Type (FM_Id, Desig_Typ);
-- Set_Base_Pool
-- (<FM_Id>, Global_Pool_Object'Unrestricted_Access);
FM_Init := -- Include the anonymous master in the list of existing masters which
Make_Procedure_Call_Statement (Loc, -- appear in this unit. This effectively creates a mapping between a
Name => -- master and a designated type which in turn allows for the reusal
New_Occurrence_Of (RTE (RE_Set_Base_Pool), Loc), -- of masters on a per-unit basis.
Parameter_Associations => New_List (
New_Occurrence_Of (FM_Id, Loc),
Make_Attribute_Reference (Loc,
Prefix =>
New_Occurrence_Of (RTE (RE_Global_Pool_Object), Loc),
Attribute_Name => Name_Unrestricted_Access)));
Prepend_To (Decls, FM_Init); All_FMs := Anonymous_Masters (Unit_Id);
Prepend_To (Decls, FM_Decl);
-- Since the anonymous master and all its initialization actions are if No (All_FMs) then
-- inserted at top level, use the scope of the unit when analyzing. All_FMs := New_Elmt_List;
Set_Anonymous_Masters (Unit_Id, All_FMs);
end if;
Push_Scope (Spec_Id); Prepend_Elmt (FM_Id, All_FMs);
Analyze (FM_Decl);
Analyze (FM_Init);
Pop_Scope;
return FM_Id; return FM_Id;
end Create_Anonymous_Master; end Create_Anonymous_Master;
---------------- ------------------------------
-- In_Subtree -- -- Current_Anonymous_Master --
---------------- ------------------------------
function In_Subtree (N : Node_Id; Root : Node_Id) return Boolean is function Current_Anonymous_Master
Par : Node_Id; (Desig_Typ : Entity_Id;
Unit_Id : Entity_Id) return Entity_Id
is
All_FMs : constant Elist_Id := Anonymous_Masters (Unit_Id);
FM_Elmt : Elmt_Id;
FM_Id : Entity_Id;
begin begin
-- Traverse the parent chain until reaching the same root -- Inspect the list of anonymous masters declared within the unit
-- looking for an existing master which services the same designated
-- type.
Par := N; if Present (All_FMs) then
while Present (Par) loop FM_Elmt := First_Elmt (All_FMs);
if Par = Root then while Present (FM_Elmt) loop
return True; FM_Id := Node (FM_Elmt);
-- The currect master services the same designated type. As a
-- result the master can be reused and associated with another
-- anonymous access-to-controlled type.
if Anonymous_Designated_Type (FM_Id) = Desig_Typ then
return FM_Id;
end if; end if;
Par := Parent (Par); Next_Elmt (FM_Elmt);
end loop; end loop;
end if;
return False; return Empty;
end In_Subtree; end Current_Anonymous_Master;
-- Local variables -- Local variables
...@@ -714,7 +716,7 @@ package body Exp_Ch7 is ...@@ -714,7 +716,7 @@ package body Exp_Ch7 is
end if; end if;
Unit_Decl := Unit (Cunit (Current_Sem_Unit)); Unit_Decl := Unit (Cunit (Current_Sem_Unit));
Unit_Id := Defining_Entity (Unit_Decl); Unit_Id := Unique_Defining_Entity (Unit_Decl);
-- The compilation unit is a package instantiation. In this case the -- The compilation unit is a package instantiation. In this case the
-- anonymous master is associated with the package spec as both the -- anonymous master is associated with the package spec as both the
...@@ -738,21 +740,14 @@ package body Exp_Ch7 is ...@@ -738,21 +740,14 @@ package body Exp_Ch7 is
Desig_Typ := Priv_View; Desig_Typ := Priv_View;
end if; end if;
FM_Id := Anonymous_Master (Desig_Typ); -- Determine whether the current semantic unit already has an anonymous
-- master which services the designated type.
-- The designated type already has at least one anonymous access type FM_Id := Current_Anonymous_Master (Desig_Typ, Unit_Id);
-- pointing to it within the current unit. Reuse the anonymous master
-- because the designated type is the same.
if Present (FM_Id) -- If this is not the case, create a new master
and then In_Subtree (Declaration_Node (FM_Id), Root => Unit_Decl)
then
null;
-- Otherwise the designated type lacks an anonymous master or it is if No (FM_Id) then
-- declared in a different unit. Create a brand new master.
else
FM_Id := Create_Anonymous_Master (Desig_Typ, Unit_Id, Unit_Decl); FM_Id := Create_Anonymous_Master (Desig_Typ, Unit_Id, Unit_Decl);
end if; end if;
......
...@@ -1767,6 +1767,11 @@ package body Sem is ...@@ -1767,6 +1767,11 @@ package body Sem is
pragma Assert (False, "subunit"); pragma Assert (False, "subunit");
null; null;
when N_Null_Statement =>
pragma Assert (Is_Ignored_Ghost_Node (Original_Node (Item)));
-- Do not call Action for an ignored ghost unit
return;
when others => when others =>
pragma Assert (False); pragma Assert (False);
null; null;
...@@ -2095,6 +2100,11 @@ package body Sem is ...@@ -2095,6 +2100,11 @@ package body Sem is
-- happen when the body of a parent depends on some other -- happen when the body of a parent depends on some other
-- descendant. -- descendant.
when N_Null_Statement =>
-- Ignore an ignored ghost unit
pragma Assert (Is_Ignored_Ghost_Node (Original_Node (N)));
null;
when others => when others =>
Par := Scope (Defining_Entity (Unit (CU))); Par := Scope (Defining_Entity (Unit (CU)));
......
...@@ -19136,15 +19136,17 @@ package body Sem_Prag is ...@@ -19136,15 +19136,17 @@ package body Sem_Prag is
-- the rep item chain, for processing when the type is frozen. -- the rep item chain, for processing when the type is frozen.
-- This is accomplished by a call to Rep_Item_Too_Late. We also -- This is accomplished by a call to Rep_Item_Too_Late. We also
-- mark the type as having predicates. -- mark the type as having predicates.
-- If the current policy is Ignore mark the subtype accordingly.
-- In the case of predicates we consider them enabled unless an -- If the current policy for predicate checking is Ignore mark the
-- Ignore is specified, to preserve existing warnings. -- subtype accordingly. In the case of predicates we consider them
-- enabled unless Ignore is specified (either directly or with a
-- general Assertion_Policy pragma) to preserve existing warnings.
Set_Has_Predicates (Typ); Set_Has_Predicates (Typ);
Set_Predicates_Ignored (Typ, Set_Predicates_Ignored (Typ,
Present (Check_Policy_List) Present (Check_Policy_List)
and then and then
Policy_In_Effect (Name_Assertion_Policy) = Name_Ignore); Policy_In_Effect (Name_Dynamic_Predicate) = Name_Ignore);
Discard := Rep_Item_Too_Late (Typ, N, FOnly => True); Discard := Rep_Item_Too_Late (Typ, N, FOnly => True);
end Predicate; end Predicate;
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