OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [ada/] [sem_ch8.ads] - Blame information for rev 749

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 706 jeremybenn
------------------------------------------------------------------------------
2
--                                                                          --
3
--                         GNAT COMPILER COMPONENTS                         --
4
--                                                                          --
5
--                              S E M _ C H 8                               --
6
--                                                                          --
7
--                                 S p e c                                  --
8
--                                                                          --
9
--          Copyright (C) 1992-2011, 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 3,  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 COPYING3.  If not, go to --
19
-- http://www.gnu.org/licenses for a complete copy of the license.          --
20
--                                                                          --
21
-- GNAT was originally developed  by the GNAT team at  New York University. --
22
-- Extensive contributions were provided by Ada Core Technologies Inc.      --
23
--                                                                          --
24
------------------------------------------------------------------------------
25
 
26
with Types; use Types;
27
package Sem_Ch8 is
28
 
29
   -----------------------------------
30
   -- Handling extensions of System --
31
   -----------------------------------
32
 
33
   --  For targets that define a much larger System package than given in
34
   --  the RM, we use a child package containing additional declarations,
35
   --  which is loaded when needed, and whose entities are conceptually
36
   --  within System itself. The presence of this auxiliary package is
37
   --  controlled with the pragma Extend_System. The following variable
38
   --  holds the entity of the auxiliary package, to simplify the special
39
   --  visibility rules that apply to it.
40
 
41
   System_Aux_Id : Entity_Id := Empty;
42
 
43
   -----------------
44
   -- Subprograms --
45
   -----------------
46
 
47
   procedure Analyze_Exception_Renaming         (N : Node_Id);
48
   procedure Analyze_Expanded_Name              (N : Node_Id);
49
   procedure Analyze_Generic_Function_Renaming  (N : Node_Id);
50
   procedure Analyze_Generic_Package_Renaming   (N : Node_Id);
51
   procedure Analyze_Generic_Procedure_Renaming (N : Node_Id);
52
   procedure Analyze_Object_Renaming            (N : Node_Id);
53
   procedure Analyze_Package_Renaming           (N : Node_Id);
54
   procedure Analyze_Subprogram_Renaming        (N : Node_Id);
55
   procedure Analyze_Use_Package                (N : Node_Id);
56
   procedure Analyze_Use_Type                   (N : Node_Id);
57
 
58
   procedure End_Scope;
59
   --  Called at end of scope. On exit from blocks and bodies (subprogram,
60
   --  package, task, and protected bodies), the name of the current scope
61
   --  must be removed from the scope stack, and the local entities must be
62
   --  removed from their homonym chains. On exit from record declarations,
63
   --  from package specifications, and from tasks and protected type
64
   --  specifications, more specialized procedures are invoked.
65
 
66
   procedure End_Use_Clauses (Clause : Node_Id);
67
   --  Invoked on scope exit, to undo the effect of local use clauses. Clause
68
   --  is the first use-clause of a scope being exited. This can be the current
69
   --  scope, or some enclosing scopes when building a clean environment to
70
   --  compile an instance body for inlining.
71
 
72
   procedure End_Use_Package (N : Node_Id);
73
   procedure End_Use_Type    (N : Node_Id);
74
   --  Subsidiaries of End_Use_Clauses. Also called directly for use clauses
75
   --  appearing in context clauses.
76
 
77
   procedure Find_Direct_Name (N : Node_Id);
78
   --  Given a direct name (Identifier or Operator_Symbol), this routine scans
79
   --  the homonym chain for the name, searching for corresponding visible
80
   --  entities to find the referenced entity (or in the case of overloading,
81
   --  one candidate interpretation). On return, the Entity and Etype fields
82
   --  are set. In the non-overloaded case, these are the correct entries.
83
   --  In the overloaded case, the flag Is_Overloaded is set, Etype and Entity
84
   --  refer to an arbitrary element of the overloads set, and the appropriate
85
   --  entries have been added to the overloads table entry for the node. The
86
   --  overloading will be disambiguated during type resolution.
87
   --
88
   --  Note, when this is called during semantic analysis in the overloaded
89
   --  case, the entity set will be the most recently declared homonym. In
90
   --  particular, the caller may follow the homonym chain checking for all
91
   --  entries in the current scope, and that will give all homonyms that are
92
   --  declared before the point of call in the current scope. This is useful
93
   --  for example in the processing for pragma Inline.
94
 
95
   procedure Find_Selected_Component (N : Node_Id);
96
   --  Resolve various cases of selected components, recognize expanded names
97
 
98
   procedure Find_Type (N : Node_Id);
99
   --  Perform name resolution, and verify that the name found is that of a
100
   --  type. On return the Entity and Etype fields of the node N are set
101
   --  appropriately. If it is an incomplete type whose full declaration has
102
   --  been seen, they are set to the entity in the full declaration. If it
103
   --  is an incomplete type associated with an interface visible through a
104
   --  limited-with clause, whose full declaration has been seen, they are
105
   --  set to the entity in the full declaration. Similarly, if the type is
106
   --  private, it has received a full declaration, and we are in the private
107
   --  part or body of the package, then the two fields are set to the entity
108
   --  of the full declaration as well. This procedure also has special
109
   --  processing for 'Class attribute references.
110
 
111
   function Has_Loop_In_Inner_Open_Scopes (S : Entity_Id) return Boolean;
112
   --  S is the entity of an open scope. This function determines if there is
113
   --  an inner scope of S which is a loop (i.e. it appears somewhere in the
114
   --  scope stack after S).
115
 
116
   function In_Open_Scopes (S : Entity_Id) return Boolean;
117
   --  S is the entity of a scope. This function determines if this scope is
118
   --  currently open (i.e. it appears somewhere in the scope stack).
119
 
120
   procedure Initialize;
121
   --  Initializes data structures used for visibility analysis. Must be
122
   --  called before analyzing each new main source program.
123
 
124
   procedure Install_Use_Clauses
125
     (Clause             : Node_Id;
126
      Force_Installation : Boolean := False);
127
   --  Applies the use clauses appearing in a given declarative part,
128
   --  when the corresponding scope has been placed back on the scope
129
   --  stack after unstacking to compile a different context (subunit or
130
   --  parent of generic body). Force_Installation is used when called from
131
   --  Analyze_Subunit.Re_Install_Use_Clauses to insure that, after the
132
   --  analysis of the subunit, the parent's environment is again identical.
133
 
134
   procedure Push_Scope (S : Entity_Id);
135
   --  Make new scope stack entry, pushing S, the entity for a scope onto the
136
   --  top of the scope table. The current setting of the scope suppress flags
137
   --  is saved for restoration on exit.
138
 
139
   procedure Pop_Scope;
140
   --  Remove top entry from scope stack, restoring the saved setting of the
141
   --  scope suppress flags.
142
 
143
   function Present_System_Aux (N : Node_Id := Empty) return Boolean;
144
   --  Return True if the auxiliary system file has been successfully loaded.
145
   --  Otherwise attempt to load it, using the name supplied by a previous
146
   --  Extend_System pragma, and report on the success of the load. If N is
147
   --  present, it is a selected component whose prefix is System, or else a
148
   --  with-clause on system. N is absent when the function is called to find
149
   --  the visibility of implicit operators.
150
 
151
   procedure Restore_Scope_Stack (Handle_Use : Boolean := True);
152
   procedure Save_Scope_Stack (Handle_Use : Boolean := True);
153
   --  These two procedures are called from Semantics, when a unit U1 is to
154
   --  be compiled in the course of the compilation of another unit U2. This
155
   --  happens whenever Rtsfind is called. U1, the unit retrieved by Rtsfind,
156
   --  must be compiled in its own context, and the current scope stack
157
   --  containing U2 and local scopes must be made unreachable. On return, the
158
   --  contents of the scope stack must be made accessible again. The flag
159
   --  Handle_Use indicates whether local use clauses must be removed or
160
   --  installed. In the case of inlining of instance bodies, the visibility
161
   --  handling is done fully in Inline_Instance_Body, and use clauses are
162
   --  handled there.
163
 
164
   procedure Set_Use (L : List_Id);
165
   --  Find use clauses that are declarative items in a package declaration
166
   --  and  set the potentially use-visible flags of imported entities before
167
   --  analyzing the corresponding package body.
168
 
169
   procedure ws;
170
   --  Debugging routine for use in gdb: dump all entities on scope stack
171
 
172
end Sem_Ch8;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.