OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [ada/] [lib-xref.ads] - Blame information for rev 404

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

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

powered by: WebSVN 2.1.0

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