]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/ada/ali.ads
Correct a function pre/postcondition [PR102403].
[thirdparty/gcc.git] / gcc / ada / ali.ads
CommitLineData
d23b8f57
RK
1------------------------------------------------------------------------------
2-- --
3-- GNAT COMPILER COMPONENTS --
4-- --
5-- A L I --
6-- --
7-- S p e c --
8-- --
8d0d46f4 9-- Copyright (C) 1992-2021, Free Software Foundation, Inc. --
d23b8f57
RK
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- --
b5c84c3c 13-- ware Foundation; either version 3, or (at your option) any later ver- --
d23b8f57
RK
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 --
b5c84c3c
RD
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. --
d23b8f57
RK
20-- --
21-- GNAT was originally developed by the GNAT team at New York University. --
71ff80dc 22-- Extensive contributions were provided by Ada Core Technologies Inc. --
d23b8f57
RK
23-- --
24------------------------------------------------------------------------------
25
26-- This package defines the internal data structures used for representation
df3e68b1
HK
27-- of Ada Library Information (ALI) acquired from the ALI files generated by
28-- the front end.
d23b8f57
RK
29
30with Casing; use Casing;
31with Gnatvsn; use Gnatvsn;
39f4e199 32with Namet; use Namet;
d23b8f57
RK
33with Rident; use Rident;
34with Table;
35with Types; use Types;
36
69e6ee2f 37with GNAT.Dynamic_Tables;
d23b8f57
RK
38with GNAT.HTable; use GNAT.HTable;
39
40package ALI is
41
42 --------------
43 -- Id Types --
44 --------------
45
ec3c7387 46 type ALI_Id is range 0 .. 99_999_999;
d23b8f57
RK
47 -- Id values used for ALIs table entries
48
ec3c7387 49 type Unit_Id is range 0 .. 99_999_999;
d23b8f57
RK
50 -- Id values used for Unit table entries
51
ec3c7387 52 type With_Id is range 0 .. 99_999_999;
d23b8f57
RK
53 -- Id values used for Withs table entries
54
ec3c7387 55 type Arg_Id is range 0 .. 99_999_999;
d23b8f57
RK
56 -- Id values used for argument table entries
57
ec3c7387 58 type Sdep_Id is range 0 .. 99_999_999;
d23b8f57
RK
59 -- Id values used for Sdep table entries
60
ec3c7387 61 type Source_Id is range 0 .. 99_999_999;
d23b8f57
RK
62 -- Id values used for Source table entries
63
ec3c7387 64 type Interrupt_State_Id is range 0 .. 99_999_999;
fbf5a39b
AC
65 -- Id values used for Interrupt_State table entries
66
ec3c7387 67 type Priority_Specific_Dispatching_Id is range 0 .. 99_999_999;
3cb8344b
RD
68 -- Id values used for Priority_Specific_Dispatching table entries
69
69e6ee2f
HK
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
d23b8f57
RK
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
9795b203
HK
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
d23b8f57
RK
129 type Main_Program_Type is (None, Proc, Func);
130 -- Indicator of whether unit can be used as main program
131
d23b8f57 132 type ALIs_Record is record
d23b8f57
RK
133 Afile : File_Name_Type;
134 -- Name of ALI file
135
39f4e199 136 Ofile_Full_Name : File_Name_Type;
d23b8f57
RK
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);
fbf5a39b
AC
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.
d23b8f57
RK
147
148 Ver_Len : Natural;
f7f0159d
AC
149 -- Length of characters stored in Ver. Not set if V lines are ignored as
150 -- a result of the Ignore_Lines parameter.
fbf5a39b 151
82c80734 152 SAL_Interface : Boolean;
fbf5a39b 153 -- Set True when this is an interface to a standalone library
d23b8f57
RK
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;
1b24ada5
RD
168 -- Indicator of whether first unit can be used as main program. Not set
169 -- if 'M' appears in Ignore_Lines.
d23b8f57
RK
170
171 Main_Priority : Int;
1b24ada5
RD
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.
d23b8f57 176
8918fe18
AC
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
d23b8f57
RK
183 Time_Slice_Value : Int;
184 -- Indicates value of time slice parameter from T=xxx on main program
1b24ada5
RD
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.
d23b8f57
RK
187
188 WC_Encoding : Character;
189 -- Wide character encoding if main procedure. Otherwise not relevant.
fbf5a39b 190 -- Not set if 'M' appears in Ignore_Lines.
d23b8f57
RK
191
192 Locking_Policy : Character;
1b24ada5
RD
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.
d23b8f57 197
54f471f0
AC
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
d23b8f57 204 Queuing_Policy : Character;
1b24ada5
RD
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.
d23b8f57
RK
209
210 Task_Dispatching_Policy : Character;
1b24ada5
RD
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.
d23b8f57
RK
216
217 Compile_Errors : Boolean;
1b24ada5
RD
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.
d23b8f57 221
b9696ffb
AC
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
8489c295
AC
227 No_Component_Reordering : Boolean;
228 -- Set to True if file was compiled with a configuration pragma file
64ac53f4 229 -- containing pragma No_Component_Reordering. Not set if 'P' appears
8489c295
AC
230 -- in Ignore_Lines.
231
d23b8f57 232 No_Object : Boolean;
1b24ada5
RD
233 -- Set to True if no object file generated. Not set if 'P' appears in
234 -- Ignore_Lines.
d23b8f57
RK
235
236 Normalize_Scalars : Boolean;
1b24ada5
RD
237 -- Set to True if file was compiled with Normalize_Scalars. Not set if
238 -- 'P' appears in Ignore_Lines.
239
220d1fd9
AC
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
d23b8f57 246 Unit_Exception_Table : Boolean;
1b24ada5
RD
247 -- Set to True if unit exception table pointer generated. Not set if 'P'
248 -- appears in Ignore_Lines.
d23b8f57 249
0ab0bf95
OH
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
d23b8f57 254 Zero_Cost_Exceptions : Boolean;
1b24ada5
RD
255 -- Set to True if file was compiled with zero cost exceptions. Not set
256 -- if 'P' appears in Ignore_Lines.
d23b8f57 257
6e937c1c
AC
258 Restrictions : Restrictions_Info;
259 -- Restrictions information reconstructed from R lines
fbf5a39b
AC
260
261 First_Interrupt_State : Interrupt_State_Id;
262 Last_Interrupt_State : Interrupt_State_Id'Base;
1b24ada5
RD
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
d23b8f57 268
3cb8344b
RD
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.
3eb5e54a
HK
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.
d23b8f57
RK
281 end record;
282
283 No_Main_Priority : constant Int := -1;
284 -- Code for no main priority set
285
8918fe18
AC
286 No_Main_CPU : constant Int := -1;
287 -- Code for no main cpu set
288
d23b8f57
RK
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
d23b8f57
RK
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;
b11e8d6f 336 -- Indicates presence of PU parameter for a package having pragma Pure
d23b8f57
RK
337
338 Dynamic_Elab : Boolean;
b11e8d6f
RD
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).
d23b8f57
RK
342
343 Elaborate_Body : Boolean;
b11e8d6f
RD
344 -- Indicates presence of EB parameter for a package which has a pragma
345 -- Elaborate_Body, and also for generic package instantiations.
d23b8f57
RK
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
bf561f2b 350 -- elaboration of the unit.
d23b8f57
RK
351
352 Has_RACW : Boolean;
b11e8d6f
RD
353 -- Indicates presence of RA parameter for a package that declares at
354 -- least one Remote Access to Class_Wide (RACW) object.
d23b8f57
RK
355
356 Remote_Types : Boolean;
357 -- Indicates presence of RT parameter for a package which has a
358 -- pragma Remote_Types.
359
760804f3
AC
360 Serious_Errors : Boolean;
361 -- Indicates presence of SE parameter indicating that compilation of
362 -- the unit encountered as serious error.
363
d23b8f57 364 Shared_Passive : Boolean;
b11e8d6f
RD
365 -- Indicates presence of SP parameter for a package which has a pragma
366 -- Shared_Passive.
d23b8f57
RK
367
368 RCI : Boolean;
b11e8d6f
RD
369 -- Indicates presence of RC parameter for a package which has a pragma
370 -- Remote_Call_Interface.
d23b8f57
RK
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
69e6ee2f
HK
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
d23b8f57
RK
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
b11e8d6f
RD
418 -- is used for informational output, and also for constructing the main
419 -- unit if it is being built in Ada.
d23b8f57
RK
420
421 Kcasing : Casing_Type;
b11e8d6f
RD
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.
d23b8f57 425
c48e0f27 426 Elab_Position : Nat;
d23b8f57
RK
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
82c80734 435 SAL_Interface : Boolean;
fbf5a39b
AC
436 -- Set True when this is an interface to a standalone library
437
5d993afd
VC
438 Directly_Scanned : Boolean;
439 -- True iff it is a unit from an ALI file specified to gnatbind
440
fbf5a39b
AC
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.
3cb8344b
RD
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
ce4a6e84 452 Optimize_Alignment : Character;
bad0a3df 453 -- Optimize_Alignment setting. Set to L/S/T/O for OL/OS/OT/OO present.
ce4a6e84 454
df3e68b1
HK
455 Has_Finalizer : Boolean;
456 -- Indicates whether a package body or a spec has a library-level
457 -- finalization routine.
bad0a3df
PMR
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.
d23b8f57
RK
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
69e6ee2f
HK
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
fbf5a39b
AC
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
3cb8344b
RD
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
d23b8f57
RK
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
fbf5a39b
AC
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
d23b8f57 558 Dynamic_Elaboration_Checks_Specified : Boolean := False;
fbf5a39b 559 -- Set to False by Initialize_ALI. Set to True if Scan_ALI reads
d23b8f57
RK
560 -- a unit for which dynamic elaboration checking is enabled.
561
0ab0bf95
OH
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
b9696ffb
AC
566 GNATprove_Mode_Specified : Boolean := False;
567 -- Set to True if an ali file was produced in GNATprove mode.
568
d23b8f57
RK
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
8489c295
AC
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
d23b8f57
RK
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
54f471f0
AC
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
d23b8f57
RK
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
3cb8344b 601 Cumulative_Restrictions : Restrictions_Info := No_Restrictions;
6e937c1c
AC
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.
07fc65c4 605
220d1fd9
AC
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
0312b364
EB
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
d23b8f57
RK
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
fbf5a39b
AC
634 -- Note: there will be no entries in this table if 'W' lines are ignored
635
d23b8f57
RK
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
d23b8f57
RK
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;
bde33286
RD
659 -- Indicates presence of AD parameter
660
94ce4941 661 Elab_Desirable : Boolean;
d23b8f57
RK
662 -- Indicates presence of ED parameter
663
82c80734 664 SAL_Interface : Boolean := False;
cc4f0de1 665 -- True if the Unit is an Interface of a Stand-Alone Library
fbf5a39b 666
94ce4941
HK
667 Implicit_With : Boolean := False;
668 -- True if this is an implicit with generated by the compiler
cf5ba8a8 669
94ce4941
HK
670 Limited_With : Boolean := False;
671 -- True if this is a limited_with_clause
d23b8f57
RK
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
fbf5a39b
AC
688 -- Note: there will be no entries in this table if 'A' lines are ignored
689
d23b8f57
RK
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
07fc65c4
GB
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.
d23b8f57 713
fbf5a39b
AC
714 -- Note: there will be no entries in this table if 'L' lines are ignored
715
d23b8f57 716 type Linker_Option_Record is record
07fc65c4
GB
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
d23b8f57 724 Internal_File : Boolean;
07fc65c4
GB
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.
d23b8f57
RK
728 end record;
729
31fde973
GD
730 -- The indexes of active entries in this table range from 1 to the value of
731 -- Linker_Options.Last. The zeroth element is for convenience if the table
732 -- needs to be sorted.
d23b8f57
RK
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
7eaa7cdf
RD
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
9e5a6ee7
TQ
758 Pragma_Source_File : File_Name_Type;
759 -- Source file of pragma
7eaa7cdf
RD
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
31fde973
GD
768 -- The indexes of active entries in this table range from 1 to the value of
769 -- Notes.Last. The zeroth element is for convenience if the table needs to
770 -- be sorted.
7eaa7cdf
RD
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
d23b8f57
RK
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
fbf5a39b
AC
788 -- Note: there will be no entries in this table if 'E' lines are ignored
789
d23b8f57
RK
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
5f3ab6fb
AC
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;
5ec5b8c1 816 -- ALI File containing the entry
5f3ab6fb
AC
817
818 No_Dep_Unit : Name_Id;
217efe16 819 -- Id for names table entry including entire name, including periods
5f3ab6fb
AC
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
d23b8f57
RK
830 ------------------------------------
831 -- Sdep (Source Dependency) Table --
832 ------------------------------------
833
ce4a6e84
RD
834 -- Each source dependency (D line) in an ALI file generates an entry in the
835 -- Sdep table.
d23b8f57 836
fbf5a39b
AC
837 -- Note: there will be no entries in this table if 'D' lines are ignored
838
d23b8f57
RK
839 No_Sdep_Id : constant Sdep_Id := Sdep_Id'First;
840 -- Special value indicating no Sdep table entry
841
5c1c8a03 842 First_Sdep_Entry : Sdep_Id := No_Sdep_Id + 1;
ce4a6e84
RD
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.
d23b8f57
RK
846
847 type Sdep_Record is record
d23b8f57
RK
848 Sfile : File_Name_Type;
849 -- Name of source file
850
851 Stamp : Time_Stamp_Type;
ce4a6e84
RD
852 -- Time stamp value. Note that this will be all zero characters for the
853 -- dummy entries for missing or non-dependent files.
d23b8f57
RK
854
855 Checksum : Word;
ce4a6e84
RD
856 -- Checksum value. Note that this will be all zero characters for the
857 -- dummy entries for missing or non-dependent files
855ff2e1
GB
858
859 Dummy_Entry : Boolean;
ce4a6e84
RD
860 -- Set True for dummy entries that correspond to missing files or files
861 -- where no dependency relationship exists.
d23b8f57
RK
862
863 Subunit_Name : Name_Id;
864 -- Name_Id for subunit name if present, else No_Name
865
8b034336 866 Unit_Name : Name_Id;
5aa0548d 867 -- Name_Id for the unit name if not a subunit (No_Name for a subunit)
69e6ee2f 868
d23b8f57 869 Rfile : File_Name_Type;
ce4a6e84
RD
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.
d23b8f57
RK
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
ce4a6e84
RD
892 -- All unit names and file names are entered into the Names table. The Info
893 -- fields of these entries are used as follows:
d23b8f57
RK
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
ce4a6e84
RD
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.
fbf5a39b
AC
905
906 -- Note: there will be no entries in this table if 'X' lines are ignored
d23b8f57
RK
907
908 type Xref_Section_Record is record
909 File_Num : Sdep_Id;
910 -- Dependency number for file (entry in Sdep.Table)
911
39f4e199 912 File_Name : File_Name_Type;
d23b8f57
RK
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
d23b8f57
RK
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
980f237d
GB
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
5875f8d6
AC
939 type Visibility_Kind is
940 (Global, -- Library level entity
941 Static, -- Static C/C++ entity
942 Other); -- Local and other entity
943
d23b8f57
RK
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
fbf5a39b 952 -- "Cross-Reference Entity Identifiers" in lib-xref.ads for details.
d23b8f57
RK
953
954 Col : Pos;
955 -- Column number of definition
956
5875f8d6 957 Visibility : Visibility_Kind;
308e6f3a 958 -- Visibility of entity
d23b8f57
RK
959
960 Entity : Name_Id;
961 -- Name of entity
962
217efe16
ES
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
c1c22e7a
GB
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
980f237d
GB
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
fbf5a39b 1000 -- "Cross-Reference Entity Identifiers" in lib-xref.ads for details.
d23b8f57 1001
980f237d
GB
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
d23b8f57
RK
1005 -- the column number of the declaration of the parent type.
1006
980f237d
GB
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
5ec5b8c1 1014 Oref_File_Num : Sdep_Id;
35a41b73 1015 -- This field is set to No_Sdep_Id if the entity doesn't override any
e14c931f 1016 -- other entity, or to the dependency reference for the overridden
5ec5b8c1
ES
1017 -- entity.
1018
1019 Oref_Line : Nat;
1020 Oref_Col : Nat;
e14c931f 1021 -- These two fields are set to the line and column of the overridden
5ec5b8c1
ES
1022 -- entity.
1023
d23b8f57
RK
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
250db549
EB
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
d23b8f57
RK
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
250db549
EB
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.
d23b8f57
RK
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
250db549
EB
1068 -- Array_Index_Reference = reference to the index of an array
1069 -- Interface_Reference = reference to an interface implemented
1070 -- by the type
d23b8f57
RK
1071 -- See description in lib-xref.ads for further details
1072
226ada7a 1073 Col : Nat;
d23b8f57 1074 -- Column number for the reference
226ada7a 1075
250db549
EB
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
226ada7a
GB
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.
217efe16
ES
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
516785cc
AC
1087
1088 Imported_Lang : Name_Id := No_Name;
1089 Imported_Name : Name_Id := No_Name;
1090 -- Language and name of imported entity reference
d23b8f57
RK
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
69e6ee2f
HK
1101 ----------------------------
1102 -- Invocation Graph Types --
1103 ----------------------------
1104
9795b203
HK
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
69e6ee2f
HK
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
69e6ee2f 1126 -- The following type enumerates all possible placements of an invocation
9795b203 1127 -- construct's spec and body with respect to the unit it is declared in.
69e6ee2f 1128
9795b203 1129 type Declaration_Placement_Kind is
69e6ee2f 1130 (In_Body,
9795b203
HK
1131 -- The declaration of the invocation construct is within the body of the
1132 -- unit it is declared in.
69e6ee2f
HK
1133
1134 In_Spec,
9795b203
HK
1135 -- The declaration of the invocation construct is within the spec of the
1136 -- unit it is declared in.
69e6ee2f 1137
9795b203
HK
1138 No_Declaration_Placement);
1139 -- The invocation construct does not have a declaration
69e6ee2f
HK
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
69e6ee2f
HK
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
9795b203 1184 -- The following type enumerates all possible invocation-graph ALI lines
69e6ee2f
HK
1185
1186 type Invocation_Graph_Line_Kind is
1187 (Invocation_Construct_Line,
9795b203 1188 Invocation_Graph_Attributes_Line,
69e6ee2f
HK
1189 Invocation_Relation_Line);
1190
69e6ee2f
HK
1191 ----------------------------------
1192 -- Invocation Graph Subprograms --
1193 ----------------------------------
1194
1195 procedure Add_Invocation_Construct
9795b203
HK
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);
69e6ee2f 1201 pragma Inline (Add_Invocation_Construct);
9795b203
HK
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.
69e6ee2f
HK
1205
1206 procedure Add_Invocation_Relation
9795b203
HK
1207 (Extra : Name_Id;
1208 Invoker : Invocation_Signature_Id;
1209 Kind : Invocation_Kind;
1210 Target : Invocation_Signature_Id;
69e6ee2f
HK
1211 Update_Units : Boolean := True);
1212 pragma Inline (Add_Invocation_Relation);
9795b203
HK
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.
69e6ee2f 1216
9795b203
HK
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.
69e6ee2f 1222
9795b203
HK
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
69e6ee2f
HK
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
9795b203
HK
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
69e6ee2f
HK
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);
9795b203
HK
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
3eb5e54a
HK
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
9795b203
HK
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);
3eb5e54a
HK
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
69e6ee2f
HK
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
9795b203
HK
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
69e6ee2f
HK
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);
9795b203 1309 -- Obtain the character encoding for invocation line kind Kind
69e6ee2f
HK
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
9795b203
HK
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
1c4aefb6
AC
1353 function IS_Scope (IS_Id : Invocation_Signature_Id) return Name_Id;
1354 pragma Inline (IS_Scope);
9795b203
HK
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
d23b8f57
RK
1382 --------------------------------------
1383 -- Subprograms for Reading ALI File --
1384 --------------------------------------
1385
1386 procedure Initialize_ALI;
5f3ab6fb 1387 -- Initialize the ALI tables. Also resets all switch values to defaults
d23b8f57
RK
1388
1389 function Scan_ALI
5d993afd
VC
1390 (F : File_Name_Type;
1391 T : Text_Buffer_Ptr;
1392 Ignore_ED : Boolean;
1393 Err : Boolean;
5d993afd
VC
1394 Ignore_Lines : String := "X";
1395 Ignore_Errors : Boolean := False;
1396 Directly_Scanned : Boolean := False) return ALI_Id;
d23b8f57
RK
1397 -- Given the text, T, of an ALI file, F, scan and store the information
1398 -- from the file, and return the Id of the resulting entry in the ALI
1399 -- table. Switch settings may be modified as described above in the
1400 -- switch description settings.
1401 --
1402 -- Ignore_ED is normally False. If set to True, it indicates that
bde33286 1403 -- all AD/ED (elaboration desirable) indications in the ALI file are
217efe16
ES
1404 -- to be ignored. This parameter is obsolete now that the -f switch
1405 -- is removed from gnatbind, and should be removed ???
d23b8f57
RK
1406 --
1407 -- Err determines the action taken on an incorrectly formatted file.
1408 -- If Err is False, then an error message is output, and the program
1409 -- is terminated. If Err is True, then no error message is output,
1410 -- and No_ALI_Id is returned.
1411 --
fbf5a39b
AC
1412 -- Ignore_Lines requests that Scan_ALI ignore any lines that start
1413 -- with any given key character. The default value of X causes all
1414 -- Xref lines to be ignored. The corresponding data in the ALI
16b05213 1415 -- tables will not be filled in this case. It is not possible
fbf5a39b
AC
1416 -- to ignore U (unit) lines, they are always read.
1417 --
2e071734
AC
1418 -- Ignore_Errors is normally False. If it is set True, then Scan_ALI
1419 -- will do its best to scan through a file and extract all information
1420 -- it can, even if there are errors. In this case Err is only set if
1421 -- Scan_ALI was completely unable to process the file (e.g. it did not
1422 -- look like an ALI file at all). Ignore_Errors is intended to improve
1423 -- the downward compatibility of new compilers with old tools.
5d993afd
VC
1424 --
1425 -- Directly_Scanned is normally False. If it is set to True, then the
1426 -- units (spec and/or body) corresponding to the ALI file are marked as
1427 -- such. It is used to decide for what units gnatbind should generate
1428 -- the symbols corresponding to 'Version or 'Body_Version in
1429 -- Stand-Alone Libraries.
d23b8f57
RK
1430
1431end ALI;