annotate gcc/ada/lib-xref.ads @ 111:04ced10e8804

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