[multiple changes]

2017-04-25  Hristian Kirtchev  <kirtchev@adacore.com>

	* sem_util.adb (Check_Part_Of_Reference):
	Continue to examine the context if the reference appears within
	an expression function.

2017-04-25  Justin Squirek  <squirek@adacore.com>

	* exp_ch7.adb, exp_ch7.ads Remove Build_Invariant_Procedure_Body
	and Build_Invariant_Procedure_Declaration.
	* exp_util.ads, exp_util.adb Add Build_Invariant_Procedure_Body
	and Build_Invariant_Procedure_Declaration from exp_ch7
	and break-out Is_Untagged_Private_Derivation from
	Build_Invariant_Procedure_Body.
	(Replace_Type_References):
	Append an extra parameter to allow for dispatching replacements
	and add the corrasponding logic.
	(Type_Invariant): Remove
	Replace_Typ_Refs and replace its references with calls to
	Replace_Type_References.
	* sem_ch3.adb, sem_prag.adb: Remove with and use of exp_ch7.

From-SVN: r247152
This commit is contained in:
Arnaud Charlet 2017-04-25 11:06:09 +02:00
parent b043ae0111
commit 51148ddab1
8 changed files with 1481 additions and 1495 deletions

View File

@ -1,3 +1,25 @@
2017-04-25 Hristian Kirtchev <kirtchev@adacore.com>
* sem_util.adb (Check_Part_Of_Reference):
Continue to examine the context if the reference appears within
an expression function.
2017-04-25 Justin Squirek <squirek@adacore.com>
* exp_ch7.adb, exp_ch7.ads Remove Build_Invariant_Procedure_Body
and Build_Invariant_Procedure_Declaration.
* exp_util.ads, exp_util.adb Add Build_Invariant_Procedure_Body
and Build_Invariant_Procedure_Declaration from exp_ch7
and break-out Is_Untagged_Private_Derivation from
Build_Invariant_Procedure_Body.
(Replace_Type_References):
Append an extra parameter to allow for dispatching replacements
and add the corrasponding logic.
(Type_Invariant): Remove
Replace_Typ_Refs and replace its references with calls to
Replace_Type_References.
* sem_ch3.adb, sem_prag.adb: Remove with and use of exp_ch7.
2017-04-25 Bob Duff <duff@adacore.com>
* sem_util.ads, sem_util.adb (Should_Ignore_Pragma): New function

File diff suppressed because it is too large Load Diff

View File

@ -118,21 +118,6 @@ package Exp_Ch7 is
-- finalization master must be analyzed. Insertion_Node is the insertion
-- point before which the master is to be inserted.
procedure Build_Invariant_Procedure_Body
(Typ : Entity_Id;
Partial_Invariant : Boolean := False);
-- Create the body of the procedure which verifies the invariants of type
-- Typ at runtime. Flag Partial_Invariant should be set when Typ denotes a
-- private type, otherwise it is assumed that Typ denotes the full view of
-- a private type.
procedure Build_Invariant_Procedure_Declaration
(Typ : Entity_Id;
Partial_Invariant : Boolean := False);
-- Create the declaration of the procedure which verifies the invariants of
-- type Typ at runtime. Flag Partial_Invariant should be set when building
-- the invariant procedure for a private type.
procedure Build_Late_Proc (Typ : Entity_Id; Nam : Name_Id);
-- Build one controlling procedure when a late body overrides one of the
-- controlling operations.

File diff suppressed because it is too large Load Diff

View File

@ -290,6 +290,21 @@ package Exp_Util is
-- Create the declaration of the procedure which verifies the assertion
-- expression of pragma Default_Initial_Condition at run time.
procedure Build_Invariant_Procedure_Body
(Typ : Entity_Id;
Partial_Invariant : Boolean := False);
-- Create the body of the procedure which verifies the invariants of type
-- Typ at runtime. Flag Partial_Invariant should be set when Typ denotes a
-- private type, otherwise it is assumed that Typ denotes the full view of
-- a private type.
procedure Build_Invariant_Procedure_Declaration
(Typ : Entity_Id;
Partial_Invariant : Boolean := False);
-- Create the declaration of the procedure which verifies the invariants of
-- type Typ at runtime. Flag Partial_Invariant should be set when building
-- the invariant procedure for a private type.
procedure Build_Procedure_Form (N : Node_Id);
-- Create a procedure declaration which emulates the behavior of a function
-- that returns an array type, for C-compatible generation.
@ -805,6 +820,12 @@ package Exp_Util is
-- Returns true if type T is not tagged and is a derived type,
-- or is a private type whose completion is such a type.
function Is_Untagged_Private_Derivation
(Priv_Typ : Entity_Id;
Full_Typ : Entity_Id) return Boolean;
-- Determine whether private type Priv_Typ and its full view Full_Typ
-- represent an untagged derivation from a private parent.
function Is_Volatile_Reference (N : Node_Id) return Boolean;
-- Checks if the node N represents a volatile reference, which can be
-- either a direct reference to a variable treated as volatile, or an
@ -1037,9 +1058,10 @@ package Exp_Util is
-- the internally-generated inherited primitive of Deriv_Typ.
procedure Replace_Type_References
(Expr : Node_Id;
Typ : Entity_Id;
Obj_Id : Entity_Id);
(Expr : Node_Id;
Typ : Entity_Id;
Obj_Id : Entity_Id;
Dispatch : Boolean := False);
-- Substitute all references of the current instance of type Typ with
-- references to formal parameter Obj_Id within expression Expr.

View File

@ -33,7 +33,6 @@ with Einfo; use Einfo;
with Errout; use Errout;
with Eval_Fat; use Eval_Fat;
with Exp_Ch3; use Exp_Ch3;
with Exp_Ch7; use Exp_Ch7;
with Exp_Ch9; use Exp_Ch9;
with Exp_Disp; use Exp_Disp;
with Exp_Dist; use Exp_Dist;

View File

@ -39,7 +39,6 @@ with Debug; use Debug;
with Einfo; use Einfo;
with Elists; use Elists;
with Errout; use Errout;
with Exp_Ch7; use Exp_Ch7;
with Exp_Dist; use Exp_Dist;
with Exp_Util; use Exp_Util;
with Freeze; use Freeze;

View File

@ -1823,8 +1823,20 @@ package body Sem_Util is
N_Subprogram_Declaration)
and then not Comes_From_Source (Par)
then
OK_Use := True;
exit;
-- Continue to examine the context if the reference appears in a
-- subprogram body which was previously an expression function.
if Nkind (Par) = N_Subprogram_Body
and then Was_Expression_Function (Par)
then
null;
-- Otherwise the reference is legal
else
OK_Use := True;
exit;
end if;
-- The reference has been relocated to an inlined body for GNATprove.
-- Assume that the reference is legal as the real check was already