OSDN Git Service

* einfo.ads: Block_Node points to the identifier of the block, not to
authorbosch <bosch@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 5 Dec 2001 02:07:10 +0000 (02:07 +0000)
committerbosch <bosch@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 5 Dec 2001 02:07:10 +0000 (02:07 +0000)
the block node itself, to preserve the link when the block is
rewritten, e.g. within an if-statement with a static condition.

* inline.adb (Cleanup_Scopes): recover block statement from block
entity using new meaning of Block_Node.

* sem_ch5.adb (Analyze_Block_Statement): set Block_Node to point to
identifier of block node, rather than to node itself.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@47649 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ada/ChangeLog
gcc/ada/einfo.ads
gcc/ada/inline.adb
gcc/ada/sem_ch5.adb

index ec31744..cfe75b9 100644 (file)
@@ -1,3 +1,15 @@
+2001-12-04  Ed Schonberg <schonber@gnat.com>
+
+       * einfo.ads: Block_Node points to the identifier of the block, not to 
+       the block node itself, to preserve the link when the block is 
+       rewritten, e.g. within an if-statement with a static condition. 
+       
+       * inline.adb (Cleanup_Scopes): recover block statement from block 
+       entity using new meaning of Block_Node.
+       
+       * sem_ch5.adb (Analyze_Block_Statement): set Block_Node to point to 
+       identifier of block node, rather than to node itself.
+
 2001-12-04  Gary Dismukes <dismukes@gnat.com>
        
        * layout.adb:
index bac1287..af3c131 100644 (file)
@@ -394,7 +394,14 @@ package Einfo is
 --       returns the entity unchanged.
 
 --    Block_Node (Node11)
---       Present in block entities. Points to the Block_Statement itself.
+--       Present in block entities. Points to the identifier in the
+--       Block_Statement itself. Used when retrieving the block construct
+--       for finalization purposes, The block entity has an implicit label
+--       declaration in the enclosing declarative part, and has otherwise
+--       no direct connection in the tree with the block statement.
+--       The link is to the identifier (which is an occurence of the entity)
+--       and not to the block_statement itself, because the statement may
+--       be rewritten, e.g. in the process of removing dead code.
 
 --    Body_Entity (Node19)
 --       Present in package and generic package entities, points to the
index b21ca1f..84a08ac 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---                            $Revision: 1.55 $
+--                            $Revision$
 --                                                                          --
 --          Copyright (C) 1992-2001 Free Software Foundation, Inc.          --
 --                                                                          --
@@ -672,7 +672,7 @@ package body Inline is
          end if;
 
          if Ekind (Scop) = E_Block then
-            Decl := Block_Node (Scop);
+            Decl := Parent (Block_Node (Scop));
 
          else
             Decl := Unit_Declaration_Node (Scop);
index 5fc1585..fcb7c78 100644 (file)
@@ -427,7 +427,7 @@ package body Sem_Ch5 is
       end if;
 
       Set_Etype (Ent, Standard_Void_Type);
-      Set_Block_Node (Ent, N);
+      Set_Block_Node (Ent, Identifier (N));
       New_Scope (Ent);
 
       if Present (Decls) then