OSDN Git Service

Delete all lines containing "$Revision:".
[pf3gnuchains/gcc-fork.git] / gcc / ada / sem_ch8.ads
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                         GNAT COMPILER COMPONENTS                         --
4 --                                                                          --
5 --                              S E M _ C H 8                               --
6 --                                                                          --
7 --                                 S p e c                                  --
8 --                                                                          --
9 --                                                                          --
10 --          Copyright (C) 1992-2001 Free Software Foundation, Inc.          --
11 --                                                                          --
12 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
13 -- terms of the  GNU General Public License as published  by the Free Soft- --
14 -- ware  Foundation;  either version 2,  or (at your option) any later ver- --
15 -- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
16 -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
17 -- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
18 -- for  more details.  You should have  received  a copy of the GNU General --
19 -- Public License  distributed with GNAT;  see file COPYING.  If not, write --
20 -- to  the Free Software Foundation,  59 Temple Place - Suite 330,  Boston, --
21 -- MA 02111-1307, USA.                                                      --
22 --                                                                          --
23 -- GNAT was originally developed  by the GNAT team at  New York University. --
24 -- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
25 --                                                                          --
26 ------------------------------------------------------------------------------
27
28 with Types; use Types;
29 package Sem_Ch8 is
30
31    -----------------------------------
32    -- Handling extensions of System --
33    -----------------------------------
34
35    --  For targets that define a much larger System package than given in
36    --  the RM, we use a child package containing additional declarations,
37    --  which is loaded when needed, and whose entities are conceptually
38    --  within System itself. The presence of this auxiliary package is
39    --  controlled with the pragma Extend_System. The following variable
40    --  holds the entity of the auxiliary package, to simplify the special
41    --  visibility rules that apply to it.
42
43    System_Aux_Id : Entity_Id := Empty;
44
45    -----------------
46    -- Subprograms --
47    -----------------
48
49    procedure Analyze_Exception_Renaming                 (N : Node_Id);
50    procedure Analyze_Expanded_Name                      (N : Node_Id);
51    procedure Analyze_Generic_Function_Renaming          (N : Node_Id);
52    procedure Analyze_Generic_Package_Renaming           (N : Node_Id);
53    procedure Analyze_Generic_Procedure_Renaming         (N : Node_Id);
54    procedure Analyze_Object_Renaming                    (N : Node_Id);
55    procedure Analyze_Package_Renaming                   (N : Node_Id);
56    procedure Analyze_Subprogram_Renaming                (N : Node_Id);
57    procedure Analyze_Use_Package                        (N : Node_Id);
58    procedure Analyze_Use_Type                           (N : Node_Id);
59
60    function Applicable_Use (Pack_Name : Node_Id) return Boolean;
61    --  Common code to Use_One_Package and Set_Use, to determine whether
62    --  use clause must be processed. Pack_Name is an entity name that
63    --  references the package in question.
64
65    procedure End_Scope;
66    --  Called at end of scope. On exit from blocks and bodies (subprogram,
67    --  package, task, and protected bodies), the name of the current scope
68    --  must be removed from the scope stack, and the local entities must be
69    --  removed from their homonym chains. On exit from record declarations,
70    --  from package specifications, and from tasks and protected type
71    --  specifications, more specialized procedures are invoked.
72
73    procedure End_Use_Clauses (Clause : Node_Id);
74    --  Invoked on scope exit, to undo the effect of local use clauses. U is
75    --  the first Use clause of a scope being exited. This can be the current
76    --  scope, or some enclosing scopes when building a clean environment to
77    --  compile an instance body for inlining.
78
79    procedure End_Use_Package (N : Node_Id);
80    procedure End_Use_Type    (N : Node_Id);
81    --  Subsidiaries of End_Use_Clauses.  Also called directly for use clauses
82    --  appearing in context clauses.
83
84    procedure Find_Direct_Name (N : Node_Id);
85    --  Given a direct name (Identifier or Operator_Symbol), this routine
86    --  scans the homonym chain for the name searching for corresponding
87    --  visible entities to find the referenced entity (or in the case of
88    --  overloading), entities. On return, the Entity, and Etype fields
89    --  are set. In the non-overloaded case, these are the correct final
90    --  entries. In the overloaded case, Is_Overloaded is set, Etype and
91    --  Entity refer to an arbitrary element of the overloads set, and
92    --  an appropriate list of entries has been made in the overload
93    --  interpretation table (to be disambiguated in the resolve phase).
94
95    procedure Find_Expanded_Name (N : Node_Id);
96    --  Selected component is known to be expanded name. Verify legality
97    --  of selector given the scope denoted by prefix.
98
99    procedure Find_Selected_Component (N : Node_Id);
100    --  Resolve various cases of selected components, recognize expanded names
101
102    procedure Find_Type (N : Node_Id);
103    --  Perform name resolution, and verify that the name found is that of a
104    --  type. On return the Entity and Etype fields of the node N are set
105    --  appropriately. If it is an incomplete type whose full declaration has
106    --  been seen, return the entity in the full declaration. Similarly, if
107    --  the type is private, it has receivd a full declaration, and we are
108    --  in the private part or body of the package, return the full
109    --  declaration as well. Special processing for Class types as well.
110
111    function Get_Full_View (T_Name : Entity_Id) return Entity_Id;
112    --  If T_Name is an incomplete type and the full declaration has been
113    --  seen, or is the name of a class_wide type whose root is incomplete.
114    --  return the corresponding full declaration.
115
116    function Has_Implicit_Operator (N : Node_Id) return Boolean;
117    --  N is an expanded name whose selector is an operator name (eg P."+").
118    --  A declarative part contains an implicit declaration of an operator
119    --  if it has a declaration of a type to which one of the predefined
120    --  operators apply. The existence of this routine is an artifact of
121    --  our implementation: a more straightforward but more space-consuming
122    --  choice would be to make all inherited operators explicit in the
123    --  symbol table.
124
125    procedure Initialize;
126    --  Initializes data structures used for visibility analysis. Must be
127    --  called before analyzing each new main source program.
128
129    procedure Install_Use_Clauses (Clause : Node_Id);
130    --  applies the use clauses appearing in a given declarative part,
131    --  when the corresponding scope has been placed back on the scope
132    --  stack after unstacking to compile a different context (subunit or
133    --  parent of generic body).
134
135    function In_Open_Scopes (S : Entity_Id) return Boolean;
136    --  S is the entity of a scope. This function determines if this scope
137    --  is currently open (i.e. it appears somewhere in the scope stack).
138
139    function Is_Appropriate_For_Record (T : Entity_Id) return Boolean;
140    --  Prefix is appropriate for record if it is of a record type, or
141    --  an access to such.
142
143    function Is_Appropriate_For_Entry_Prefix (T : Entity_Id) return Boolean;
144    --  True if it is of a task type, a protected type, or else an access
145    --  to one of these types.
146
147    procedure New_Scope (S : Entity_Id);
148    --  Make new scope stack entry, pushing S, the entity for a scope
149    --  onto the top of the scope table. The current setting of the scope
150    --  suppress flags is saved for restoration on exit.
151
152    procedure Pop_Scope;
153    --  Remove top entry from scope stack, restoring the saved setting
154    --  of the scope suppress flags.
155
156    function Present_System_Aux (N : Node_Id := Empty) return Boolean;
157    --  Return True if the auxiliary system file has been successfully loaded.
158    --  Otherwise attempt to load it, using the name supplied by a previous
159    --  Extend_System pragma, and report on the success of the load.
160    --  If N is present, it is a selected component whose prefix is System,
161    --  or else a with-clause on system. N is absent when the function is
162    --  called to find the visibility of implicit operators.
163
164    procedure Restore_Scope_Stack;
165    procedure Save_Scope_Stack;
166    --  These two procedures are called from Semantics, when a unit U1 is
167    --  to be compiled in the course of the compilation of another unit U2.
168    --  This happens whenever Rtsfind is called. U1, the unit retrieved by
169    --  Rtsfind, must be compiled in its own context, and the current scope
170    --  stack containing U2 and local scopes must be made unreachable. On
171    --  return, the contents of the scope stack must be made accessible again.
172
173    procedure Use_One_Package (P : Entity_Id; N : Node_Id);
174    --  Make visible entities declarated in package P potentially use-visible
175    --  in the current context. Also used in the analysis of subunits, when
176    --  re-installing use clauses of parent units. N is the use_clause that
177    --  names P (and possibly other packages).
178
179    procedure Use_One_Type (Id : Node_Id);
180    --  Id is the subtype mark from a use type clause. This procedure makes
181    --  the primitive operators of the type potentially use-visible.
182
183    procedure Set_Use (L : List_Id);
184    --  Find use clauses that are declarative items in a package declaration
185    --  and  set the potentially use-visible flags of imported entities before
186    --  analyzing the corresponding package body.
187
188 end Sem_Ch8;