]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/ada/ali.ads
22bf8a2b0793bdd6942e22478c411aae44b2e6b2
[thirdparty/gcc.git] / gcc / ada / ali.ads
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- A L I --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 1992-2019, 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 defines the internal data structures used for representation
27 -- of Ada Library Information (ALI) acquired from the ALI files generated by
28 -- the front end.
29
30 with Casing; use Casing;
31 with Gnatvsn; use Gnatvsn;
32 with Namet; use Namet;
33 with Rident; use Rident;
34 with Table;
35 with Types; use Types;
36
37 with GNAT.Dynamic_Tables;
38 with GNAT.HTable; use GNAT.HTable;
39
40 package ALI is
41
42 --------------
43 -- Id Types --
44 --------------
45
46 type ALI_Id is range 0 .. 99_999_999;
47 -- Id values used for ALIs table entries
48
49 type Unit_Id is range 0 .. 99_999_999;
50 -- Id values used for Unit table entries
51
52 type With_Id is range 0 .. 99_999_999;
53 -- Id values used for Withs table entries
54
55 type Arg_Id is range 0 .. 99_999_999;
56 -- Id values used for argument table entries
57
58 type Sdep_Id is range 0 .. 99_999_999;
59 -- Id values used for Sdep table entries
60
61 type Source_Id is range 0 .. 99_999_999;
62 -- Id values used for Source table entries
63
64 type Interrupt_State_Id is range 0 .. 99_999_999;
65 -- Id values used for Interrupt_State table entries
66
67 type Priority_Specific_Dispatching_Id is range 0 .. 99_999_999;
68 -- Id values used for Priority_Specific_Dispatching table entries
69
70 type Invocation_Construct_Id is range 0 .. 99_999_999;
71 -- Id values used for Invocation_Constructs table entries
72
73 type Invocation_Relation_Id is range 0 .. 99_999_999;
74 -- Id values used for Invocation_Relations table entries
75
76 type Invocation_Signature_Id is range 0 .. 99_999_999;
77 -- Id values used for Invocation_Signatures table entries
78
79 function Present (IC_Id : Invocation_Construct_Id) return Boolean;
80 pragma Inline (Present);
81 -- Determine whether invocation construct IC_Id exists
82
83 function Present (IR_Id : Invocation_Relation_Id) return Boolean;
84 pragma Inline (Present);
85 -- Determine whether invocation relation IR_Id exists
86
87 function Present (IS_Id : Invocation_Signature_Id) return Boolean;
88 pragma Inline (Present);
89 -- Determine whether invocation signature IS_Id exists
90
91 function Present (Dep : Sdep_Id) return Boolean;
92 pragma Inline (Present);
93 -- Determine whether dependant Dep exists
94
95 function Present (U_Id : Unit_Id) return Boolean;
96 pragma Inline (Present);
97 -- Determine whether unit U_Id exists
98
99 function Present (W_Id : With_Id) return Boolean;
100 pragma Inline (Present);
101 -- Determine whether with W_Id exists
102
103 --------------------
104 -- ALI File Table --
105 --------------------
106
107 -- Each ALI file read generates an entry in the ALIs table
108
109 No_ALI_Id : constant ALI_Id := ALI_Id'First;
110 -- Special value indicating no ALI entry
111
112 First_ALI_Entry : constant ALI_Id := No_ALI_Id + 1;
113 -- Id of first actual entry in table
114
115 -- The following type enumerates all possible invocation-graph encoding
116 -- kinds.
117
118 type Invocation_Graph_Encoding_Kind is
119 (Endpoints_Encoding,
120 -- The invocation construct and relation lines contain information for
121 -- the start construct and end target found on an invocation-graph path.
122
123 Full_Path_Encoding,
124 -- The invocation construct and relation lines contain information for
125 -- all constructs and targets found on a invocation-graph path.
126
127 No_Encoding);
128
129 type Main_Program_Type is (None, Proc, Func);
130 -- Indicator of whether unit can be used as main program
131
132 type ALIs_Record is record
133 Afile : File_Name_Type;
134 -- Name of ALI file
135
136 Ofile_Full_Name : File_Name_Type;
137 -- Full name of object file corresponding to the ALI file
138
139 Sfile : File_Name_Type;
140 -- Name of source file that generates this ALI file (which is equal
141 -- to the name of the source file in the first unit table entry for
142 -- this ALI file, since the body if present is always first).
143
144 Ver : String (1 .. Ver_Len_Max);
145 -- Value of library version (V line in ALI file). Not set if
146 -- V lines are ignored as a result of the Ignore_Lines parameter.
147
148 Ver_Len : Natural;
149 -- Length of characters stored in Ver. Not set if V lines are ignored as
150 -- a result of the Ignore_Lines parameter.
151
152 SAL_Interface : Boolean;
153 -- Set True when this is an interface to a standalone library
154
155 First_Unit : Unit_Id;
156 -- Id of first Unit table entry for this file
157
158 Last_Unit : Unit_Id;
159 -- Id of last Unit table entry for this file
160
161 First_Sdep : Sdep_Id;
162 -- Id of first Sdep table entry for this file
163
164 Last_Sdep : Sdep_Id;
165 -- Id of last Sdep table entry for this file
166
167 Main_Program : Main_Program_Type;
168 -- Indicator of whether first unit can be used as main program. Not set
169 -- if 'M' appears in Ignore_Lines.
170
171 Main_Priority : Int;
172 -- Indicates priority value if Main_Program field indicates that this
173 -- can be a main program. A value of -1 (No_Main_Priority) indicates
174 -- that no parameter was found, or no M line was present. Not set if
175 -- 'M' appears in Ignore_Lines.
176
177 Main_CPU : Int;
178 -- Indicates processor if Main_Program field indicates that this can
179 -- be a main program. A value of -1 (No_Main_CPU) indicates that no C
180 -- parameter was found, or no M line was present. Not set if 'M' appears
181 -- in Ignore_Lines.
182
183 Time_Slice_Value : Int;
184 -- Indicates value of time slice parameter from T=xxx on main program
185 -- line. A value of -1 indicates that no T=xxx parameter was found, or
186 -- no M line was present. Not set if 'M' appears in Ignore_Lines.
187
188 WC_Encoding : Character;
189 -- Wide character encoding if main procedure. Otherwise not relevant.
190 -- Not set if 'M' appears in Ignore_Lines.
191
192 Locking_Policy : Character;
193 -- Indicates locking policy for units in this file. Space means tasking
194 -- was not used, or that no Locking_Policy pragma was present or that
195 -- this is a language defined unit. Otherwise set to first character
196 -- (upper case) of policy name. Not set if 'P' appears in Ignore_Lines.
197
198 Partition_Elaboration_Policy : Character;
199 -- Indicates partition elaboration policy for units in this file. Space
200 -- means that no Partition_Elaboration_Policy pragma was present or that
201 -- this is a language defined unit. Otherwise set to first character
202 -- (upper case) of policy name. Not set if 'P' appears in Ignore_Lines.
203
204 Queuing_Policy : Character;
205 -- Indicates queuing policy for units in this file. Space means tasking
206 -- was not used, or that no Queuing_Policy pragma was present or that
207 -- this is a language defined unit. Otherwise set to first character
208 -- (upper case) of policy name. Not set if 'P' appears in Ignore_Lines.
209
210 Task_Dispatching_Policy : Character;
211 -- Indicates task dispatching policy for units in this file. Space means
212 -- tasking was not used, or that no Task_Dispatching_Policy pragma was
213 -- present or that this is a language defined unit. Otherwise set to
214 -- first character (upper case) of policy name. Not set if 'P' appears
215 -- in Ignore_Lines.
216
217 Compile_Errors : Boolean;
218 -- Set to True if compile errors for unit. Note that No_Object will
219 -- always be set as well in this case. Not set if 'P' appears in
220 -- Ignore_Lines.
221
222 GNATprove_Mode : Boolean;
223 -- Set to True if ALI and object file produced in GNATprove_Mode as
224 -- signalled by GP appearing on the P line. Not set if 'P' appears in
225 -- Ignore_Lines.
226
227 No_Component_Reordering : Boolean;
228 -- Set to True if file was compiled with a configuration pragma file
229 -- containing pragma No_Component_Reordering. Not set if 'P' appears
230 -- in Ignore_Lines.
231
232 No_Object : Boolean;
233 -- Set to True if no object file generated. Not set if 'P' appears in
234 -- Ignore_Lines.
235
236 Normalize_Scalars : Boolean;
237 -- Set to True if file was compiled with Normalize_Scalars. Not set if
238 -- 'P' appears in Ignore_Lines.
239
240 SSO_Default : Character;
241 -- Set to 'H' or 'L' if file was compiled with a configuration pragma
242 -- file containing Default_Scalar_Storage_Order (High/Low_Order_First).
243 -- Set to ' ' if neither pragma was present. Not set if 'P' appears in
244 -- Ignore_Lines.
245
246 Unit_Exception_Table : Boolean;
247 -- Set to True if unit exception table pointer generated. Not set if 'P'
248 -- appears in Ignore_Lines.
249
250 Frontend_Exceptions : Boolean;
251 -- Set to True if file was compiled with front-end exceptions. Not set
252 -- if 'P' appears in Ignore_Lines.
253
254 Zero_Cost_Exceptions : Boolean;
255 -- Set to True if file was compiled with zero cost exceptions. Not set
256 -- if 'P' appears in Ignore_Lines.
257
258 Restrictions : Restrictions_Info;
259 -- Restrictions information reconstructed from R lines
260
261 First_Interrupt_State : Interrupt_State_Id;
262 Last_Interrupt_State : Interrupt_State_Id'Base;
263 -- These point to the first and last entries in the interrupt state
264 -- table for this unit. If no entries, then Last_Interrupt_State =
265 -- First_Interrupt_State - 1 (that's why the 'Base reference is there,
266 -- it can be one less than the lower bound of the subtype). Not set if
267 -- 'I' appears in Ignore_Lines
268
269 First_Specific_Dispatching : Priority_Specific_Dispatching_Id;
270 Last_Specific_Dispatching : Priority_Specific_Dispatching_Id'Base;
271 -- These point to the first and last entries in the priority specific
272 -- dispatching table for this unit. If there are no entries, then
273 -- Last_Specific_Dispatching = First_Specific_Dispatching - 1. That
274 -- is why the 'Base reference is there, it can be one less than the
275 -- lower bound of the subtype. Not set if 'S' appears in Ignore_Lines.
276
277 Invocation_Graph_Encoding : Invocation_Graph_Encoding_Kind;
278 -- The encoding format used to capture information about the invocation
279 -- constructs and relations within the corresponding ALI file of this
280 -- unit.
281 end record;
282
283 No_Main_Priority : constant Int := -1;
284 -- Code for no main priority set
285
286 No_Main_CPU : constant Int := -1;
287 -- Code for no main cpu set
288
289 package ALIs is new Table.Table (
290 Table_Component_Type => ALIs_Record,
291 Table_Index_Type => ALI_Id,
292 Table_Low_Bound => First_ALI_Entry,
293 Table_Initial => 500,
294 Table_Increment => 200,
295 Table_Name => "ALIs");
296
297 ----------------
298 -- Unit Table --
299 ----------------
300
301 -- Each unit within an ALI file generates an entry in the unit table
302
303 No_Unit_Id : constant Unit_Id := Unit_Id'First;
304 -- Special value indicating no unit table entry
305
306 First_Unit_Entry : constant Unit_Id := No_Unit_Id + 1;
307 -- Id of first actual entry in table
308
309 type Unit_Type is (Is_Spec, Is_Body, Is_Spec_Only, Is_Body_Only);
310 -- Indicates type of entry, if both body and spec appear in the ALI file,
311 -- then the first unit is marked Is_Body, and the second is marked Is_Spec.
312 -- If only a spec appears, then it is marked as Is_Spec_Only, and if only
313 -- a body appears, then it is marked Is_Body_Only).
314
315 subtype Version_String is String (1 .. 8);
316 -- Version string, taken from unit record
317
318 type Unit_Record is record
319 My_ALI : ALI_Id;
320 -- Corresponding ALI entry
321
322 Uname : Unit_Name_Type;
323 -- Name of Unit
324
325 Sfile : File_Name_Type;
326 -- Name of source file
327
328 Preelab : Boolean;
329 -- Indicates presence of PR parameter for a preelaborated package
330
331 No_Elab : Boolean;
332 -- Indicates presence of NE parameter for a unit that has does not
333 -- have an elaboration routine (since it has no elaboration code).
334
335 Pure : Boolean;
336 -- Indicates presence of PU parameter for a package having pragma Pure
337
338 Dynamic_Elab : Boolean;
339 -- Set to True if the unit was compiled with dynamic elaboration checks
340 -- (i.e. either -gnatE or pragma Elaboration_Checks (RM) was used to
341 -- compile the unit).
342
343 Elaborate_Body : Boolean;
344 -- Indicates presence of EB parameter for a package which has a pragma
345 -- Elaborate_Body, and also for generic package instantiations.
346
347 Set_Elab_Entity : Boolean;
348 -- Indicates presence of EE parameter for a unit which has an
349 -- elaboration entity which must be set true as part of the
350 -- elaboration of the unit.
351
352 Has_RACW : Boolean;
353 -- Indicates presence of RA parameter for a package that declares at
354 -- least one Remote Access to Class_Wide (RACW) object.
355
356 Remote_Types : Boolean;
357 -- Indicates presence of RT parameter for a package which has a
358 -- pragma Remote_Types.
359
360 Serious_Errors : Boolean;
361 -- Indicates presence of SE parameter indicating that compilation of
362 -- the unit encountered as serious error.
363
364 Shared_Passive : Boolean;
365 -- Indicates presence of SP parameter for a package which has a pragma
366 -- Shared_Passive.
367
368 RCI : Boolean;
369 -- Indicates presence of RC parameter for a package which has a pragma
370 -- Remote_Call_Interface.
371
372 Predefined : Boolean;
373 -- Indicates if unit is language predefined (or a child of such a unit)
374
375 Internal : Boolean;
376 -- Indicates if unit is an internal unit (or a child of such a unit)
377
378 First_With : With_Id;
379 -- Id of first withs table entry for this file
380
381 Last_With : With_Id;
382 -- Id of last withs table entry for this file
383
384 First_Arg : Arg_Id;
385 -- Id of first args table entry for this file
386
387 Last_Arg : Arg_Id;
388 -- Id of last args table entry for this file
389
390 First_Invocation_Construct : Invocation_Construct_Id;
391 -- Id of the first invocation construct for this unit
392
393 Last_Invocation_Construct : Invocation_Construct_Id;
394 -- Id of the last invocation construct for this unit
395
396 First_Invocation_Relation : Invocation_Relation_Id;
397 -- Id of the first invocation relation for this unit
398
399 Last_Invocation_Relation : Invocation_Relation_Id;
400 -- Id of the last invocation relation for this unit
401
402 Utype : Unit_Type;
403 -- Type of entry
404
405 Is_Generic : Boolean;
406 -- True for generic unit (i.e. a generic declaration, or a generic
407 -- body). False for a non-generic unit.
408
409 Unit_Kind : Character;
410 -- Indicates the nature of the unit. 'p' for Packages and 's' for
411 -- subprograms.
412
413 Version : Version_String;
414 -- Version of unit
415
416 Icasing : Casing_Type;
417 -- Indicates casing of identifiers in source file for this unit. This
418 -- is used for informational output, and also for constructing the main
419 -- unit if it is being built in Ada.
420
421 Kcasing : Casing_Type;
422 -- Indicates casing of keywords in source file for this unit. This is
423 -- used for informational output, and also for constructing the main
424 -- unit if it is being built in Ada.
425
426 Elab_Position : Nat;
427 -- Initialized to zero. Set non-zero when a unit is chosen and
428 -- placed in the elaboration order. The value represents the
429 -- ordinal position in the elaboration order.
430
431 Init_Scalars : Boolean;
432 -- Set True if IS qualifier appears in ALI file, indicating that
433 -- an Initialize_Scalars pragma applies to the unit.
434
435 SAL_Interface : Boolean;
436 -- Set True when this is an interface to a standalone library
437
438 Directly_Scanned : Boolean;
439 -- True iff it is a unit from an ALI file specified to gnatbind
440
441 Body_Needed_For_SAL : Boolean;
442 -- Indicates that the source for the body of the unit (subprogram,
443 -- package, or generic unit) must be included in a standalone library.
444
445 Elaborate_Body_Desirable : Boolean;
446 -- Indicates that the front end elaboration circuitry decided that it
447 -- would be a good idea if this package had Elaborate_Body. The binder
448 -- will attempt, but does not promise, to place the elaboration call
449 -- for the body right after the call for the spec, or at least as close
450 -- together as possible.
451
452 Optimize_Alignment : Character;
453 -- Optimize_Alignment setting. Set to L/S/T/O for OL/OS/OT/OO present.
454
455 Has_Finalizer : Boolean;
456 -- Indicates whether a package body or a spec has a library-level
457 -- finalization routine.
458
459 Primary_Stack_Count : Int;
460 -- Indicates the number of task objects declared in this unit that have
461 -- default sized primary stacks.
462
463 Sec_Stack_Count : Int;
464 -- Indicates the number of task objects declared in this unit that have
465 -- default sized secondary stacks.
466 end record;
467
468 package Units is new Table.Table (
469 Table_Component_Type => Unit_Record,
470 Table_Index_Type => Unit_Id,
471 Table_Low_Bound => First_Unit_Entry,
472 Table_Initial => 100,
473 Table_Increment => 200,
474 Table_Name => "Unit");
475
476 package Unit_Id_Tables is new GNAT.Dynamic_Tables
477 (Table_Component_Type => Unit_Id,
478 Table_Index_Type => Nat,
479 Table_Low_Bound => 1,
480 Table_Initial => 500,
481 Table_Increment => 200);
482
483 subtype Unit_Id_Table is Unit_Id_Tables.Instance;
484 subtype Unit_Id_Array is Unit_Id_Tables.Table_Type;
485
486 ---------------------------
487 -- Interrupt State Table --
488 ---------------------------
489
490 -- An entry is made in this table for each I (interrupt state) line
491 -- encountered in the input ALI file. The First/Last_Interrupt_Id
492 -- fields of the ALI file entry show the range of entries defined
493 -- within a particular ALI file.
494
495 type Interrupt_State_Record is record
496 Interrupt_Id : Nat;
497 -- Id from interrupt state entry
498
499 Interrupt_State : Character;
500 -- State from interrupt state entry ('u'/'r'/'s')
501
502 IS_Pragma_Line : Nat;
503 -- Line number of Interrupt_State pragma
504 end record;
505
506 package Interrupt_States is new Table.Table (
507 Table_Component_Type => Interrupt_State_Record,
508 Table_Index_Type => Interrupt_State_Id'Base,
509 Table_Low_Bound => Interrupt_State_Id'First,
510 Table_Initial => 100,
511 Table_Increment => 200,
512 Table_Name => "Interrupt_States");
513
514 -----------------------------------------
515 -- Priority Specific Dispatching Table --
516 -----------------------------------------
517
518 -- An entry is made in this table for each S (priority specific
519 -- dispatching) line encountered in the input ALI file. The
520 -- First/Last_Specific_Dispatching_Id fields of the ALI file
521 -- entry show the range of entries defined within a particular
522 -- ALI file.
523
524 type Specific_Dispatching_Record is record
525 Dispatching_Policy : Character;
526 -- First character (upper case) of the corresponding policy name
527
528 First_Priority : Nat;
529 -- Lower bound of the priority range to which the specified dispatching
530 -- policy applies.
531
532 Last_Priority : Nat;
533 -- Upper bound of the priority range to which the specified dispatching
534 -- policy applies.
535
536 PSD_Pragma_Line : Nat;
537 -- Line number of Priority_Specific_Dispatching pragma
538 end record;
539
540 package Specific_Dispatching is new Table.Table (
541 Table_Component_Type => Specific_Dispatching_Record,
542 Table_Index_Type => Priority_Specific_Dispatching_Id'Base,
543 Table_Low_Bound => Priority_Specific_Dispatching_Id'First,
544 Table_Initial => 100,
545 Table_Increment => 200,
546 Table_Name => "Priority_Specific_Dispatching");
547
548 --------------
549 -- Switches --
550 --------------
551
552 -- These switches record status information about ali files that
553 -- have been read, for quick reference without searching tables.
554
555 -- Note: a switch will be left set at its default value if the line
556 -- which might otherwise set it is ignored (from Ignore_Lines).
557
558 Dynamic_Elaboration_Checks_Specified : Boolean := False;
559 -- Set to False by Initialize_ALI. Set to True if Scan_ALI reads
560 -- a unit for which dynamic elaboration checking is enabled.
561
562 Frontend_Exceptions_Specified : Boolean := False;
563 -- Set to False by Initialize_ALI. Set to True if an ali file is read that
564 -- has a P line specifying the generation of front-end exceptions.
565
566 GNATprove_Mode_Specified : Boolean := False;
567 -- Set to True if an ali file was produced in GNATprove mode.
568
569 Initialize_Scalars_Used : Boolean := False;
570 -- Set True if an ali file contains the Initialize_Scalars flag
571
572 Locking_Policy_Specified : Character := ' ';
573 -- Set to blank by Initialize_ALI. Set to the appropriate locking policy
574 -- character if an ali file contains a P line setting the locking policy.
575
576 No_Normalize_Scalars_Specified : Boolean := False;
577 -- Set to False by Initialize_ALI. Set to True if an ali file indicates
578 -- that the file was compiled without normalize scalars.
579
580 No_Component_Reordering_Specified : Boolean := False;
581 -- Set to False by Initialize_ALI. Set to True if an ali file contains
582 -- the No_Component_Reordering flag.
583
584 No_Object_Specified : Boolean := False;
585 -- Set to False by Initialize_ALI. Set to True if an ali file contains
586 -- the No_Object flag.
587
588 Normalize_Scalars_Specified : Boolean := False;
589 -- Set to False by Initialize_ALI. Set to True if an ali file indicates
590 -- that the file was compiled in Normalize_Scalars mode.
591
592 Partition_Elaboration_Policy_Specified : Character := ' ';
593 -- Set to blank by Initialize_ALI. Set to the appropriate partition
594 -- elaboration policy character if an ali file contains a P line setting
595 -- the policy.
596
597 Queuing_Policy_Specified : Character := ' ';
598 -- Set to blank by Initialize_ALI. Set to the appropriate queuing policy
599 -- character if an ali file contains a P line setting the queuing policy.
600
601 Cumulative_Restrictions : Restrictions_Info := No_Restrictions;
602 -- This variable records the cumulative contributions of R lines in all
603 -- ali files, showing whether a restriction pragma exists anywhere, and
604 -- accumulating the aggregate knowledge of violations.
605
606 SSO_Default_Specified : Boolean := False;
607 -- Set to True if at least one ALI file contains an OH/OL flag indicating
608 -- that it was compiled with a configuration pragmas file containing the
609 -- pragma Default_Scalar_Storage_Order (OH/OL present in ALI file P line).
610
611 Stack_Check_Switch_Set : Boolean := False;
612 -- Set to True if at least one ALI file contains '-fstack-check' in its
613 -- argument list.
614
615 Task_Dispatching_Policy_Specified : Character := ' ';
616 -- Set to blank by Initialize_ALI. Set to the appropriate task dispatching
617 -- policy character if an ali file contains a P line setting the
618 -- task dispatching policy.
619
620 Unreserve_All_Interrupts_Specified : Boolean := False;
621 -- Set to False by Initialize_ALI. Set to True if an ali file is read that
622 -- has P line specifying unreserve all interrupts mode.
623
624 Zero_Cost_Exceptions_Specified : Boolean := False;
625 -- Set to False by Initialize_ALI. Set to True if an ali file is read that
626 -- has a P line specifying the generation of zero cost exceptions.
627
628 -----------------
629 -- Withs Table --
630 -----------------
631
632 -- Each With line (W line) in an ALI file generates a Withs table entry
633
634 -- Note: there will be no entries in this table if 'W' lines are ignored
635
636 No_With_Id : constant With_Id := With_Id'First;
637 -- Special value indicating no withs table entry
638
639 First_With_Entry : constant With_Id := No_With_Id + 1;
640 -- Id of first actual entry in table
641
642 type With_Record is record
643 Uname : Unit_Name_Type;
644 -- Name of Unit
645
646 Sfile : File_Name_Type;
647 -- Name of source file, set to No_File in generic case
648
649 Afile : File_Name_Type;
650 -- Name of ALI file, set to No_File in generic case
651
652 Elaborate : Boolean;
653 -- Indicates presence of E parameter
654
655 Elaborate_All : Boolean;
656 -- Indicates presence of EA parameter
657
658 Elab_All_Desirable : Boolean;
659 -- Indicates presence of AD parameter
660
661 Elab_Desirable : Boolean;
662 -- Indicates presence of ED parameter
663
664 SAL_Interface : Boolean := False;
665 -- True if the Unit is an Interface of a Stand-Alone Library
666
667 Implicit_With : Boolean := False;
668 -- True if this is an implicit with generated by the compiler
669
670 Limited_With : Boolean := False;
671 -- True if this is a limited_with_clause
672 end record;
673
674 package Withs is new Table.Table (
675 Table_Component_Type => With_Record,
676 Table_Index_Type => With_Id,
677 Table_Low_Bound => First_With_Entry,
678 Table_Initial => 5000,
679 Table_Increment => 200,
680 Table_Name => "Withs");
681
682 ---------------------
683 -- Arguments Table --
684 ---------------------
685
686 -- Each Arg line (A line) in an ALI file generates an Args table entry
687
688 -- Note: there will be no entries in this table if 'A' lines are ignored
689
690 No_Arg_Id : constant Arg_Id := Arg_Id'First;
691 -- Special value indicating no args table entry
692
693 First_Arg_Entry : constant Arg_Id := No_Arg_Id + 1;
694 -- Id of first actual entry in table
695
696 package Args is new Table.Table (
697 Table_Component_Type => String_Ptr,
698 Table_Index_Type => Arg_Id,
699 Table_Low_Bound => First_Arg_Entry,
700 Table_Initial => 1000,
701 Table_Increment => 100,
702 Table_Name => "Args");
703
704 --------------------------
705 -- Linker_Options Table --
706 --------------------------
707
708 -- If an ALI file has one of more Linker_Options lines, then a single
709 -- entry is made in this table. If more than one Linker_Options lines
710 -- appears in a given ALI file, then the arguments are concatenated
711 -- to form the entry in this table, using a NUL character as the
712 -- separator, and a final NUL character is appended to the end.
713
714 -- Note: there will be no entries in this table if 'L' lines are ignored
715
716 type Linker_Option_Record is record
717 Name : Name_Id;
718 -- Name entry containing concatenated list of Linker_Options
719 -- arguments separated by NUL and ended by NUL as described above.
720
721 Unit : Unit_Id;
722 -- Unit_Id for the entry
723
724 Internal_File : Boolean;
725 -- Set True if the linker options are from an internal file. This is
726 -- used to insert certain standard entries after all the user entries
727 -- but before the entries from the run-time.
728 end record;
729
730 -- The indexes of active entries in this table range from 1 to
731 -- the value of Linker_Options.Last. The zero'th element is for
732 -- convenience if the table needs to be sorted.
733
734 package Linker_Options is new Table.Table (
735 Table_Component_Type => Linker_Option_Record,
736 Table_Index_Type => Integer,
737 Table_Low_Bound => 0,
738 Table_Initial => 200,
739 Table_Increment => 400,
740 Table_Name => "Linker_Options");
741
742 -----------------
743 -- Notes Table --
744 -----------------
745
746 -- The notes table records entries from N lines
747
748 type Notes_Record is record
749 Pragma_Type : Character;
750 -- 'A', 'C', 'I', 'S', 'T' for Annotate/Comment/Ident/Subtitle/Title
751
752 Pragma_Line : Nat;
753 -- Line number of pragma
754
755 Pragma_Col : Nat;
756 -- Column number of pragma
757
758 Pragma_Source_File : File_Name_Type;
759 -- Source file of pragma
760
761 Pragma_Args : Name_Id;
762 -- Pragma arguments. No_Name if no arguments, otherwise a single
763 -- name table entry consisting of all the characters on the notes
764 -- line from the first non-blank character following the source
765 -- location to the last character on the line.
766 end record;
767
768 -- The indexes of active entries in this table range from 1 to the
769 -- value of Notes.Last. The zero'th element is for convenience if
770 -- the table needs to be sorted.
771
772 package Notes is new Table.Table (
773 Table_Component_Type => Notes_Record,
774 Table_Index_Type => Integer,
775 Table_Low_Bound => 0,
776 Table_Initial => 200,
777 Table_Increment => 400,
778 Table_Name => "Notes");
779
780 -------------------------------------------
781 -- External Version Reference Hash Table --
782 -------------------------------------------
783
784 -- This hash table keeps track of external version reference strings
785 -- as read from E lines in the ali file. The stored values do not
786 -- include the terminating quote characters.
787
788 -- Note: there will be no entries in this table if 'E' lines are ignored
789
790 type Vindex is range 0 .. 98;
791 -- Type to define range of headers
792
793 function SHash (S : String_Ptr) return Vindex;
794 -- Hash function for this table
795
796 function SEq (F1, F2 : String_Ptr) return Boolean;
797 -- Equality function for this table
798
799 package Version_Ref is new Simple_HTable (
800 Header_Num => Vindex,
801 Element => Boolean,
802 No_Element => False,
803 Key => String_Ptr,
804 Hash => SHash,
805 Equal => SEq);
806
807 -------------------------
808 -- No_Dependency Table --
809 -------------------------
810
811 -- Each R line for a No_Dependency Restriction generates an entry in
812 -- this No_Dependency table.
813
814 type No_Dep_Record is record
815 ALI_File : ALI_Id;
816 -- ALI File containing the entry
817
818 No_Dep_Unit : Name_Id;
819 -- Id for names table entry including entire name, including periods
820 end record;
821
822 package No_Deps is new Table.Table (
823 Table_Component_Type => No_Dep_Record,
824 Table_Index_Type => Integer,
825 Table_Low_Bound => 0,
826 Table_Initial => 200,
827 Table_Increment => 400,
828 Table_Name => "No_Deps");
829
830 ------------------------------------
831 -- Sdep (Source Dependency) Table --
832 ------------------------------------
833
834 -- Each source dependency (D line) in an ALI file generates an entry in the
835 -- Sdep table.
836
837 -- Note: there will be no entries in this table if 'D' lines are ignored
838
839 No_Sdep_Id : constant Sdep_Id := Sdep_Id'First;
840 -- Special value indicating no Sdep table entry
841
842 First_Sdep_Entry : Sdep_Id := No_Sdep_Id + 1;
843 -- Id of first Sdep entry for current ali file. This is initialized to the
844 -- first Sdep entry in the table, and then incremented appropriately as
845 -- successive ALI files are scanned.
846
847 type Sdep_Record is record
848 Sfile : File_Name_Type;
849 -- Name of source file
850
851 Stamp : Time_Stamp_Type;
852 -- Time stamp value. Note that this will be all zero characters for the
853 -- dummy entries for missing or non-dependent files.
854
855 Checksum : Word;
856 -- Checksum value. Note that this will be all zero characters for the
857 -- dummy entries for missing or non-dependent files
858
859 Dummy_Entry : Boolean;
860 -- Set True for dummy entries that correspond to missing files or files
861 -- where no dependency relationship exists.
862
863 Subunit_Name : Name_Id;
864 -- Name_Id for subunit name if present, else No_Name
865
866 Unit_Name : Name_Id;
867 -- Name_Id for the unit name if not a subunit (No_Name for a subunit)
868
869 Rfile : File_Name_Type;
870 -- Reference file name. Same as Sfile unless a Source_Reference pragma
871 -- was used, in which case it reflects the name used in the pragma.
872
873 Start_Line : Nat;
874 -- Starting line number in file. Always 1, unless a Source_Reference
875 -- pragma was used, in which case it reflects the line number value
876 -- given in the pragma.
877
878 end record;
879
880 package Sdep is new Table.Table (
881 Table_Component_Type => Sdep_Record,
882 Table_Index_Type => Sdep_Id,
883 Table_Low_Bound => First_Sdep_Entry,
884 Table_Initial => 5000,
885 Table_Increment => 200,
886 Table_Name => "Sdep");
887
888 ----------------------------
889 -- Use of Name Table Info --
890 ----------------------------
891
892 -- All unit names and file names are entered into the Names table. The Info
893 -- fields of these entries are used as follows:
894
895 -- Unit name Info field has Unit_Id of unit table entry
896 -- ALI file name Info field has ALI_Id of ALI table entry
897 -- Source file name Info field has Source_Id of source table entry
898
899 --------------------------
900 -- Cross-Reference Data --
901 --------------------------
902
903 -- The following table records cross-reference sections, there is one entry
904 -- for each X header line in the ALI file for an xref section.
905
906 -- Note: there will be no entries in this table if 'X' lines are ignored
907
908 type Xref_Section_Record is record
909 File_Num : Sdep_Id;
910 -- Dependency number for file (entry in Sdep.Table)
911
912 File_Name : File_Name_Type;
913 -- Name of file
914
915 First_Entity : Nat;
916 -- First entry in Xref_Entity table
917
918 Last_Entity : Nat;
919 -- Last entry in Xref_Entity table
920 end record;
921
922 package Xref_Section is new Table.Table (
923 Table_Component_Type => Xref_Section_Record,
924 Table_Index_Type => Nat,
925 Table_Low_Bound => 1,
926 Table_Initial => 50,
927 Table_Increment => 300,
928 Table_Name => "Xref_Section");
929
930 -- The following is used to indicate whether a typeref field is present
931 -- for the entity, and if so what kind of typeref field.
932
933 type Tref_Kind is (
934 Tref_None, -- No typeref present
935 Tref_Access, -- Access type typeref (points to designated type)
936 Tref_Derived, -- Derived type typeref (points to parent type)
937 Tref_Type); -- All other cases
938
939 type Visibility_Kind is
940 (Global, -- Library level entity
941 Static, -- Static C/C++ entity
942 Other); -- Local and other entity
943
944 -- The following table records entities for which xrefs are recorded
945
946 type Xref_Entity_Record is record
947 Line : Pos;
948 -- Line number of definition
949
950 Etype : Character;
951 -- Set to the identification character for the entity. See section
952 -- "Cross-Reference Entity Identifiers" in lib-xref.ads for details.
953
954 Col : Pos;
955 -- Column number of definition
956
957 Visibility : Visibility_Kind;
958 -- Visibility of entity
959
960 Entity : Name_Id;
961 -- Name of entity
962
963 Iref_File_Num : Sdep_Id;
964 -- This field is set to the dependency reference for the file containing
965 -- the generic entity that this one instantiates, or to No_Sdep_Id if
966 -- the current entity is not an instantiation
967
968 Iref_Line : Nat;
969 -- This field is set to the line number in Iref_File_Num of the generic
970 -- entity that this one instantiates, or to zero if the current entity
971 -- is not an instantiation.
972
973 Rref_Line : Nat;
974 -- This field is set to the line number of a renaming reference if
975 -- one is present, or to zero if no renaming reference is present
976
977 Rref_Col : Nat;
978 -- This field is set to the column number of a renaming reference
979 -- if one is present, or to zero if no renaming reference is present.
980
981 Tref : Tref_Kind;
982 -- Indicates if a typeref is present, and if so what kind. Set to
983 -- Tref_None if no typeref field is present.
984
985 Tref_File_Num : Sdep_Id;
986 -- This field is set to No_Sdep_Id if no typeref is present, or
987 -- if the typeref refers to an entity in standard. Otherwise it
988 -- it is the dependency reference for the file containing the
989 -- declaration of the typeref entity.
990
991 Tref_Line : Nat;
992 -- This field is set to zero if no typeref is present, or if the
993 -- typeref refers to an entity in standard. Otherwise it contains
994 -- the line number of the declaration of the typeref entity.
995
996 Tref_Type : Character;
997 -- This field is set to blank if no typeref is present, or if the
998 -- typeref refers to an entity in standard. Otherwise it contains
999 -- the identification character for the typeref entity. See section
1000 -- "Cross-Reference Entity Identifiers" in lib-xref.ads for details.
1001
1002 Tref_Col : Nat;
1003 -- This field is set to zero if no typeref is present, or if the
1004 -- typeref refers to an entity in standard. Otherwise it contains
1005 -- the column number of the declaration of the parent type.
1006
1007 Tref_Standard_Entity : Name_Id;
1008 -- This field is set to No_Name if no typeref is present or if the
1009 -- typeref refers to a declared entity rather than an entity in
1010 -- package Standard. If there is a typeref that references an
1011 -- entity in package Standard, then this field is a Name_Id
1012 -- reference for the entity name.
1013
1014 Oref_File_Num : Sdep_Id;
1015 -- This field is set to No_Sdep_Id if the entity doesn't override any
1016 -- other entity, or to the dependency reference for the overridden
1017 -- entity.
1018
1019 Oref_Line : Nat;
1020 Oref_Col : Nat;
1021 -- These two fields are set to the line and column of the overridden
1022 -- entity.
1023
1024 First_Xref : Nat;
1025 -- Index into Xref table of first cross-reference
1026
1027 Last_Xref : Nat;
1028 -- Index into Xref table of last cross-reference. The value in
1029 -- Last_Xref can be less than the First_Xref value to indicate
1030 -- that no entries are present in the Xref Table.
1031 end record;
1032
1033 package Xref_Entity is new Table.Table (
1034 Table_Component_Type => Xref_Entity_Record,
1035 Table_Index_Type => Nat,
1036 Table_Low_Bound => 1,
1037 Table_Initial => 500,
1038 Table_Increment => 300,
1039 Table_Name => "Xref_Entity");
1040
1041 Array_Index_Reference : constant Character := '*';
1042 Interface_Reference : constant Character := 'I';
1043 -- Some special types of references. In the ALI file itself, these
1044 -- are output as attributes of the entity, not as references, but
1045 -- there is no provision in Xref_Entity_Record for storing multiple
1046 -- such references.
1047
1048 -- The following table records actual cross-references
1049
1050 type Xref_Record is record
1051 File_Num : Sdep_Id;
1052 -- Set to the file dependency number for the cross-reference. Note
1053 -- that if no file entry is present explicitly, this is just a copy
1054 -- of the reference for the current cross-reference section.
1055
1056 Line : Nat;
1057 -- Line number for the reference. This is zero when referencing a
1058 -- predefined entity, but in this case Name is set.
1059
1060 Rtype : Character;
1061 -- Indicates type of reference, using code used in ALI file:
1062 -- r = reference
1063 -- m = modification
1064 -- b = body entity
1065 -- c = completion of private or incomplete type
1066 -- x = type extension
1067 -- i = implicit reference
1068 -- Array_Index_Reference = reference to the index of an array
1069 -- Interface_Reference = reference to an interface implemented
1070 -- by the type
1071 -- See description in lib-xref.ads for further details
1072
1073 Col : Nat;
1074 -- Column number for the reference
1075
1076 Name : Name_Id := No_Name;
1077 -- This is only used when referencing a predefined entity. Currently,
1078 -- this only occurs for array indexes.
1079
1080 -- Note: for instantiation references, Rtype is set to ' ', and Col is
1081 -- set to zero. One or more such entries can follow any other reference.
1082 -- When there is more than one such entry, this is to be read as:
1083 -- e.g. ref1 ref2 ref3
1084 -- ref1 is a reference to an entity that was instantied at ref2.
1085 -- ref2 itself is also the result of an instantiation, that took
1086 -- place at ref3
1087
1088 Imported_Lang : Name_Id := No_Name;
1089 Imported_Name : Name_Id := No_Name;
1090 -- Language and name of imported entity reference
1091 end record;
1092
1093 package Xref is new Table.Table (
1094 Table_Component_Type => Xref_Record,
1095 Table_Index_Type => Nat,
1096 Table_Low_Bound => 1,
1097 Table_Initial => 2000,
1098 Table_Increment => 300,
1099 Table_Name => "Xref");
1100
1101 ----------------------------
1102 -- Invocation Graph Types --
1103 ----------------------------
1104
1105 -- The following type identifies an invocation construct
1106
1107 No_Invocation_Construct : constant Invocation_Construct_Id :=
1108 Invocation_Construct_Id'First;
1109 First_Invocation_Construct : constant Invocation_Construct_Id :=
1110 No_Invocation_Construct + 1;
1111
1112 -- The following type identifies an invocation relation
1113
1114 No_Invocation_Relation : constant Invocation_Relation_Id :=
1115 Invocation_Relation_Id'First;
1116 First_Invocation_Relation : constant Invocation_Relation_Id :=
1117 No_Invocation_Relation + 1;
1118
1119 -- The following type identifies an invocation signature
1120
1121 No_Invocation_Signature : constant Invocation_Signature_Id :=
1122 Invocation_Signature_Id'First;
1123 First_Invocation_Signature : constant Invocation_Signature_Id :=
1124 No_Invocation_Signature + 1;
1125
1126 -- The following type enumerates all possible placements of an invocation
1127 -- construct's spec and body with respect to the unit it is declared in.
1128
1129 type Declaration_Placement_Kind is
1130 (In_Body,
1131 -- The declaration of the invocation construct is within the body of the
1132 -- unit it is declared in.
1133
1134 In_Spec,
1135 -- The declaration of the invocation construct is within the spec of the
1136 -- unit it is declared in.
1137
1138 No_Declaration_Placement);
1139 -- The invocation construct does not have a declaration
1140
1141 -- The following type enumerates all possible invocation construct kinds
1142
1143 type Invocation_Construct_Kind is
1144 (Elaborate_Body_Procedure,
1145 -- The invocation construct denotes the procedure which elaborates a
1146 -- package body.
1147
1148 Elaborate_Spec_Procedure,
1149 -- The invocation construct denotes the procedure which elaborates a
1150 -- package spec.
1151
1152 Regular_Construct);
1153 -- The invocation construct is a normal invocation construct
1154
1155 -- The following type enumerates all possible invocation kinds
1156
1157 type Invocation_Kind is
1158 (Accept_Alternative,
1159 Access_Taken,
1160 Call,
1161 Controlled_Adjustment,
1162 Controlled_Finalization,
1163 Controlled_Initialization,
1164 Default_Initial_Condition_Verification,
1165 Initial_Condition_Verification,
1166 Instantiation,
1167 Internal_Controlled_Adjustment,
1168 Internal_Controlled_Finalization,
1169 Internal_Controlled_Initialization,
1170 Invariant_Verification,
1171 Postcondition_Verification,
1172 Protected_Entry_Call,
1173 Protected_Subprogram_Call,
1174 Task_Activation,
1175 Task_Entry_Call,
1176 Type_Initialization,
1177 No_Invocation);
1178
1179 subtype Internal_Controlled_Invocation_Kind is Invocation_Kind range
1180 Internal_Controlled_Adjustment ..
1181 -- Internal_Controlled_Finalization
1182 Internal_Controlled_Initialization;
1183
1184 -- The following type enumerates all possible invocation-graph ALI lines
1185
1186 type Invocation_Graph_Line_Kind is
1187 (Invocation_Construct_Line,
1188 Invocation_Graph_Attributes_Line,
1189 Invocation_Relation_Line);
1190
1191 ----------------------------------
1192 -- Invocation Graph Subprograms --
1193 ----------------------------------
1194
1195 procedure Add_Invocation_Construct
1196 (Body_Placement : Declaration_Placement_Kind;
1197 Kind : Invocation_Construct_Kind;
1198 Signature : Invocation_Signature_Id;
1199 Spec_Placement : Declaration_Placement_Kind;
1200 Update_Units : Boolean := True);
1201 pragma Inline (Add_Invocation_Construct);
1202 -- Add a new invocation construct described by its attributes. Update_Units
1203 -- should be set when this addition must be reflected in the attributes of
1204 -- the current unit.
1205
1206 procedure Add_Invocation_Relation
1207 (Extra : Name_Id;
1208 Invoker : Invocation_Signature_Id;
1209 Kind : Invocation_Kind;
1210 Target : Invocation_Signature_Id;
1211 Update_Units : Boolean := True);
1212 pragma Inline (Add_Invocation_Relation);
1213 -- Add a new invocation relation described by its attributes. Update_Units
1214 -- should be set when this addition must be reflected in the attributes of
1215 -- the current unit.
1216
1217 function Body_Placement
1218 (IC_Id : Invocation_Construct_Id) return Declaration_Placement_Kind;
1219 pragma Inline (Body_Placement);
1220 -- Obtain the location of invocation construct IC_Id's body with respect to
1221 -- the unit where it is declared.
1222
1223 function Code_To_Declaration_Placement_Kind
1224 (Code : Character) return Declaration_Placement_Kind;
1225 pragma Inline (Code_To_Declaration_Placement_Kind);
1226 -- Obtain the declaration placement kind of character encoding Code
1227
1228 function Code_To_Invocation_Construct_Kind
1229 (Code : Character) return Invocation_Construct_Kind;
1230 pragma Inline (Code_To_Invocation_Construct_Kind);
1231 -- Obtain the invocation construct kind of character encoding Code
1232
1233 function Code_To_Invocation_Graph_Encoding_Kind
1234 (Code : Character) return Invocation_Graph_Encoding_Kind;
1235 pragma Inline (Code_To_Invocation_Graph_Encoding_Kind);
1236 -- Obtain the invocation-graph encoding kind of character encoding Code
1237
1238 function Code_To_Invocation_Kind
1239 (Code : Character) return Invocation_Kind;
1240 pragma Inline (Code_To_Invocation_Kind);
1241 -- Obtain the invocation kind of character encoding Code
1242
1243 function Code_To_Invocation_Graph_Line_Kind
1244 (Code : Character) return Invocation_Graph_Line_Kind;
1245 pragma Inline (Code_To_Invocation_Graph_Line_Kind);
1246 -- Obtain the invocation-graph line kind of character encoding Code
1247
1248 function Column (IS_Id : Invocation_Signature_Id) return Nat;
1249 pragma Inline (Column);
1250 -- Obtain the column number of invocation signature IS_Id
1251
1252 function Declaration_Placement_Kind_To_Code
1253 (Kind : Declaration_Placement_Kind) return Character;
1254 pragma Inline (Declaration_Placement_Kind_To_Code);
1255 -- Obtain the character encoding of declaration placement kind Kind
1256
1257 function Extra (IR_Id : Invocation_Relation_Id) return Name_Id;
1258 pragma Inline (Extra);
1259 -- Obtain the name of the additional entity used in error diagnostics for
1260 -- invocation relation IR_Id.
1261
1262 type Invocation_Construct_Processor_Ptr is
1263 access procedure (IC_Id : Invocation_Construct_Id);
1264
1265 procedure For_Each_Invocation_Construct
1266 (Processor : Invocation_Construct_Processor_Ptr);
1267 pragma Inline (For_Each_Invocation_Construct);
1268 -- Invoke Processor on each invocation construct
1269
1270 procedure For_Each_Invocation_Construct
1271 (U_Id : Unit_Id;
1272 Processor : Invocation_Construct_Processor_Ptr);
1273 pragma Inline (For_Each_Invocation_Construct);
1274 -- Invoke Processor on each invocation construct of unit U_Id
1275
1276 type Invocation_Relation_Processor_Ptr is
1277 access procedure (IR_Id : Invocation_Relation_Id);
1278
1279 procedure For_Each_Invocation_Relation
1280 (Processor : Invocation_Relation_Processor_Ptr);
1281 pragma Inline (For_Each_Invocation_Relation);
1282 -- Invoke Processor on each invocation relation
1283
1284 procedure For_Each_Invocation_Relation
1285 (U_Id : Unit_Id;
1286 Processor : Invocation_Relation_Processor_Ptr);
1287 pragma Inline (For_Each_Invocation_Relation);
1288 -- Invoke Processor on each invocation relation of unit U_Id
1289
1290 function Invocation_Construct_Kind_To_Code
1291 (Kind : Invocation_Construct_Kind) return Character;
1292 pragma Inline (Invocation_Construct_Kind_To_Code);
1293 -- Obtain the character encoding of invocation kind Kind
1294
1295 function Invocation_Graph_Encoding return Invocation_Graph_Encoding_Kind;
1296 pragma Inline (Invocation_Graph_Encoding);
1297 -- Obtain the encoding format used to capture information about the
1298 -- invocation constructs and relations within the ALI file of the main
1299 -- unit.
1300
1301 function Invocation_Graph_Encoding_Kind_To_Code
1302 (Kind : Invocation_Graph_Encoding_Kind) return Character;
1303 pragma Inline (Invocation_Graph_Encoding_Kind_To_Code);
1304 -- Obtain the character encoding for invocation-graph encoding kind Kind
1305
1306 function Invocation_Graph_Line_Kind_To_Code
1307 (Kind : Invocation_Graph_Line_Kind) return Character;
1308 pragma Inline (Invocation_Graph_Line_Kind_To_Code);
1309 -- Obtain the character encoding for invocation line kind Kind
1310
1311 function Invocation_Kind_To_Code
1312 (Kind : Invocation_Kind) return Character;
1313 pragma Inline (Invocation_Kind_To_Code);
1314 -- Obtain the character encoding of invocation kind Kind
1315
1316 function Invocation_Signature_Of
1317 (Column : Nat;
1318 Line : Nat;
1319 Locations : Name_Id;
1320 Name : Name_Id;
1321 Scope : Name_Id) return Invocation_Signature_Id;
1322 pragma Inline (Invocation_Signature_Of);
1323 -- Obtain the invocation signature that corresponds to the input attributes
1324
1325 function Invoker
1326 (IR_Id : Invocation_Relation_Id) return Invocation_Signature_Id;
1327 pragma Inline (Invoker);
1328 -- Obtain the signature of the invocation relation IR_Id's invoker
1329
1330 function Kind
1331 (IC_Id : Invocation_Construct_Id) return Invocation_Construct_Kind;
1332 pragma Inline (Kind);
1333 -- Obtain the nature of invocation construct IC_Id
1334
1335 function Kind
1336 (IR_Id : Invocation_Relation_Id) return Invocation_Kind;
1337 pragma Inline (Kind);
1338 -- Obtain the nature of invocation relation IR_Id
1339
1340 function Line (IS_Id : Invocation_Signature_Id) return Nat;
1341 pragma Inline (Line);
1342 -- Obtain the line number of invocation signature IS_Id
1343
1344 function Locations (IS_Id : Invocation_Signature_Id) return Name_Id;
1345 pragma Inline (Locations);
1346 -- Obtain the sequence of column and line numbers within nested instances
1347 -- of invocation signature IS_Id
1348
1349 function Name (IS_Id : Invocation_Signature_Id) return Name_Id;
1350 pragma Inline (Name);
1351 -- Obtain the name of invocation signature IS_Id
1352
1353 function Scope (IS_Id : Invocation_Signature_Id) return Name_Id;
1354 pragma Inline (Scope);
1355 -- Obtain the scope of invocation signature IS_Id
1356
1357 procedure Set_Invocation_Graph_Encoding
1358 (Kind : Invocation_Graph_Encoding_Kind;
1359 Update_Units : Boolean := True);
1360 pragma Inline (Set_Invocation_Graph_Encoding);
1361 -- Set the encoding format used to capture information about the invocation
1362 -- constructs and relations within the ALI file of the main unit to Kind.
1363 -- Update_Units should be set when this action must be reflected in the
1364 -- attributes of the current unit.
1365
1366 function Signature
1367 (IC_Id : Invocation_Construct_Id) return Invocation_Signature_Id;
1368 pragma Inline (Signature);
1369 -- Obtain the signature of invocation construct IC_Id
1370
1371 function Spec_Placement
1372 (IC_Id : Invocation_Construct_Id) return Declaration_Placement_Kind;
1373 pragma Inline (Spec_Placement);
1374 -- Obtain the location of invocation construct IC_Id's spec with respect to
1375 -- the unit where it is declared.
1376
1377 function Target
1378 (IR_Id : Invocation_Relation_Id) return Invocation_Signature_Id;
1379 pragma Inline (Target);
1380 -- Obtain the signature of the invocation relation IR_Id's target
1381
1382 --------------------------------------
1383 -- Subprograms for Reading ALI File --
1384 --------------------------------------
1385
1386 procedure Initialize_ALI;
1387 -- Initialize the ALI tables. Also resets all switch values to defaults
1388
1389 function Scan_ALI
1390 (F : File_Name_Type;
1391 T : Text_Buffer_Ptr;
1392 Ignore_ED : Boolean;
1393 Err : Boolean;
1394 Read_Xref : Boolean := False;
1395 Read_Lines : String := "";
1396 Ignore_Lines : String := "X";
1397 Ignore_Errors : Boolean := False;
1398 Directly_Scanned : Boolean := False) return ALI_Id;
1399 -- Given the text, T, of an ALI file, F, scan and store the information
1400 -- from the file, and return the Id of the resulting entry in the ALI
1401 -- table. Switch settings may be modified as described above in the
1402 -- switch description settings.
1403 --
1404 -- Ignore_ED is normally False. If set to True, it indicates that
1405 -- all AD/ED (elaboration desirable) indications in the ALI file are
1406 -- to be ignored. This parameter is obsolete now that the -f switch
1407 -- is removed from gnatbind, and should be removed ???
1408 --
1409 -- Err determines the action taken on an incorrectly formatted file.
1410 -- If Err is False, then an error message is output, and the program
1411 -- is terminated. If Err is True, then no error message is output,
1412 -- and No_ALI_Id is returned.
1413 --
1414 -- Ignore_Lines requests that Scan_ALI ignore any lines that start
1415 -- with any given key character. The default value of X causes all
1416 -- Xref lines to be ignored. The corresponding data in the ALI
1417 -- tables will not be filled in this case. It is not possible
1418 -- to ignore U (unit) lines, they are always read.
1419 --
1420 -- Read_Lines requests that Scan_ALI process only lines that start
1421 -- with one of the given characters. The corresponding data in the
1422 -- ALI file for any characters not given in the list will not be
1423 -- set. The default value of the null string indicates that all
1424 -- lines should be read (unless Ignore_Lines is specified). U
1425 -- (unit) lines are always read regardless of the value of this
1426 -- parameter.
1427 --
1428 -- Note: either Ignore_Lines or Read_Lines should be non-null, but not
1429 -- both. If both are provided then only the Read_Lines value is used,
1430 -- and the Ignore_Lines parameter is ignored.
1431 --
1432 -- Read_XREF is set True to read and acquire the cross-reference
1433 -- information. If Read_XREF is set to True, then the effect is to ignore
1434 -- all lines other than U, W, D and X lines and the Ignore_Lines and
1435 -- Read_Lines parameters are ignored (i.e. the use of True for Read_XREF
1436 -- is equivalent to specifying an argument of "UWDX" for Read_Lines.
1437 --
1438 -- Ignore_Errors is normally False. If it is set True, then Scan_ALI
1439 -- will do its best to scan through a file and extract all information
1440 -- it can, even if there are errors. In this case Err is only set if
1441 -- Scan_ALI was completely unable to process the file (e.g. it did not
1442 -- look like an ALI file at all). Ignore_Errors is intended to improve
1443 -- the downward compatibility of new compilers with old tools.
1444 --
1445 -- Directly_Scanned is normally False. If it is set to True, then the
1446 -- units (spec and/or body) corresponding to the ALI file are marked as
1447 -- such. It is used to decide for what units gnatbind should generate
1448 -- the symbols corresponding to 'Version or 'Body_Version in
1449 -- Stand-Alone Libraries.
1450
1451 end ALI;