diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-12-08 11:26:46 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-12-08 11:26:46 +0000 |
commit | aae50ddd3a4c0afb3725b35cafe29d7581b6ecd7 (patch) | |
tree | 80a2c09a38886e46b64411da23e90656c1713647 /gcc/ada/sem_util.adb | |
parent | 5cc6e33a9a052588adcd9dd8068f663ad9fb04b9 (diff) | |
download | gcc-aae50ddd3a4c0afb3725b35cafe29d7581b6ecd7.tar.gz |
* exp_ch4.adb (Expand_N_Indexed_Component): For an indexed component
with an implicit dereference as its prefix, use
Insert_Explicit_Dereference instead of merely rewriting the prefix into
an explicit dereference. This ensures that a reference to the original
prefix is generated, if appropriate.
* sem_util.adb (Insert_Explicit_Dereference): When an implicit
dereference is rewritten to an explicit one, generate a reference to
the entity denoted by its prefix using the original prefix node, so
the dereference can be properly recorded as a read of the denoted
access value, if appropriate.
* sem_warn.adb (Output_Unreferenced_Messages): Do not abstain from
emitting 'assigned but never read' warning on a variable on the basis
that it has an access type.
(Check_References): Emit unreferenced warning when the scope is a
subprogram body.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@91881 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/sem_util.adb')
-rw-r--r-- | gcc/ada/sem_util.adb | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index 22066fe07ce..cc0cc6fd43b 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -2631,7 +2631,7 @@ package body Sem_Util is begin Get_Unit_Name_String (Unit_Name_Id); - -- Remove seven last character (" (spec)" or " (body)"). + -- Remove seven last character (" (spec)" or " (body)") Name_Len := Name_Len - 7; pragma Assert (Name_Buffer (Name_Len + 1) = ' '); @@ -3136,6 +3136,7 @@ package body Sem_Util is procedure Insert_Explicit_Dereference (N : Node_Id) is New_Prefix : constant Node_Id := Relocate_Node (N); + Ent : Entity_Id := Empty; I : Interp_Index; It : Interp; T : Entity_Id; @@ -3166,6 +3167,21 @@ package body Sem_Util is end loop; End_Interp_List; + + else + -- Prefix is unambiguous: mark the original prefix (which might + -- Come_From_Source) as a reference, since the new (relocated) one + -- won't be taken into account. + + if Is_Entity_Name (New_Prefix) then + Ent := Entity (New_Prefix); + elsif Nkind (New_Prefix) = N_Selected_Component then + Ent := Entity (Selector_Name (New_Prefix)); + end if; + + if Present (Ent) then + Generate_Reference (Ent, New_Prefix); + end if; end if; end Insert_Explicit_Dereference; |