PR target/16201
[official-gcc.git] / gcc / ada / sem_ch8.ads
blob3c6eacfa84be89a813c1227033108d1ef4814e68
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- S E M _ C H 8 --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 1992-2004 Free Software Foundation, Inc. --
10 -- --
11 -- GNAT is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 2, or (at your option) any later ver- --
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
17 -- for more details. You should have received a copy of the GNU General --
18 -- Public License distributed with GNAT; see file COPYING. If not, write --
19 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
20 -- MA 02111-1307, USA. --
21 -- --
22 -- GNAT was originally developed by the GNAT team at New York University. --
23 -- Extensive contributions were provided by Ada Core Technologies Inc. --
24 -- --
25 ------------------------------------------------------------------------------
27 with Types; use Types;
28 package Sem_Ch8 is
30 -----------------------------------
31 -- Handling extensions of System --
32 -----------------------------------
34 -- For targets that define a much larger System package than given in
35 -- the RM, we use a child package containing additional declarations,
36 -- which is loaded when needed, and whose entities are conceptually
37 -- within System itself. The presence of this auxiliary package is
38 -- controlled with the pragma Extend_System. The following variable
39 -- holds the entity of the auxiliary package, to simplify the special
40 -- visibility rules that apply to it.
42 System_Aux_Id : Entity_Id := Empty;
44 -----------------
45 -- Subprograms --
46 -----------------
48 procedure Analyze_Exception_Renaming (N : Node_Id);
49 procedure Analyze_Expanded_Name (N : Node_Id);
50 procedure Analyze_Generic_Function_Renaming (N : Node_Id);
51 procedure Analyze_Generic_Package_Renaming (N : Node_Id);
52 procedure Analyze_Generic_Procedure_Renaming (N : Node_Id);
53 procedure Analyze_Object_Renaming (N : Node_Id);
54 procedure Analyze_Package_Renaming (N : Node_Id);
55 procedure Analyze_Subprogram_Renaming (N : Node_Id);
56 procedure Analyze_Use_Package (N : Node_Id);
57 procedure Analyze_Use_Type (N : Node_Id);
59 procedure End_Scope;
60 -- Called at end of scope. On exit from blocks and bodies (subprogram,
61 -- package, task, and protected bodies), the name of the current scope
62 -- must be removed from the scope stack, and the local entities must be
63 -- removed from their homonym chains. On exit from record declarations,
64 -- from package specifications, and from tasks and protected type
65 -- specifications, more specialized procedures are invoked.
67 procedure End_Use_Clauses (Clause : Node_Id);
68 -- Invoked on scope exit, to undo the effect of local use clauses. Clause
69 -- is the first use-clause of a scope being exited. This can be the current
70 -- scope, or some enclosing scopes when building a clean environment to
71 -- compile an instance body for inlining.
73 procedure End_Use_Package (N : Node_Id);
74 procedure End_Use_Type (N : Node_Id);
75 -- Subsidiaries of End_Use_Clauses. Also called directly for use clauses
76 -- appearing in context clauses.
78 procedure Find_Direct_Name (N : Node_Id);
79 -- Given a direct name (Identifier or Operator_Symbol), this routine
80 -- scans the homonym chain for the name searching for corresponding
81 -- visible entities to find the referenced entity (or in the case of
82 -- overloading), entities. On return, the Entity, and Etype fields
83 -- are set. In the non-overloaded case, these are the correct final
84 -- entries. In the overloaded case, Is_Overloaded is set, Etype and
85 -- Entity refer to an arbitrary element of the overloads set, and
86 -- an appropriate list of entries has been made in the overload
87 -- interpretation table (to be disambiguated in the resolve phase).
89 procedure Find_Selected_Component (N : Node_Id);
90 -- Resolve various cases of selected components, recognize expanded names
92 procedure Find_Type (N : Node_Id);
93 -- Perform name resolution, and verify that the name found is that of a
94 -- type. On return the Entity and Etype fields of the node N are set
95 -- appropriately. If it is an incomplete type whose full declaration has
96 -- been seen, they are set to the entity in the full declaration.
97 -- Similarly, if the type is private, it has received a full declaration,
98 -- and we are in the private part or body of the package, then the two
99 -- fields are set to the entity of the full declaration as well. This
100 -- procedure also provides special processing for Class types as well.
102 function Get_Full_View (T_Name : Entity_Id) return Entity_Id;
103 -- If T_Name is an incomplete type and the full declaration has been
104 -- seen, or is the name of a class_wide type whose root is incomplete.
105 -- return the corresponding full declaration.
107 procedure Initialize;
108 -- Initializes data structures used for visibility analysis. Must be
109 -- called before analyzing each new main source program.
111 procedure Install_Use_Clauses
112 (Clause : Node_Id;
113 Force_Installation : Boolean := False);
114 -- Applies the use clauses appearing in a given declarative part,
115 -- when the corresponding scope has been placed back on the scope
116 -- stack after unstacking to compile a different context (subunit or
117 -- parent of generic body). Force_Installation is used when called from
118 -- Analyze_Subunit.Re_Install_Use_Clauses to insure that, after the
119 -- analysis of the subunit, the parent's environment is again identical.
121 function In_Open_Scopes (S : Entity_Id) return Boolean;
122 -- S is the entity of a scope. This function determines if this scope
123 -- is currently open (i.e. it appears somewhere in the scope stack).
125 procedure New_Scope (S : Entity_Id);
126 -- Make new scope stack entry, pushing S, the entity for a scope
127 -- onto the top of the scope table. The current setting of the scope
128 -- suppress flags is saved for restoration on exit.
130 procedure Pop_Scope;
131 -- Remove top entry from scope stack, restoring the saved setting
132 -- of the scope suppress flags.
134 function Present_System_Aux (N : Node_Id := Empty) return Boolean;
135 -- Return True if the auxiliary system file has been successfully loaded.
136 -- Otherwise attempt to load it, using the name supplied by a previous
137 -- Extend_System pragma, and report on the success of the load.
138 -- If N is present, it is a selected component whose prefix is System,
139 -- or else a with-clause on system. N is absent when the function is
140 -- called to find the visibility of implicit operators.
142 procedure Restore_Scope_Stack (Handle_Use : Boolean := True);
143 procedure Save_Scope_Stack (Handle_Use : Boolean := True);
144 -- These two procedures are called from Semantics, when a unit U1 is
145 -- to be compiled in the course of the compilation of another unit U2.
146 -- This happens whenever Rtsfind is called. U1, the unit retrieved by
147 -- Rtsfind, must be compiled in its own context, and the current scope
148 -- stack containing U2 and local scopes must be made unreachable. On
149 -- return, the contents of the scope stack must be made accessible again.
150 -- The flag Handle_Use indicates whether local use clauses must be
151 -- removed/installed. In the case of inlining of instance bodies, the
152 -- visiblity handling is done fully in Inline_Instance_Body, and use
153 -- clauses are handled there.
155 procedure Set_Use (L : List_Id);
156 -- Find use clauses that are declarative items in a package declaration
157 -- and set the potentially use-visible flags of imported entities before
158 -- analyzing the corresponding package body.
160 end Sem_Ch8;