Commit 02bb0765 by Arnaud Charlet

[multiple changes]

2014-07-29  Robert Dewar  <dewar@adacore.com>

	* einfo.adb (Has_Protected): Test base type.
	* sem_ch4.adb (Analyze_Allocator): Reorganize code to make sure
	that we always properly check No_Protected_Type_Allocators.

2014-07-29  Ed Schonberg  <schonberg@adacore.com>

	* sem_util.ads, sem_util.adb (Defining_Entity):	Now applies to
	loop declarations as well.
	* exp_ch5.adb (Expand_Loop_Statement): Apply Qualify_Entity_Names
	to an iterator loop, because it may contain local renaming
	declarations that require debugging information.

2014-07-29  Robert Dewar  <dewar@adacore.com>

	* sem_util.ads, exp_util.adb, sem_attr.adb: Minor reformatting.

From-SVN: r213163
parent fc3a3f3b
2014-07-29 Robert Dewar <dewar@adacore.com>
* einfo.adb (Has_Protected): Test base type.
* sem_ch4.adb (Analyze_Allocator): Reorganize code to make sure
that we always properly check No_Protected_Type_Allocators.
2014-07-29 Ed Schonberg <schonberg@adacore.com>
* sem_util.ads, sem_util.adb (Defining_Entity): Now applies to
loop declarations as well.
* exp_ch5.adb (Expand_Loop_Statement): Apply Qualify_Entity_Names
to an iterator loop, because it may contain local renaming
declarations that require debugging information.
2014-07-29 Robert Dewar <dewar@adacore.com>
* sem_util.ads, exp_util.adb, sem_attr.adb: Minor reformatting.
2014-07-29 Robert Dewar <dewar@adacore.com>
* einfo.ads, einfo.adb (Static_Real_Or_String_Predicate): New function
(Set_Static_Real_Or_String_Predicate): New procedure
* sem_ch13.adb (Build_Predicate_Functions): Accomodate static
......
......@@ -1647,7 +1647,7 @@ package body Einfo is
function Has_Protected (Id : E) return B is
begin
return Flag271 (Id);
return Flag271 (Base_Type (Id));
end Has_Protected;
function Has_Qualified_Name (Id : E) return B is
......
......@@ -3946,6 +3946,19 @@ package body Exp_Ch5 is
and then Present (Iterator_Specification (Scheme))
then
Expand_Iterator_Loop (N);
-- An iterator loop may generate renaming declarations for elements
-- that require debug information. This is the case in particular
-- with element iterators, where debug information must be generated
-- for the temporary that holds the element value. These temporaries
-- are created within a transient block whose local declarations are
-- transferred to the loop, which now has non-trivial local objects.
if Nkind (N) = N_Loop_Statement
and then Present (Identifier (N))
then
Qualify_Entity_Names (N);
end if;
end if;
-- When the iteration scheme mentiones attribute 'Loop_Entry, the loop
......
......@@ -5447,6 +5447,8 @@ package body Exp_Util is
-- that it is common and reasonable for code to be deleted in
-- instances for various reasons.
-- Could we use Is_Statically_Unevaluated here???
if Nkind (Parent (N)) = N_If_Statement then
declare
C : constant Node_Id := Condition (Parent (N));
......@@ -5495,6 +5497,7 @@ package body Exp_Util is
declare
E : Entity_Id := First_Entity (Defining_Entity (N));
begin
while Present (E) loop
if Ekind (E) = E_Operator then
......@@ -5543,8 +5546,10 @@ package body Exp_Util is
procedure Kill_Dead_Code (L : List_Id; Warn : Boolean := False) is
N : Node_Id;
W : Boolean;
begin
W := Warn;
if Is_Non_Empty_List (L) then
N := First (L);
while Present (N) loop
......@@ -6782,6 +6787,7 @@ package body Exp_Util is
function Power_Of_Two (N : Node_Id) return Nat is
Typ : constant Entity_Id := Etype (N);
pragma Assert (Is_Integer_Type (Typ));
Siz : constant Nat := UI_To_Int (Esize (Typ));
Val : Uint;
......@@ -8703,7 +8709,6 @@ package body Exp_Util is
Loc : constant Source_Ptr := Sloc (N);
Stseq : constant Node_Id := Handled_Statement_Sequence (N);
Stmts : constant List_Id := Statements (Stseq);
begin
if Abort_Allowed then
Prepend_To (Stmts, Build_Runtime_Call (Loc, RE_Abort_Defer));
......
......@@ -639,15 +639,6 @@ package body Sem_Ch4 is
end;
end if;
-- Check restriction against dynamically allocated protected
-- objects. Note that when limited aggregates are supported,
-- a similar test should be applied to an allocator with a
-- qualified expression ???
if Has_Protected (Type_Id) then
Check_Restriction (No_Protected_Type_Allocators, N);
end if;
-- Check for missing initialization. Skip this check if we already
-- had errors on analyzing the allocator, since in that case these
-- are probably cascaded errors.
......@@ -725,6 +716,12 @@ package body Sem_Ch4 is
Check_Restriction (No_Task_Allocators, N);
end if;
-- Check restriction against dynamically allocated protected objects
if Has_Protected (Designated_Type (Acc_Type)) then
Check_Restriction (No_Protected_Type_Allocators, N);
end if;
-- AI05-0013-1: No_Nested_Finalization forbids allocators if the access
-- type is nested, and the designated type needs finalization. The rule
-- is conservative in that class-wide types need finalization.
......
......@@ -444,6 +444,11 @@ package Sem_Util is
-- specification. If the declaration has a defining unit name, then the
-- defining entity is obtained from the defining unit name ignoring any
-- child unit prefixes.
--
-- Iterator loops also have a defining entity, which holds the list of
-- local entities declared during loop expansion. These entities need
-- debugging information, generated through QUalify_Entity_Names, and
-- the loop declaration must be placed in the table Name_Qualify_Units.
function Denotes_Discriminant
(N : Node_Id;
......
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