annotate gcc/ada/lib-xref.ads @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 ------------------------------------------------------------------------------
kono
parents:
diff changeset
2 -- --
kono
parents:
diff changeset
3 -- GNAT COMPILER COMPONENTS --
kono
parents:
diff changeset
4 -- --
kono
parents:
diff changeset
5 -- L I B . X R E F --
kono
parents:
diff changeset
6 -- --
kono
parents:
diff changeset
7 -- S p e c --
kono
parents:
diff changeset
8 -- --
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
9 -- Copyright (C) 1998-2018, Free Software Foundation, Inc. --
111
kono
parents:
diff changeset
10 -- --
kono
parents:
diff changeset
11 -- GNAT is free software; you can redistribute it and/or modify it under --
kono
parents:
diff changeset
12 -- terms of the GNU General Public License as published by the Free Soft- --
kono
parents:
diff changeset
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
kono
parents:
diff changeset
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
kono
parents:
diff changeset
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
kono
parents:
diff changeset
16 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
kono
parents:
diff changeset
17 -- for more details. You should have received a copy of the GNU General --
kono
parents:
diff changeset
18 -- Public License distributed with GNAT; see file COPYING3. If not, go to --
kono
parents:
diff changeset
19 -- http://www.gnu.org/licenses for a complete copy of the license. --
kono
parents:
diff changeset
20 -- --
kono
parents:
diff changeset
21 -- GNAT was originally developed by the GNAT team at New York University. --
kono
parents:
diff changeset
22 -- Extensive contributions were provided by Ada Core Technologies Inc. --
kono
parents:
diff changeset
23 -- --
kono
parents:
diff changeset
24 ------------------------------------------------------------------------------
kono
parents:
diff changeset
25
kono
parents:
diff changeset
26 -- This package contains for collecting and outputting cross-reference
kono
parents:
diff changeset
27 -- information.
kono
parents:
diff changeset
28
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
29 with Einfo; use Einfo;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
30 with SPARK_Xrefs;
111
kono
parents:
diff changeset
31
kono
parents:
diff changeset
32 package Lib.Xref is
kono
parents:
diff changeset
33
kono
parents:
diff changeset
34 -------------------------------------------------------
kono
parents:
diff changeset
35 -- Format of Cross-Reference Information in ALI File --
kono
parents:
diff changeset
36 -------------------------------------------------------
kono
parents:
diff changeset
37
kono
parents:
diff changeset
38 -- Cross-reference sections follow the dependency section (D lines) in
kono
parents:
diff changeset
39 -- an ALI file, so that they need not be read by gnatbind, gnatmake etc.
kono
parents:
diff changeset
40
kono
parents:
diff changeset
41 -- A cross reference section has a header of the form
kono
parents:
diff changeset
42
kono
parents:
diff changeset
43 -- X dependency-number filename
kono
parents:
diff changeset
44
kono
parents:
diff changeset
45 -- This header precedes xref information (entities/references from
kono
parents:
diff changeset
46 -- the unit), identified by dependency number and file name. The
kono
parents:
diff changeset
47 -- dependency number is the index into the generated D lines and
kono
parents:
diff changeset
48 -- is ones origin (e.g. 2 = reference to second generated D line).
kono
parents:
diff changeset
49
kono
parents:
diff changeset
50 -- Note that the filename here will reflect the original name if
kono
parents:
diff changeset
51 -- a Source_Reference pragma was encountered (since all line number
kono
parents:
diff changeset
52 -- references will be with respect to the original file).
kono
parents:
diff changeset
53
kono
parents:
diff changeset
54 -- The lines following the header look like
kono
parents:
diff changeset
55
kono
parents:
diff changeset
56 -- line type col level entity renameref instref typeref overref ref ref
kono
parents:
diff changeset
57
kono
parents:
diff changeset
58 -- line is the line number of the referenced entity. The name of
kono
parents:
diff changeset
59 -- the entity starts in column col. Columns are numbered from one,
kono
parents:
diff changeset
60 -- and if horizontal tab characters are present, the column number
kono
parents:
diff changeset
61 -- is computed assuming standard 1,9,17,.. tab stops. For example,
kono
parents:
diff changeset
62 -- if the entity is the first token on the line, and is preceded
kono
parents:
diff changeset
63 -- by space-HT-space, then the column would be column 10.
kono
parents:
diff changeset
64
kono
parents:
diff changeset
65 -- type is a single letter identifying the type of the entity. See
kono
parents:
diff changeset
66 -- next section (Cross-Reference Entity Identifiers) for a full list
kono
parents:
diff changeset
67 -- of the characters used).
kono
parents:
diff changeset
68
kono
parents:
diff changeset
69 -- col is the column number of the referenced entity
kono
parents:
diff changeset
70
kono
parents:
diff changeset
71 -- level is a single character that separates the col and entity
kono
parents:
diff changeset
72 -- fields. It is an asterisk (*) for a top level library entity that
kono
parents:
diff changeset
73 -- is publicly visible, as well for an entity declared in the visible
kono
parents:
diff changeset
74 -- part of a generic package, the plus sign (+) for a C/C++ static
kono
parents:
diff changeset
75 -- entity, and space otherwise.
kono
parents:
diff changeset
76
kono
parents:
diff changeset
77 -- entity is the name of the referenced entity, with casing in
kono
parents:
diff changeset
78 -- the canonical casing for the source file where it is defined.
kono
parents:
diff changeset
79
kono
parents:
diff changeset
80 -- renameref provides information on renaming. If the entity is
kono
parents:
diff changeset
81 -- a package, object or overloadable entity which is declared by
kono
parents:
diff changeset
82 -- a renaming declaration, and the renaming refers to an entity
kono
parents:
diff changeset
83 -- with a simple identifier or expanded name, then renameref has
kono
parents:
diff changeset
84 -- the form:
kono
parents:
diff changeset
85
kono
parents:
diff changeset
86 -- =line:col
kono
parents:
diff changeset
87
kono
parents:
diff changeset
88 -- Here line:col give the reference to the identifier that appears
kono
parents:
diff changeset
89 -- in the renaming declaration. Note that we never need a file entry,
kono
parents:
diff changeset
90 -- since this identifier is always in the current file in which the
kono
parents:
diff changeset
91 -- entity is declared. Currently, renameref appears only for the
kono
parents:
diff changeset
92 -- simple renaming case. If the renaming reference is a complex
kono
parents:
diff changeset
93 -- expressions, then renameref is omitted. Here line/col give
kono
parents:
diff changeset
94 -- line/column as defined above.
kono
parents:
diff changeset
95
kono
parents:
diff changeset
96 -- instref is only present for package and subprogram instances. The
kono
parents:
diff changeset
97 -- information in instref is the location of the point of declaration
kono
parents:
diff changeset
98 -- of the generic parent unit. This part has the form:
kono
parents:
diff changeset
99
kono
parents:
diff changeset
100 -- [file|line]
kono
parents:
diff changeset
101
kono
parents:
diff changeset
102 -- without column information, on the reasonable assumption that
kono
parents:
diff changeset
103 -- there is only one unit per line (the same assumption is made in
kono
parents:
diff changeset
104 -- references to entities declared within instances, see below).
kono
parents:
diff changeset
105
kono
parents:
diff changeset
106 -- typeref is the reference for a related type. This part is
kono
parents:
diff changeset
107 -- optional. It is present for the following cases:
kono
parents:
diff changeset
108
kono
parents:
diff changeset
109 -- derived types (points to the parent type) LR=<>
kono
parents:
diff changeset
110 -- access types (points to designated type) LR=()
kono
parents:
diff changeset
111 -- array types (points to component type) LR=()
kono
parents:
diff changeset
112 -- subtypes (points to ancestor type) LR={}
kono
parents:
diff changeset
113 -- functions (points to result type) LR={}
kono
parents:
diff changeset
114 -- enumeration literals (points to enum type) LR={}
kono
parents:
diff changeset
115 -- objects and components (points to type) LR={}
kono
parents:
diff changeset
116
kono
parents:
diff changeset
117 -- For a type that implements multiple interfaces, there is an
kono
parents:
diff changeset
118 -- entry of the form LR=<> for each of the interfaces appearing
kono
parents:
diff changeset
119 -- in the type declaration. In the data structures of ali.ads,
kono
parents:
diff changeset
120 -- the type that the entity extends (or the first interface if
kono
parents:
diff changeset
121 -- there is no such type) is stored in Xref_Entity_Record.Tref*,
kono
parents:
diff changeset
122 -- additional interfaces are stored in the list of references
kono
parents:
diff changeset
123 -- with a special type of Interface_Reference.
kono
parents:
diff changeset
124
kono
parents:
diff changeset
125 -- For an array type, there is an entry of the form LR=<> for each
kono
parents:
diff changeset
126 -- of the index types appearing in the type declaration. The index
kono
parents:
diff changeset
127 -- types follow the entry for the component type. In the data
kono
parents:
diff changeset
128 -- structures of ali.ads, however, the list of index types are
kono
parents:
diff changeset
129 -- output in the list of references with a special Rtype set to
kono
parents:
diff changeset
130 -- Array_Index_Reference.
kono
parents:
diff changeset
131
kono
parents:
diff changeset
132 -- In the above list LR shows the brackets used in the output which
kono
parents:
diff changeset
133 -- has one of the two following forms:
kono
parents:
diff changeset
134
kono
parents:
diff changeset
135 -- L file | line type col R user entity
kono
parents:
diff changeset
136 -- L name-in-lower-case R standard entity
kono
parents:
diff changeset
137
kono
parents:
diff changeset
138 -- For the form for a user entity, file is the dependency number
kono
parents:
diff changeset
139 -- of the file containing the declaration of the related type.
kono
parents:
diff changeset
140 -- This number and the following vertical bar are omitted if the
kono
parents:
diff changeset
141 -- relevant type is defined in the same file as the current entity.
kono
parents:
diff changeset
142 -- The line, type, col are defined as previously described, and
kono
parents:
diff changeset
143 -- specify the location of the relevant type declaration in the
kono
parents:
diff changeset
144 -- referenced file. For the standard entity form, the name between
kono
parents:
diff changeset
145 -- the brackets is the normal name of the entity in lower case.
kono
parents:
diff changeset
146
kono
parents:
diff changeset
147 -- overref is present for overriding operations (procedures and
kono
parents:
diff changeset
148 -- functions), and provides information on the operation that it
kono
parents:
diff changeset
149 -- overrides. This information has the format:
kono
parents:
diff changeset
150
kono
parents:
diff changeset
151 -- '<' file | line 'o' col '>'
kono
parents:
diff changeset
152
kono
parents:
diff changeset
153 -- file is the dependency number of the file containing the
kono
parents:
diff changeset
154 -- declaration of the overridden operation. It and the following
kono
parents:
diff changeset
155 -- vertical bar are omitted if the file is the same as that of
kono
parents:
diff changeset
156 -- the overriding operation.
kono
parents:
diff changeset
157
kono
parents:
diff changeset
158 -- There may be zero or more ref entries on each line
kono
parents:
diff changeset
159
kono
parents:
diff changeset
160 -- file | line type col [...]
kono
parents:
diff changeset
161
kono
parents:
diff changeset
162 -- file is the dependency number of the file with the reference.
kono
parents:
diff changeset
163 -- It and the following vertical bar are omitted if the file is
kono
parents:
diff changeset
164 -- the same as the previous ref, and the refs for the current
kono
parents:
diff changeset
165 -- file are first (and do not need a bar).
kono
parents:
diff changeset
166
kono
parents:
diff changeset
167 -- line is the line number of the reference
kono
parents:
diff changeset
168
kono
parents:
diff changeset
169 -- col is the column number of the reference, as defined above
kono
parents:
diff changeset
170
kono
parents:
diff changeset
171 -- type is one of
kono
parents:
diff changeset
172 -- b = body entity
kono
parents:
diff changeset
173 -- c = completion of private or incomplete type
kono
parents:
diff changeset
174 -- d = discriminant of type
kono
parents:
diff changeset
175 -- D = object definition
kono
parents:
diff changeset
176 -- e = end of spec
kono
parents:
diff changeset
177 -- E = first private entity
kono
parents:
diff changeset
178 -- H = abstract type
kono
parents:
diff changeset
179 -- i = implicit reference
kono
parents:
diff changeset
180 -- k = implicit reference to parent unit in child unit
kono
parents:
diff changeset
181 -- l = label on END line
kono
parents:
diff changeset
182 -- m = modification
kono
parents:
diff changeset
183 -- o = own variable reference (SPARK only)
kono
parents:
diff changeset
184 -- p = primitive operation
kono
parents:
diff changeset
185 -- P = overriding primitive operation
kono
parents:
diff changeset
186 -- r = reference
kono
parents:
diff changeset
187 -- R = subprogram reference in dispatching call
kono
parents:
diff changeset
188 -- s = subprogram reference in a static call
kono
parents:
diff changeset
189 -- t = end of body
kono
parents:
diff changeset
190 -- w = WITH line
kono
parents:
diff changeset
191 -- x = type extension
kono
parents:
diff changeset
192 -- z = generic formal parameter
kono
parents:
diff changeset
193 -- > = subprogram IN parameter
kono
parents:
diff changeset
194 -- = = subprogram IN OUT parameter
kono
parents:
diff changeset
195 -- < = subprogram OUT parameter
kono
parents:
diff changeset
196 -- ^ = subprogram ACCESS parameter
kono
parents:
diff changeset
197
kono
parents:
diff changeset
198 -- b is used for spec entities that are repeated in a body,
kono
parents:
diff changeset
199 -- including the unit (subprogram, package, task, protected body,
kono
parents:
diff changeset
200 -- protected entry) name itself, and in the case of a subprogram,
kono
parents:
diff changeset
201 -- the formals. This letter is also used for the occurrence of
kono
parents:
diff changeset
202 -- entry names in accept statements. Such entities are not
kono
parents:
diff changeset
203 -- considered to be definitions for cross-referencing purposes,
kono
parents:
diff changeset
204 -- but rather are considered to be references to the corresponding
kono
parents:
diff changeset
205 -- spec entities, marked with this special type.
kono
parents:
diff changeset
206
kono
parents:
diff changeset
207 -- c is similar to b but is used to mark the completion of a
kono
parents:
diff changeset
208 -- private or incomplete type. As with b, the completion is not
kono
parents:
diff changeset
209 -- regarded as a separate definition, but rather a reference to
kono
parents:
diff changeset
210 -- the initial declaration, marked with this special type.
kono
parents:
diff changeset
211
kono
parents:
diff changeset
212 -- d is used to identify a discriminant of a type. If this is
kono
parents:
diff changeset
213 -- an incomplete or private type with discriminants, the entry
kono
parents:
diff changeset
214 -- denotes the occurrence of the discriminant in the partial view
kono
parents:
diff changeset
215 -- which is also the point of definition of the discriminant. The
kono
parents:
diff changeset
216 -- occurrence of the same discriminant in the full view is a
kono
parents:
diff changeset
217 -- regular reference to it.
kono
parents:
diff changeset
218
kono
parents:
diff changeset
219 -- e is used to identify the end of a construct in the following
kono
parents:
diff changeset
220 -- cases:
kono
parents:
diff changeset
221
kono
parents:
diff changeset
222 -- Block Statement end [block_IDENTIFIER];
kono
parents:
diff changeset
223 -- Loop Statement end loop [loop_IDENTIFIER];
kono
parents:
diff changeset
224 -- Package Specification end [[PARENT_UNIT_NAME .] IDENTIFIER];
kono
parents:
diff changeset
225 -- Task Definition end [task_IDENTIFIER];
kono
parents:
diff changeset
226 -- Protected Definition end [protected_IDENTIFIER];
kono
parents:
diff changeset
227 -- Record Definition end record;
kono
parents:
diff changeset
228 -- Enumeration Definition );
kono
parents:
diff changeset
229
kono
parents:
diff changeset
230 -- Note that 'e' entries are special in that they appear even
kono
parents:
diff changeset
231 -- in referencing units (normally xref entries appear only for
kono
parents:
diff changeset
232 -- references in the extended main source unit (see Lib) to which
kono
parents:
diff changeset
233 -- the ali applies. But 'e' entries are really structural and
kono
parents:
diff changeset
234 -- simply indicate where packages end. This information can be
kono
parents:
diff changeset
235 -- used to reconstruct scope information for any entities
kono
parents:
diff changeset
236 -- referenced from within the package. The line/column values
kono
parents:
diff changeset
237 -- for these entries point to the semicolon ending the construct.
kono
parents:
diff changeset
238
kono
parents:
diff changeset
239 -- i is used to identify a reference to the entity in a generic
kono
parents:
diff changeset
240 -- actual or in a default in a call. The node that denotes the
kono
parents:
diff changeset
241 -- entity does not come from source, but it has the Sloc of the
kono
parents:
diff changeset
242 -- source node that generates the implicit reference, and it is
kono
parents:
diff changeset
243 -- useful to record this one.
kono
parents:
diff changeset
244
kono
parents:
diff changeset
245 -- k is another non-standard reference type, used to record a
kono
parents:
diff changeset
246 -- reference from a child unit to its parent. For various cross-
kono
parents:
diff changeset
247 -- referencing tools, we need a pointer from the xref entries for
kono
parents:
diff changeset
248 -- the child to the parent. This is the opposite way round from
kono
parents:
diff changeset
249 -- normal xref entries, since the reference is *from* the child
kono
parents:
diff changeset
250 -- unit *to* the parent unit, yet appears in the xref entries for
kono
parents:
diff changeset
251 -- the child. Consider this example:
kono
parents:
diff changeset
252 --
kono
parents:
diff changeset
253 -- package q is
kono
parents:
diff changeset
254 -- end;
kono
parents:
diff changeset
255 -- package q.r is
kono
parents:
diff changeset
256 -- end q.r;
kono
parents:
diff changeset
257 --
kono
parents:
diff changeset
258 -- The ali file for q-r.ads has these entries
kono
parents:
diff changeset
259 --
kono
parents:
diff changeset
260 -- D q.ads
kono
parents:
diff changeset
261 -- D q-r.ads
kono
parents:
diff changeset
262 -- D system.ads
kono
parents:
diff changeset
263 -- X 1 q.ads
kono
parents:
diff changeset
264 -- 1K9*q 2e4 2|1r9 2r5
kono
parents:
diff changeset
265 -- X 2 q-r.ads
kono
parents:
diff changeset
266 -- 1K11*r 1|1k9 2|2l7 2e8
kono
parents:
diff changeset
267 --
kono
parents:
diff changeset
268 -- Here the 2|1r9 entry appearing in the section for the parent
kono
parents:
diff changeset
269 -- is the normal reference from the child to the parent. The 1k9
kono
parents:
diff changeset
270 -- entry in the section for the child duplicates this information
kono
parents:
diff changeset
271 -- but appears in the child rather than the parent.
kono
parents:
diff changeset
272
kono
parents:
diff changeset
273 -- l is used to identify the occurrence in the source of the name
kono
parents:
diff changeset
274 -- on an end line. This is just a syntactic reference which can be
kono
parents:
diff changeset
275 -- ignored for semantic purposes (e.g. a call graph construction).
kono
parents:
diff changeset
276 -- Again, in the case of an accept there can be multiple l lines.
kono
parents:
diff changeset
277
kono
parents:
diff changeset
278 -- o is used for variables referenced from a SPARK 'own'
kono
parents:
diff changeset
279 -- definition. In the SPARK language, it is allowed to use a
kono
parents:
diff changeset
280 -- variable before its actual declaration.
kono
parents:
diff changeset
281
kono
parents:
diff changeset
282 -- p is used to mark a primitive operation of the given entity.
kono
parents:
diff changeset
283 -- For example, if we have a type Tx, and a primitive operation
kono
parents:
diff changeset
284 -- Pq of this type, then an entry in the list of references to
kono
parents:
diff changeset
285 -- Tx will point to the declaration of Pq. Note that this entry
kono
parents:
diff changeset
286 -- type is unusual because it an implicit rather than explicit,
kono
parents:
diff changeset
287 -- and the name of the reference does not match the name of the
kono
parents:
diff changeset
288 -- entity for which a reference is generated. These entries are
kono
parents:
diff changeset
289 -- generated only for entities declared in the extended main
kono
parents:
diff changeset
290 -- source unit (main unit itself, its separate spec (if any).
kono
parents:
diff changeset
291 -- and all subunits (considered recursively).
kono
parents:
diff changeset
292
kono
parents:
diff changeset
293 -- If the primitive operation overrides an inherited primitive
kono
parents:
diff changeset
294 -- operation of the parent type, the letter 'P' is used in the
kono
parents:
diff changeset
295 -- corresponding entry.
kono
parents:
diff changeset
296
kono
parents:
diff changeset
297 -- R is used to mark a dispatching call. The reference is to
kono
parents:
diff changeset
298 -- the specification of the primitive operation of the root
kono
parents:
diff changeset
299 -- type when the call has a controlling argument in its class.
kono
parents:
diff changeset
300
kono
parents:
diff changeset
301 -- s is used to mark a static subprogram call. The reference is
kono
parents:
diff changeset
302 -- to the specification of the subprogram being called.
kono
parents:
diff changeset
303
kono
parents:
diff changeset
304 -- t is similar to e. It identifies the end of a corresponding
kono
parents:
diff changeset
305 -- body (such a reference always links up with a b reference)
kono
parents:
diff changeset
306
kono
parents:
diff changeset
307 -- Subprogram Body end [DESIGNATOR];
kono
parents:
diff changeset
308 -- Package Body end [[PARENT_UNIT_NAME .] IDENTIFIER];
kono
parents:
diff changeset
309 -- Task Body end [task_IDENTIFIER];
kono
parents:
diff changeset
310 -- Entry Body end [entry_IDENTIFIER];
kono
parents:
diff changeset
311 -- Protected Body end [protected_IDENTIFIER]
kono
parents:
diff changeset
312 -- Accept Statement end [entry_IDENTIFIER]];
kono
parents:
diff changeset
313
kono
parents:
diff changeset
314 -- Note that in the case of accept statements, there can
kono
parents:
diff changeset
315 -- be multiple b and t entries for the same entity.
kono
parents:
diff changeset
316
kono
parents:
diff changeset
317 -- x is used to identify the reference as the entity from which a
kono
parents:
diff changeset
318 -- tagged type is extended. This allows immediate access to the
kono
parents:
diff changeset
319 -- parent of a tagged type.
kono
parents:
diff changeset
320
kono
parents:
diff changeset
321 -- z is used on the cross-reference line for a generic unit,
kono
parents:
diff changeset
322 -- to mark the definition of a generic formal of the unit. This
kono
parents:
diff changeset
323 -- entry type is similar to 'k' and 'p' in that it is an implicit
kono
parents:
diff changeset
324 -- reference for an entity with a different name.
kono
parents:
diff changeset
325
kono
parents:
diff changeset
326 -- The characters >, <. =, and ^ are used on the cross-reference
kono
parents:
diff changeset
327 -- line for a subprogram, to denote formal parameters and their
kono
parents:
diff changeset
328 -- modes. As with the 'z' and 'p' entries, each such entry is
kono
parents:
diff changeset
329 -- an implicit reference to an entity with a different name.
kono
parents:
diff changeset
330
kono
parents:
diff changeset
331 -- [..] is used for generic instantiation references. These
kono
parents:
diff changeset
332 -- references are present only if the entity in question is
kono
parents:
diff changeset
333 -- a generic entity, and in that case the [..] contains the
kono
parents:
diff changeset
334 -- reference for the instantiation. In the case of nested
kono
parents:
diff changeset
335 -- instantiations, this can be nested [...[...[...]]] etc. The
kono
parents:
diff changeset
336 -- reference is of the form [file|line] no column is present since
kono
parents:
diff changeset
337 -- it is assumed that only one instantiation appears on a single
kono
parents:
diff changeset
338 -- source line. Note that the appearance of file numbers in such
kono
parents:
diff changeset
339 -- references follows the normal rules (present only if needed,
kono
parents:
diff changeset
340 -- and resets the current file for subsequent references).
kono
parents:
diff changeset
341
kono
parents:
diff changeset
342 -- Examples:
kono
parents:
diff changeset
343
kono
parents:
diff changeset
344 -- 44B5*Flag_Type{boolean} 5r23 6m45 3|9r35 11r56
kono
parents:
diff changeset
345
kono
parents:
diff changeset
346 -- This line gives references for the publicly visible Boolean
kono
parents:
diff changeset
347 -- type Flag_Type declared on line 44, column 5. There are four
kono
parents:
diff changeset
348 -- references
kono
parents:
diff changeset
349
kono
parents:
diff changeset
350 -- a reference on line 5, column 23 of the current file
kono
parents:
diff changeset
351
kono
parents:
diff changeset
352 -- a modification on line 6, column 45 of the current file
kono
parents:
diff changeset
353
kono
parents:
diff changeset
354 -- a reference on line 9, column 35 of unit number 3
kono
parents:
diff changeset
355
kono
parents:
diff changeset
356 -- a reference on line 11, column 56 of unit number 3
kono
parents:
diff changeset
357
kono
parents:
diff changeset
358 -- 2U13 p3=2:35 5b13 8r4 12r13 12t15
kono
parents:
diff changeset
359
kono
parents:
diff changeset
360 -- This line gives references for the non-publicly visible
kono
parents:
diff changeset
361 -- procedure p3 declared on line 2, column 13. This procedure
kono
parents:
diff changeset
362 -- renames the procedure whose identifier reference is at
kono
parents:
diff changeset
363 -- line 2 column 35. There are four references:
kono
parents:
diff changeset
364
kono
parents:
diff changeset
365 -- the corresponding body entity at line 5, column 13,
kono
parents:
diff changeset
366 -- of the current file.
kono
parents:
diff changeset
367
kono
parents:
diff changeset
368 -- a reference (e.g. a call) at line 8 column 4 of the
kono
parents:
diff changeset
369 -- current file.
kono
parents:
diff changeset
370
kono
parents:
diff changeset
371 -- the END line of the body has an explicit reference to
kono
parents:
diff changeset
372 -- the name of the procedure at line 12, column 13.
kono
parents:
diff changeset
373
kono
parents:
diff changeset
374 -- the body ends at line 12, column 15, just past this label
kono
parents:
diff changeset
375
kono
parents:
diff changeset
376 -- 16I9*My_Type<2|4I9> 18r8
kono
parents:
diff changeset
377
kono
parents:
diff changeset
378 -- This line gives references for the publicly visible Integer
kono
parents:
diff changeset
379 -- derived type My_Type declared on line 16, column 9. It also
kono
parents:
diff changeset
380 -- gives references to the parent type declared in the unit
kono
parents:
diff changeset
381 -- number 2 on line 4, column 9. There is one reference:
kono
parents:
diff changeset
382
kono
parents:
diff changeset
383 -- a reference (e.g. a variable declaration) at line 18 column
kono
parents:
diff changeset
384 -- 4 of the current file.
kono
parents:
diff changeset
385
kono
parents:
diff changeset
386 -- 10I3*Genv{integer} 3|4I10[6|12]
kono
parents:
diff changeset
387
kono
parents:
diff changeset
388 -- This line gives a reference for the entity Genv in a generic
kono
parents:
diff changeset
389 -- package. The reference in file 3, line 4, col 10, refers to an
kono
parents:
diff changeset
390 -- instance of the generic where the instantiation can be found in
kono
parents:
diff changeset
391 -- file 6 at line 12.
kono
parents:
diff changeset
392
kono
parents:
diff changeset
393 -- Continuation lines are used if the reference list gets too long,
kono
parents:
diff changeset
394 -- a continuation line starts with a period, and then has references
kono
parents:
diff changeset
395 -- continuing from the previous line. The references are sorted first
kono
parents:
diff changeset
396 -- by unit, then by position in the source.
kono
parents:
diff changeset
397
kono
parents:
diff changeset
398 -- Note on handling of generic entities. The cross-reference is oriented
kono
parents:
diff changeset
399 -- towards source references, so the entities in a generic instantiation
kono
parents:
diff changeset
400 -- are not considered distinct from the entities in the template. All
kono
parents:
diff changeset
401 -- definitions and references from generic instantiations are suppressed,
kono
parents:
diff changeset
402 -- since they will be generated from the template. Any references to
kono
parents:
diff changeset
403 -- entities in a generic instantiation from outside the instantiation
kono
parents:
diff changeset
404 -- are considered to be references to the original template entity.
kono
parents:
diff changeset
405
kono
parents:
diff changeset
406 ----------------------------------------
kono
parents:
diff changeset
407 -- Cross-Reference Entity Identifiers --
kono
parents:
diff changeset
408 ----------------------------------------
kono
parents:
diff changeset
409
kono
parents:
diff changeset
410 -- In the cross-reference section of the ali file, entity types are
kono
parents:
diff changeset
411 -- identified by a single letter, indicating the entity type. The following
kono
parents:
diff changeset
412 -- table indicates the letter. A space for an entry is used for entities
kono
parents:
diff changeset
413 -- that do not appear in the cross-reference table.
kono
parents:
diff changeset
414
kono
parents:
diff changeset
415 -- For objects, the character * appears in this table. In the xref listing,
kono
parents:
diff changeset
416 -- this character is replaced by the lower case letter that corresponds to
kono
parents:
diff changeset
417 -- the type of the object. For example, if a variable is of a Float type,
kono
parents:
diff changeset
418 -- then, since the type is represented by an upper case F, the object would
kono
parents:
diff changeset
419 -- be represented by a lower case f.
kono
parents:
diff changeset
420
kono
parents:
diff changeset
421 -- A special exception is the case of booleans, whose entities are normal
kono
parents:
diff changeset
422 -- E_Enumeration_Type or E_Enumeration_Subtype entities, but which appear
kono
parents:
diff changeset
423 -- as B/b in the xref lines, rather than E/e.
kono
parents:
diff changeset
424
kono
parents:
diff changeset
425 -- For private types, the character + appears in the table. In this case
kono
parents:
diff changeset
426 -- the kind of the underlying type is used, if available, to determine the
kono
parents:
diff changeset
427 -- character to use in the xref listing. The listing will still include a
kono
parents:
diff changeset
428 -- '+' for a generic private type, for example, but will retain the '*' for
kono
parents:
diff changeset
429 -- an object or formal parameter of such a type.
kono
parents:
diff changeset
430
kono
parents:
diff changeset
431 -- For subprograms, the characters 'U' and 'V' appear in the table,
kono
parents:
diff changeset
432 -- indicating procedures and functions. If the operation is abstract,
kono
parents:
diff changeset
433 -- these letters are replaced in the xref by 'x' and 'y' respectively.
kono
parents:
diff changeset
434
kono
parents:
diff changeset
435 Xref_Entity_Letters : constant array (Entity_Kind) of Character :=
kono
parents:
diff changeset
436 (E_Abstract_State => '@',
kono
parents:
diff changeset
437 E_Access_Attribute_Type => 'P',
kono
parents:
diff changeset
438 E_Access_Protected_Subprogram_Type => 'P',
kono
parents:
diff changeset
439 E_Access_Subprogram_Type => 'P',
kono
parents:
diff changeset
440 E_Access_Subtype => 'P',
kono
parents:
diff changeset
441 E_Access_Type => 'P',
kono
parents:
diff changeset
442 E_Allocator_Type => ' ',
kono
parents:
diff changeset
443 E_Anonymous_Access_Protected_Subprogram_Type => ' ',
kono
parents:
diff changeset
444 E_Anonymous_Access_Subprogram_Type => ' ',
kono
parents:
diff changeset
445 E_Anonymous_Access_Type => ' ',
kono
parents:
diff changeset
446 E_Array_Subtype => 'A',
kono
parents:
diff changeset
447 E_Array_Type => 'A',
kono
parents:
diff changeset
448 E_Block => 'q',
kono
parents:
diff changeset
449 E_Class_Wide_Subtype => 'C',
kono
parents:
diff changeset
450 E_Class_Wide_Type => 'C',
kono
parents:
diff changeset
451 E_Component => '*',
kono
parents:
diff changeset
452 E_Constant => '*',
kono
parents:
diff changeset
453 E_Decimal_Fixed_Point_Subtype => 'D',
kono
parents:
diff changeset
454 E_Decimal_Fixed_Point_Type => 'D',
kono
parents:
diff changeset
455 E_Discriminant => '*',
kono
parents:
diff changeset
456 E_Entry => 'Y',
kono
parents:
diff changeset
457 E_Entry_Family => 'Y',
kono
parents:
diff changeset
458 E_Entry_Index_Parameter => '*',
kono
parents:
diff changeset
459 E_Enumeration_Literal => 'n',
kono
parents:
diff changeset
460 E_Enumeration_Subtype => 'E', -- B for boolean
kono
parents:
diff changeset
461 E_Enumeration_Type => 'E', -- B for boolean
kono
parents:
diff changeset
462 E_Exception => 'X',
kono
parents:
diff changeset
463 E_Exception_Type => ' ',
kono
parents:
diff changeset
464 E_Floating_Point_Subtype => 'F',
kono
parents:
diff changeset
465 E_Floating_Point_Type => 'F',
kono
parents:
diff changeset
466 E_Function => 'V',
kono
parents:
diff changeset
467 E_General_Access_Type => 'P',
kono
parents:
diff changeset
468 E_Generic_Function => 'v',
kono
parents:
diff changeset
469 E_Generic_In_Out_Parameter => '*',
kono
parents:
diff changeset
470 E_Generic_In_Parameter => '*',
kono
parents:
diff changeset
471 E_Generic_Package => 'k',
kono
parents:
diff changeset
472 E_Generic_Procedure => 'u',
kono
parents:
diff changeset
473 E_Label => 'L',
kono
parents:
diff changeset
474 E_Limited_Private_Subtype => '+',
kono
parents:
diff changeset
475 E_Limited_Private_Type => '+',
kono
parents:
diff changeset
476 E_Loop => 'l',
kono
parents:
diff changeset
477 E_Loop_Parameter => '*',
kono
parents:
diff changeset
478 E_In_Out_Parameter => '*',
kono
parents:
diff changeset
479 E_In_Parameter => '*',
kono
parents:
diff changeset
480 E_Incomplete_Subtype => '+',
kono
parents:
diff changeset
481 E_Incomplete_Type => '+',
kono
parents:
diff changeset
482 E_Modular_Integer_Subtype => 'M',
kono
parents:
diff changeset
483 E_Modular_Integer_Type => 'M',
kono
parents:
diff changeset
484 E_Named_Integer => 'N',
kono
parents:
diff changeset
485 E_Named_Real => 'N',
kono
parents:
diff changeset
486 E_Operator => 'V',
kono
parents:
diff changeset
487 E_Ordinary_Fixed_Point_Subtype => 'O',
kono
parents:
diff changeset
488 E_Ordinary_Fixed_Point_Type => 'O',
kono
parents:
diff changeset
489 E_Out_Parameter => '*',
kono
parents:
diff changeset
490 E_Package => 'K',
kono
parents:
diff changeset
491 E_Private_Subtype => '+',
kono
parents:
diff changeset
492 E_Private_Type => '+',
kono
parents:
diff changeset
493 E_Procedure => 'U',
kono
parents:
diff changeset
494 E_Protected_Subtype => 'W',
kono
parents:
diff changeset
495 E_Protected_Type => 'W',
kono
parents:
diff changeset
496 E_Record_Subtype => 'R',
kono
parents:
diff changeset
497 E_Record_Subtype_With_Private => 'R',
kono
parents:
diff changeset
498 E_Record_Type => 'R',
kono
parents:
diff changeset
499 E_Record_Type_With_Private => 'R',
kono
parents:
diff changeset
500 E_Return_Statement => ' ',
kono
parents:
diff changeset
501 E_Signed_Integer_Subtype => 'I',
kono
parents:
diff changeset
502 E_Signed_Integer_Type => 'I',
kono
parents:
diff changeset
503 E_String_Literal_Subtype => ' ',
kono
parents:
diff changeset
504 E_Subprogram_Type => ' ',
kono
parents:
diff changeset
505 E_Task_Subtype => 'T',
kono
parents:
diff changeset
506 E_Task_Type => 'T',
kono
parents:
diff changeset
507 E_Variable => '*',
kono
parents:
diff changeset
508 E_Void => ' ',
kono
parents:
diff changeset
509
kono
parents:
diff changeset
510 -- The following entities are not ones to which we gather the cross-
kono
parents:
diff changeset
511 -- references, since it does not make sense to do so (e.g. references
kono
parents:
diff changeset
512 -- to a package are to the spec, not the body). Indeed the occurrence of
kono
parents:
diff changeset
513 -- the body entity is considered to be a reference to the spec entity.
kono
parents:
diff changeset
514
kono
parents:
diff changeset
515 E_Package_Body => ' ',
kono
parents:
diff changeset
516 E_Protected_Body => ' ',
kono
parents:
diff changeset
517 E_Protected_Object => ' ',
kono
parents:
diff changeset
518 E_Subprogram_Body => ' ',
kono
parents:
diff changeset
519 E_Task_Body => ' ');
kono
parents:
diff changeset
520
kono
parents:
diff changeset
521 -- The following table is for information purposes. It shows the use of
kono
parents:
diff changeset
522 -- each character appearing as an entity type.
kono
parents:
diff changeset
523
kono
parents:
diff changeset
524 -- letter lower case usage UPPER CASE USAGE
kono
parents:
diff changeset
525
kono
parents:
diff changeset
526 -- a array object (except string) array type (except string)
kono
parents:
diff changeset
527 -- b Boolean object Boolean type
kono
parents:
diff changeset
528 -- c class-wide object class-wide type
kono
parents:
diff changeset
529 -- d decimal fixed-point object decimal fixed-point type
kono
parents:
diff changeset
530 -- e non-Boolean enumeration object non_Boolean enumeration type
kono
parents:
diff changeset
531 -- f floating-point object floating-point type
kono
parents:
diff changeset
532 -- g C/C++ macro C/C++ fun-like macro
kono
parents:
diff changeset
533 -- h Interface (Ada 2005) Abstract type
kono
parents:
diff changeset
534 -- i signed integer object signed integer type
kono
parents:
diff changeset
535 -- j C++ class object C++ class
kono
parents:
diff changeset
536 -- k generic package package
kono
parents:
diff changeset
537 -- l label on loop label on statement
kono
parents:
diff changeset
538 -- m modular integer object modular integer type
kono
parents:
diff changeset
539 -- n enumeration literal named number
kono
parents:
diff changeset
540 -- o ordinary fixed-point object ordinary fixed-point type
kono
parents:
diff changeset
541 -- p access object access type
kono
parents:
diff changeset
542 -- q label on block C/C++ include file
kono
parents:
diff changeset
543 -- r record object record type
kono
parents:
diff changeset
544 -- s string object string type
kono
parents:
diff changeset
545 -- t task object task type
kono
parents:
diff changeset
546 -- u generic procedure procedure
kono
parents:
diff changeset
547 -- v generic function or operator function or operator
kono
parents:
diff changeset
548 -- w protected object protected type
kono
parents:
diff changeset
549 -- x abstract procedure exception
kono
parents:
diff changeset
550 -- y abstract function entry or entry family
kono
parents:
diff changeset
551 -- z generic formal parameter (unused)
kono
parents:
diff changeset
552
kono
parents:
diff changeset
553 ---------------------------------------------------
kono
parents:
diff changeset
554 -- Handling of Imported and Exported Subprograms --
kono
parents:
diff changeset
555 ---------------------------------------------------
kono
parents:
diff changeset
556
kono
parents:
diff changeset
557 -- If a pragma Import or Interface applies to a subprogram, the pragma is
kono
parents:
diff changeset
558 -- the completion of the subprogram. This is noted in the ALI file by
kono
parents:
diff changeset
559 -- making the occurrence of the subprogram in the pragma into a body
kono
parents:
diff changeset
560 -- reference ('b') and by including the external name of the subprogram and
kono
parents:
diff changeset
561 -- its language, bracketed by '<' and '>' in that reference. For example:
kono
parents:
diff changeset
562
kono
parents:
diff changeset
563 -- 3U13*imported_proc 4b<c,there>21
kono
parents:
diff changeset
564
kono
parents:
diff changeset
565 -- indicates that procedure imported_proc, declared at line 3, has a pragma
kono
parents:
diff changeset
566 -- Import at line 4, that its body is in C, and that the link name as given
kono
parents:
diff changeset
567 -- in the pragma is "there".
kono
parents:
diff changeset
568
kono
parents:
diff changeset
569 -- If a pragma Export applies to a subprogram exported to a foreign
kono
parents:
diff changeset
570 -- language (ie. the pragma has convention different from Ada), then the
kono
parents:
diff changeset
571 -- pragma is annotated in the ALI file by making the occurrence of the
kono
parents:
diff changeset
572 -- subprogram in the pragma into an implicit reference ('i') and by
kono
parents:
diff changeset
573 -- including the external name of the subprogram and its language,
kono
parents:
diff changeset
574 -- bracketed by '<' and '>' in that reference. For example:
kono
parents:
diff changeset
575
kono
parents:
diff changeset
576 -- 3U13*exported_proc 4i<c,here>21
kono
parents:
diff changeset
577
kono
parents:
diff changeset
578 -- indicates that procedure exported_proc, declared at line 3, has a pragma
kono
parents:
diff changeset
579 -- Export at line 4, that its body is exported to C, and that the link name
kono
parents:
diff changeset
580 -- as given in the pragma is "here".
kono
parents:
diff changeset
581
kono
parents:
diff changeset
582 -------------------------
kono
parents:
diff changeset
583 -- Deferred_References --
kono
parents:
diff changeset
584 -------------------------
kono
parents:
diff changeset
585
kono
parents:
diff changeset
586 -- Normally we generate references as we go along, but as discussed in
kono
parents:
diff changeset
587 -- Sem_Util.Is_LHS, and Sem_Ch8.Find_Direct_Name/Find_Selected_Component,
kono
parents:
diff changeset
588 -- we have one case where that is tricky, which is when we have something
kono
parents:
diff changeset
589 -- like X.A := 3, where we don't know until we know the type of X whether
kono
parents:
diff changeset
590 -- this is a reference (if X is an access type, so what we really have is
kono
parents:
diff changeset
591 -- X.all.A := 3) or a modification, where X is not an access type.
kono
parents:
diff changeset
592
kono
parents:
diff changeset
593 -- What we do in such cases is to gather nodes, where we would have liked
kono
parents:
diff changeset
594 -- to call Generate_Reference but we couldn't because we didn't know enough
kono
parents:
diff changeset
595 -- into this table, Then we deal with generating references later on when
kono
parents:
diff changeset
596 -- we have sufficient information to do it right.
kono
parents:
diff changeset
597
kono
parents:
diff changeset
598 type Deferred_Reference_Entry is record
kono
parents:
diff changeset
599 E : Entity_Id;
kono
parents:
diff changeset
600 N : Node_Id;
kono
parents:
diff changeset
601 end record;
kono
parents:
diff changeset
602 -- One entry, E, N are as required for Generate_Reference call
kono
parents:
diff changeset
603
kono
parents:
diff changeset
604 package Deferred_References is new Table.Table (
kono
parents:
diff changeset
605 Table_Component_Type => Deferred_Reference_Entry,
kono
parents:
diff changeset
606 Table_Index_Type => Int,
kono
parents:
diff changeset
607 Table_Low_Bound => 0,
kono
parents:
diff changeset
608 Table_Initial => 512,
kono
parents:
diff changeset
609 Table_Increment => 200,
kono
parents:
diff changeset
610 Table_Name => "Name_Deferred_References");
kono
parents:
diff changeset
611
kono
parents:
diff changeset
612 procedure Process_Deferred_References;
kono
parents:
diff changeset
613 -- This procedure is called from Frontend to process these table entries.
kono
parents:
diff changeset
614 -- It is also called from Sem_Warn.
kono
parents:
diff changeset
615
kono
parents:
diff changeset
616 function Has_Deferred_Reference (Ent : Entity_Id) return Boolean;
kono
parents:
diff changeset
617 -- Determine whether arbitrary entity Ent has a pending reference in order
kono
parents:
diff changeset
618 -- to suppress premature warnings about useless assignments. See comments
kono
parents:
diff changeset
619 -- in Analyze_Assignment in sem_ch5.adb.
kono
parents:
diff changeset
620
kono
parents:
diff changeset
621 -----------------------------
kono
parents:
diff changeset
622 -- SPARK Xrefs Information --
kono
parents:
diff changeset
623 -----------------------------
kono
parents:
diff changeset
624
kono
parents:
diff changeset
625 -- This package defines procedures for collecting SPARK cross-reference
kono
parents:
diff changeset
626 -- information and printing in ALI files.
kono
parents:
diff changeset
627
kono
parents:
diff changeset
628 package SPARK_Specific is
kono
parents:
diff changeset
629
kono
parents:
diff changeset
630 function Enclosing_Subprogram_Or_Library_Package
kono
parents:
diff changeset
631 (N : Node_Id) return Entity_Id;
kono
parents:
diff changeset
632 -- Return the closest enclosing subprogram or library-level package.
kono
parents:
diff changeset
633 -- This ensures that GNATprove can distinguish local variables from
kono
parents:
diff changeset
634 -- global variables.
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
635 --
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
636 -- ??? This routine should only be used for processing related to
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
637 -- cross-references, where it might return wrong result but must avoid
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
638 -- crashes on ill-formed source code. It is wrong to use it where exact
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
639 -- result is needed.
111
kono
parents:
diff changeset
640
kono
parents:
diff changeset
641 procedure Generate_Dereference
kono
parents:
diff changeset
642 (N : Node_Id;
kono
parents:
diff changeset
643 Typ : Character := 'r');
kono
parents:
diff changeset
644 -- This procedure is called to record a dereference. N is the location
kono
parents:
diff changeset
645 -- of the dereference.
kono
parents:
diff changeset
646
kono
parents:
diff changeset
647 generic
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
648 with procedure Process
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
649 (Index : Int;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
650 Xref : SPARK_Xrefs.SPARK_Xref_Record);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
651 procedure Iterate_SPARK_Xrefs;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
652 -- Call Process on cross-references relevant to the SPARK backend with
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
653 -- parameter Xref holding the relevant subset of the xref entry and
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
654 -- Index holding the position in the original tables with references
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
655 -- (if positive) or dereferences (if negative).
111
kono
parents:
diff changeset
656
kono
parents:
diff changeset
657 end SPARK_Specific;
kono
parents:
diff changeset
658
kono
parents:
diff changeset
659 -----------------
kono
parents:
diff changeset
660 -- Subprograms --
kono
parents:
diff changeset
661 -----------------
kono
parents:
diff changeset
662
kono
parents:
diff changeset
663 procedure Generate_Definition (E : Entity_Id);
kono
parents:
diff changeset
664 -- Records the definition of an entity
kono
parents:
diff changeset
665
kono
parents:
diff changeset
666 procedure Generate_Operator_Reference
kono
parents:
diff changeset
667 (N : Node_Id;
kono
parents:
diff changeset
668 T : Entity_Id);
kono
parents:
diff changeset
669 -- Node N is an operator node, whose entity has been set. If this entity
kono
parents:
diff changeset
670 -- is a user defined operator (i.e. an operator not defined in package
kono
parents:
diff changeset
671 -- Standard), then a reference to the operator is recorded at node N.
kono
parents:
diff changeset
672 -- T is the operand type of the operator. A reference to the operator is an
kono
parents:
diff changeset
673 -- implicit reference to the type, and that needs to be recorded to avoid
kono
parents:
diff changeset
674 -- spurious warnings on unused entities, when the operator is a renaming of
kono
parents:
diff changeset
675 -- a predefined operator.
kono
parents:
diff changeset
676
kono
parents:
diff changeset
677 procedure Generate_Reference
kono
parents:
diff changeset
678 (E : Entity_Id;
kono
parents:
diff changeset
679 N : Node_Id;
kono
parents:
diff changeset
680 Typ : Character := 'r';
kono
parents:
diff changeset
681 Set_Ref : Boolean := True;
kono
parents:
diff changeset
682 Force : Boolean := False);
kono
parents:
diff changeset
683 -- This procedure is called to record a reference. N is the location of the
kono
parents:
diff changeset
684 -- reference and E is the referenced entity. Typ is one of:
kono
parents:
diff changeset
685 --
kono
parents:
diff changeset
686 -- a character already described in the description of ref entries above
kono
parents:
diff changeset
687 -- ' ' for dummy reference (see below)
kono
parents:
diff changeset
688 --
kono
parents:
diff changeset
689 -- Note: all references to incomplete or private types are to the original
kono
parents:
diff changeset
690 -- (incomplete or private type) declaration. The full declaration is
kono
parents:
diff changeset
691 -- treated as a reference with type 'c'.
kono
parents:
diff changeset
692 --
kono
parents:
diff changeset
693 -- Note: all references to packages or subprograms are to the entity for
kono
parents:
diff changeset
694 -- the spec. The entity in the body is treated as a reference with type
kono
parents:
diff changeset
695 -- 'b'. Similar handling for references to subprogram formals.
kono
parents:
diff changeset
696 --
kono
parents:
diff changeset
697 -- The call has no effect if N is not in the extended main source unit.
kono
parents:
diff changeset
698 -- This check is omitted for type 'e' references (where it is useful to
kono
parents:
diff changeset
699 -- have structural scoping information for other than the main source),
kono
parents:
diff changeset
700 -- and for 'p' (since we want to pick up inherited primitive operations
kono
parents:
diff changeset
701 -- that are defined in other packages).
kono
parents:
diff changeset
702 --
kono
parents:
diff changeset
703 -- The call also has no effect if any of the following conditions hold:
kono
parents:
diff changeset
704 --
kono
parents:
diff changeset
705 -- cross-reference collection is disabled
kono
parents:
diff changeset
706 -- entity does not come from source (and Force is False)
kono
parents:
diff changeset
707 -- reference does not come from source (and Force is False)
kono
parents:
diff changeset
708 -- the entity is not one for which xrefs are appropriate
kono
parents:
diff changeset
709 -- the type letter is blank
kono
parents:
diff changeset
710 -- the node N is not an identifier, defining identifier, or expanded name
kono
parents:
diff changeset
711 -- the type is 'p' and the entity is not in the extended main source
kono
parents:
diff changeset
712 --
kono
parents:
diff changeset
713 -- If all these conditions are met, then the Is_Referenced flag of E is set
kono
parents:
diff changeset
714 -- (unless Set_Ref is False) and a cross-reference entry is recorded for
kono
parents:
diff changeset
715 -- later output when Output_References is called.
kono
parents:
diff changeset
716 --
kono
parents:
diff changeset
717 -- Note: the dummy space entry is for the convenience of some callers,
kono
parents:
diff changeset
718 -- who find it easier to pass a space to suppress the entry than to do
kono
parents:
diff changeset
719 -- a specific test. The call has no effect if the type is a space.
kono
parents:
diff changeset
720 --
kono
parents:
diff changeset
721 -- The parameter Set_Ref is normally True, and indicates that in addition
kono
parents:
diff changeset
722 -- to generating a cross-reference, the Referenced flag of the specified
kono
parents:
diff changeset
723 -- entity should be set. If this parameter is False, then setting of the
kono
parents:
diff changeset
724 -- Referenced flag is inhibited.
kono
parents:
diff changeset
725 --
kono
parents:
diff changeset
726 -- The parameter Force is set to True to force a reference to be generated
kono
parents:
diff changeset
727 -- even if Comes_From_Source is false. This is used for certain implicit
kono
parents:
diff changeset
728 -- references, and also for end label references.
kono
parents:
diff changeset
729
kono
parents:
diff changeset
730 procedure Generate_Reference_To_Formals (E : Entity_Id);
kono
parents:
diff changeset
731 -- Add a reference to the definition of each formal on the line for
kono
parents:
diff changeset
732 -- a subprogram or an access_to_subprogram type.
kono
parents:
diff changeset
733
kono
parents:
diff changeset
734 procedure Generate_Reference_To_Generic_Formals (E : Entity_Id);
kono
parents:
diff changeset
735 -- Add a reference to the definition of each generic formal on the line
kono
parents:
diff changeset
736 -- for a generic unit.
kono
parents:
diff changeset
737
kono
parents:
diff changeset
738 procedure Output_References;
kono
parents:
diff changeset
739 -- Output references to the current ali file
kono
parents:
diff changeset
740
kono
parents:
diff changeset
741 procedure Initialize;
kono
parents:
diff changeset
742 -- Initialize internal tables
kono
parents:
diff changeset
743
kono
parents:
diff changeset
744 end Lib.Xref;