This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada] Update documentation and rename a procedure


2001-12-05  Ed Schonberg <schonber@gnat.com>

	* sem_ch12.adb:
	Document use of Associated_Node on Selected_Components.
	(Save_Global_Operand_Descendants): Change to Save_Entity_Descendants,
	to clarify use of untyped descendant fields.

*** sem_ch12.adb	2001/10/06 19:42:45	1.784
--- sem_ch12.adb	2001/10/07 17:30:26	1.785
***************
*** 532,538 ****
     --  information from the associated node is placed on the new copy, so
     --  that name resolution is not repeated.
  
!    --  Three kinds of nodes have associated nodes:
  
     --    a) those that contain entities, that is to say identifiers,
     --       expanded_names, and operators (N_Has_Entity)
--- 532,538 ----
     --  information from the associated node is placed on the new copy, so
     --  that name resolution is not repeated.
  
!    --  Three kinds of source nodes have associated nodes:
  
     --    a) those that contain entities, that is to say identifiers,
     --       expanded_names, and operators (N_Has_Entity)
***************
*** 553,562 ****
     --  some of the ancestor types, if their view is private at the point of
     --  instantiation.
  
!    --  Query??? why selected components. What about N_Freeze_Nodes, I assume
!    --  that the answer is no, which means that the comment above for a) is
!    --  confusing ???
  
     --  The associated node is stored in the Associated_Node field. Note that
     --  this field overlaps Entity, which is fine, because the whole point is
     --  that we don't need or want the normal Entity field in this situation.
--- 553,565 ----
     --  some of the ancestor types, if their view is private at the point of
     --  instantiation.
  
!    --  Nodes that are selected components in the parse tree may be rewritten
!    --  as expanded names after resolution, and must be treated as potential
!    --  entity holders. which is why they also have an Associated_Node.
  
+    --  Nodes that do not come from source, such as freeze nodes, do not appear
+    --  in the generic tree, and need not have an associated node.
+ 
     --  The associated node is stored in the Associated_Node field. Note that
     --  this field overlaps Entity, which is fine, because the whole point is
     --  that we don't need or want the normal Entity field in this situation.
***************
*** 8181,8186 ****
--- 8184,8194 ----
        --  Save semantic information on global entity, so that it is not
        --  resolved again at instantiation time.
  
+       procedure Save_Entity_Descendants (N : Node_Id);
+       --  Apply Save_Global_References to the two syntactic descendants of
+       --  nodes that carry entities, i.e. identifiers, character literals,
+       --  expanded names, and operators.
+ 
        procedure Save_Global_Defaults (N1, N2 : Node_Id);
        --  Default actuals in nested instances must be handled specially
        --  because there is no link to them from the original tree. When an
***************
*** 8193,8204 ****
        --  context of the parent, we must preserve the identifier of the parent
        --  so that it can be properly resolved in a subsequent instantiation.
  
-       procedure Save_Global_Operand_Descendants (N : Node_Id);
-       --  Apply Save_Global_Descendant to the possible operand fields
-       --  of the node N (Field2 = Left_Opnd, Field3 = Right_Opnd).
-       --
-       --  It is uncomfortable for Sem_Ch12 to have this knowledge ???
- 
        procedure Save_Global_Descendant (D : Union_Id);
        --  Apply Save_Global_References recursively to the descendents of
        --  current node.
--- 8201,8206 ----
***************
*** 8359,8365 ****
                 Change_Selected_Component_To_Expanded_Name (Parent (N));
                 Set_Associated_Node (Parent (N), Parent (N2));
                 Set_Global_Type (Parent (N), Parent (N2));
!                Save_Global_Operand_Descendants (N);
  
                 --  If this is a reference to the current generic entity,
                 --  replace it with a simple name. This is to avoid anomalies
--- 8361,8367 ----
                 Change_Selected_Component_To_Expanded_Name (Parent (N));
                 Set_Associated_Node (Parent (N), Parent (N2));
                 Set_Global_Type (Parent (N), Parent (N2));
!                Save_Entity_Descendants (N);
  
                 --  If this is a reference to the current generic entity,
                 --  replace it with a simple name. This is to avoid anomalies
***************
*** 8410,8416 ****
              Change_Selected_Component_To_Expanded_Name (Parent (N));
              Set_Associated_Node (Parent (N), Name (Parent (N2)));
              Set_Global_Type (Parent (N), Name (Parent (N2)));
!             Save_Global_Operand_Descendants (N);
  
           else
              --  Entity is local. Reset in generic unit, so that node
--- 8412,8418 ----
              Change_Selected_Component_To_Expanded_Name (Parent (N));
              Set_Associated_Node (Parent (N), Name (Parent (N2)));
              Set_Global_Type (Parent (N), Name (Parent (N2)));
!             Save_Entity_Descendants (N);
  
           else
              --  Entity is local. Reset in generic unit, so that node
***************
*** 8421,8426 ****
--- 8423,8443 ----
           end if;
        end Reset_Entity;
  
+       -----------------------------
+       -- Save_Entity_Descendants --
+       -----------------------------
+ 
+       procedure Save_Entity_Descendants (N : Node_Id) is
+ 
+          use Atree.Unchecked_Access;
+          --  This code section is part of the implementation of an untyped
+          --  tree traversal, so it needs direct access to node fields.
+ 
+       begin
+          Save_Global_Descendant (Field2 (N));
+          Save_Global_Descendant (Field3 (N));
+       end Save_Entity_Descendants;
+ 
        --------------------------
        -- Save_Global_Defaults --
        --------------------------
***************
*** 8589,8609 ****
           end if;
        end Save_Global_Descendant;
  
-       -------------------------------------
-       -- Save_Global_Operand_Descendants --
-       -------------------------------------
- 
-       procedure Save_Global_Operand_Descendants (N : Node_Id) is
- 
-          use Atree.Unchecked_Access;
-          --  This code section is part of the implementation of an untyped
-          --  tree traversal, so it needs direct access to node fields.
- 
-       begin
-          Save_Global_Descendant (Field2 (N));
-          Save_Global_Descendant (Field3 (N));
-       end Save_Global_Operand_Descendants;
- 
        ---------------------
        -- Save_References --
        ---------------------
--- 8606,8611 ----
***************
*** 8694,8700 ****
  
              --  Complete the check on operands
  
!             Save_Global_Operand_Descendants (N);
  
           elsif Nkind (N) = N_Identifier then
              if Nkind (N) = Nkind (Get_Associated_Node (N)) then
--- 8696,8702 ----
  
              --  Complete the check on operands
  
!             Save_Entity_Descendants (N);
  
           elsif Nkind (N) = N_Identifier then
              if Nkind (N) = Nkind (Get_Associated_Node (N)) then


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]