summaryrefslogtreecommitdiff
path: root/gcc/ada/exp_ch5.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2011-11-07 16:25:32 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2011-11-07 16:25:32 +0000
commit07f700689b97a0de4cb3a699a3ce8792ea6027d5 (patch)
treeb7d2c8c0616c6ae4c1b17857b182dea8d1352672 /gcc/ada/exp_ch5.adb
parent5216baa80511d06d2c52cf413c0c1522e7e899b8 (diff)
downloadgcc-07f700689b97a0de4cb3a699a3ce8792ea6027d5.tar.gz
2011-11-07 Yannick Moy <moy@adacore.com>
* sem_util.adb (Note_Possible_Modification): In Alfa mode, generate a reference for a modification even when the modification does not come from source. 2011-11-07 Ed Schonberg <schonberg@adacore.com> * exp_ch5.adb (Expand_Iterator_Loop): For the "of" iterator form, use the indexing attributes rather than the Element function, to obtain variable references. * sem_ch4.adb (Try_Container_Indexing): Code cleanup. Use Find_Aspect rather than iterating over representation items. Improve error message. * a-cohama.adb, a-cohama.ads Update to latest RM, with two versions of Reference functions. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@181093 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/exp_ch5.adb')
-rw-r--r--gcc/ada/exp_ch5.adb22
1 files changed, 12 insertions, 10 deletions
diff --git a/gcc/ada/exp_ch5.adb b/gcc/ada/exp_ch5.adb
index eb23bfd641c..fd75b158449 100644
--- a/gcc/ada/exp_ch5.adb
+++ b/gcc/ada/exp_ch5.adb
@@ -3120,32 +3120,32 @@ package body Exp_Ch5 is
end loop;
-- Generate:
- -- Id : Element_Type renames Pack.Element (Cursor);
+ -- Id : Element_Type renames Container (Cursor);
+ -- This assumes that the container type has an indexing
+ -- operation with Cursor. The check that this operation
+ -- exists is performed in Check_Container_Indexing.
Decl :=
Make_Object_Renaming_Declaration (Loc,
Defining_Identifier => Id,
- Subtype_Mark =>
+ Subtype_Mark =>
New_Reference_To (Element_Type, Loc),
- Name =>
+ Name =>
Make_Indexed_Component (Loc,
- Prefix => Make_Selected_Component (Loc,
- Prefix => New_Reference_To (Pack, Loc),
- Selector_Name =>
- Make_Identifier (Loc, Chars => Name_Element)),
+ Prefix => Relocate_Node (Container_Arg),
Expressions =>
New_List (New_Occurrence_Of (Cursor, Loc))));
-- If the container holds controlled objects, wrap the loop
-- statements and element renaming declaration with a block.
- -- This ensures that the result of Element (Iterator) is
+ -- This ensures that the result of Element (Cusor) is
-- cleaned up after each iteration of the loop.
if Needs_Finalization (Element_Type) then
-- Generate:
-- declare
- -- Id : Element_Type := Pack.Element (Iterator);
+ -- Id : Element_Type := Pack.Element (curosr);
-- begin
-- <original loop statements>
-- end;
@@ -3279,9 +3279,11 @@ package body Exp_Ch5 is
-- The Iterator is not modified in the source, but of course will
-- be updated in the generated code. Indicate that it is actually
- -- set to prevent spurious warnings.
+ -- set to prevent spurious warnings. Ditto for the Cursor, which
+ -- is modified indirectly in generated code.
Set_Never_Set_In_Source (Iterator, False);
+ Set_Never_Set_In_Source (Cursor, False);
-- If the range of iteration is given by a function call that
-- returns a container, the finalization actions have been saved