1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
9 -- Copyright (C) 1996-2016, Free Software Foundation, Inc. --
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. --
21 -- GNAT was originally developed by the GNAT team at New York University. --
22 -- Extensive contributions were provided by Ada Core Technologies Inc. --
24 ------------------------------------------------------------------------------
26 with Alloc
; use Alloc
;
27 with Atree
; use Atree
;
28 with Debug
; use Debug
;
29 with Einfo
; use Einfo
;
30 with Nlists
; use Nlists
;
31 with Nmake
; use Nmake
;
33 with Output
; use Output
;
34 with Sem_Aux
; use Sem_Aux
;
35 with Sem_Eval
; use Sem_Eval
;
36 with Sem_Util
; use Sem_Util
;
37 with Sinfo
; use Sinfo
;
38 with Stand
; use Stand
;
39 with Stringt
; use Stringt
;
41 with Tbuild
; use Tbuild
;
42 with Urealp
; use Urealp
;
44 package body Exp_Dbug
is
46 -- The following table is used to queue up the entities passed as
47 -- arguments to Qualify_Entity_Names for later processing when
48 -- Qualify_All_Entity_Names is called.
50 package Name_Qualify_Units
is new Table
.Table
(
51 Table_Component_Type
=> Node_Id
,
52 Table_Index_Type
=> Nat
,
54 Table_Initial
=> Alloc
.Name_Qualify_Units_Initial
,
55 Table_Increment
=> Alloc
.Name_Qualify_Units_Increment
,
56 Table_Name
=> "Name_Qualify_Units");
58 --------------------------------
59 -- Use of Qualification Flags --
60 --------------------------------
62 -- There are two flags used to keep track of qualification of entities
64 -- Has_Fully_Qualified_Name
67 -- The difference between these is as follows. Has_Qualified_Name is
68 -- set to indicate that the name has been qualified as required by the
69 -- spec of this package. As described there, this may involve the full
70 -- qualification for the name, but for some entities, notably procedure
71 -- local variables, this full qualification is not required.
73 -- The flag Has_Fully_Qualified_Name is set if indeed the name has been
74 -- fully qualified in the Ada sense. If Has_Fully_Qualified_Name is set,
75 -- then Has_Qualified_Name is also set, but the other way round is not
78 -- Consider the following example:
85 -- Here B is a procedure local variable, so it does not need fully
86 -- qualification. The flag Has_Qualified_Name will be set on the
87 -- first attempt to qualify B, to indicate that the job is done
88 -- and need not be redone.
90 -- But Y is qualified as x__y, since procedures are always fully
91 -- qualified, so the first time that an attempt is made to qualify
92 -- the name y, it will be replaced by x__y, and both flags are set.
94 -- Why the two flags? Well there are cases where we derive type names
95 -- from object names. As noted in the spec, type names are always
96 -- fully qualified. Suppose for example that the backend has to build
97 -- a padded type for variable B. then it will construct the PAD name
98 -- from B, but it requires full qualification, so the fully qualified
99 -- type name will be x__b___PAD. The two flags allow the circuit for
100 -- building this name to realize efficiently that b needs further
107 -- The string defined here (and its associated length) is used to gather
108 -- the homonym string that will be appended to Name_Buffer when the name
109 -- is complete. Strip_Suffixes appends to this string as does
110 -- Append_Homonym_Number, and Output_Homonym_Numbers_Suffix appends the
111 -- string to the end of Name_Buffer.
113 Homonym_Numbers
: String (1 .. 256);
114 Homonym_Len
: Natural := 0;
116 ----------------------
117 -- Local Procedures --
118 ----------------------
120 procedure Add_Uint_To_Buffer
(U
: Uint
);
121 -- Add image of universal integer to Name_Buffer, updating Name_Len
123 procedure Add_Real_To_Buffer
(U
: Ureal
);
124 -- Add nnn_ddd to Name_Buffer, where nnn and ddd are integer values of
125 -- the normalized numerator and denominator of the given real value.
127 procedure Append_Homonym_Number
(E
: Entity_Id
);
128 -- If the entity E has homonyms in the same scope, then make an entry
129 -- in the Homonym_Numbers array, bumping Homonym_Count accordingly.
131 function Bounds_Match_Size
(E
: Entity_Id
) return Boolean;
132 -- Determine whether the bounds of E match the size of the type. This is
133 -- used to determine whether encoding is required for a discrete type.
135 function Is_Handled_Scale_Factor
(U
: Ureal
) return Boolean;
136 -- The argument U is the Small_Value of a fixed-point type. This function
137 -- determines whether the back-end can handle this scale factor. When it
138 -- cannot, we have to output a GNAT encoding for the corresponding type.
140 procedure Output_Homonym_Numbers_Suffix
;
141 -- If homonym numbers are stored, then output them into Name_Buffer
143 procedure Prepend_String_To_Buffer
(S
: String);
144 -- Prepend given string to the contents of the string buffer, updating
145 -- the value in Name_Len (i.e. string is added at start of buffer).
147 procedure Prepend_Uint_To_Buffer
(U
: Uint
);
148 -- Prepend image of universal integer to Name_Buffer, updating Name_Len
150 procedure Qualify_Entity_Name
(Ent
: Entity_Id
);
151 -- If not already done, replaces the Chars field of the given entity
152 -- with the appropriate fully qualified name.
154 procedure Reset_Buffers
;
155 -- Reset the contents of Name_Buffer and Homonym_Numbers by setting their
156 -- respective lengths to zero.
158 procedure Strip_Suffixes
(BNPE_Suffix_Found
: in out Boolean);
159 -- Given an qualified entity name in Name_Buffer, remove any plain X or
160 -- X{nb} qualification suffix. The contents of Name_Buffer is not changed
161 -- but Name_Len may be adjusted on return to remove the suffix. If a
162 -- BNPE suffix is found and stripped, then BNPE_Suffix_Found is set to
163 -- True. If no suffix is found, then BNPE_Suffix_Found is not modified.
164 -- This routine also searches for a homonym suffix, and if one is found
165 -- it is also stripped, and the entries are added to the global homonym
166 -- list (Homonym_Numbers) so that they can later be put back.
168 ------------------------
169 -- Add_Real_To_Buffer --
170 ------------------------
172 procedure Add_Real_To_Buffer
(U
: Ureal
) is
174 Add_Uint_To_Buffer
(Norm_Num
(U
));
175 Add_Str_To_Name_Buffer
("_");
176 Add_Uint_To_Buffer
(Norm_Den
(U
));
177 end Add_Real_To_Buffer
;
179 ------------------------
180 -- Add_Uint_To_Buffer --
181 ------------------------
183 procedure Add_Uint_To_Buffer
(U
: Uint
) is
186 Add_Uint_To_Buffer
(-U
);
187 Add_Char_To_Name_Buffer
('m');
189 UI_Image
(U
, Decimal
);
190 Add_Str_To_Name_Buffer
(UI_Image_Buffer
(1 .. UI_Image_Length
));
192 end Add_Uint_To_Buffer
;
194 ---------------------------
195 -- Append_Homonym_Number --
196 ---------------------------
198 procedure Append_Homonym_Number
(E
: Entity_Id
) is
200 procedure Add_Nat_To_H
(Nr
: Nat
);
201 -- Little procedure to append Nr to Homonym_Numbers
207 procedure Add_Nat_To_H
(Nr
: Nat
) is
210 Add_Nat_To_H
(Nr
/ 10);
213 Homonym_Len
:= Homonym_Len
+ 1;
214 Homonym_Numbers
(Homonym_Len
) :=
215 Character'Val (Nr
mod 10 + Character'Pos ('0'));
218 -- Start of processing for Append_Homonym_Number
221 if Has_Homonym
(E
) then
223 H
: Entity_Id
:= Homonym
(E
);
227 while Present
(H
) loop
228 if Scope
(H
) = Scope
(E
) then
235 if Homonym_Len
> 0 then
236 Homonym_Len
:= Homonym_Len
+ 1;
237 Homonym_Numbers
(Homonym_Len
) := '_';
243 end Append_Homonym_Number
;
245 -----------------------
246 -- Bounds_Match_Size --
247 -----------------------
249 function Bounds_Match_Size
(E
: Entity_Id
) return Boolean is
253 if not Is_OK_Static_Subtype
(E
) then
256 elsif Is_Integer_Type
(E
)
257 and then Subtypes_Statically_Match
(E
, Base_Type
(E
))
261 -- Here we check if the static bounds match the natural size, which is
262 -- the size passed through with the debugging information. This is the
263 -- Esize rounded up to 8, 16, 32 or 64 as appropriate.
267 Umark
: constant Uintp
.Save_Mark
:= Uintp
.Mark
;
271 if Esize
(E
) <= 8 then
273 elsif Esize
(E
) <= 16 then
275 elsif Esize
(E
) <= 32 then
281 if Is_Modular_Integer_Type
(E
) or else Is_Enumeration_Type
(E
) then
283 Expr_Rep_Value
(Type_Low_Bound
(E
)) = 0
285 2 ** Siz
- Expr_Rep_Value
(Type_High_Bound
(E
)) = 1;
289 Expr_Rep_Value
(Type_Low_Bound
(E
)) + 2 ** (Siz
- 1) = 0
291 2 ** (Siz
- 1) - Expr_Rep_Value
(Type_High_Bound
(E
)) = 1;
298 end Bounds_Match_Size
;
300 --------------------------------
301 -- Debug_Renaming_Declaration --
302 --------------------------------
304 function Debug_Renaming_Declaration
(N
: Node_Id
) return Node_Id
is
305 Loc
: constant Source_Ptr
:= Sloc
(N
);
306 Ent
: constant Node_Id
:= Defining_Entity
(N
);
307 Nam
: constant Node_Id
:= Name
(N
);
313 Enable
: Boolean := Nkind
(N
) = N_Package_Renaming_Declaration
;
314 -- By default, we do not generate an encoding for renaming. This is
315 -- however done (in which case this is set to True) in a few cases:
316 -- - when a package is renamed,
317 -- - when the renaming involves a packed array,
318 -- - when the renaming involves a packed record.
320 procedure Enable_If_Packed_Array
(N
: Node_Id
);
321 -- Enable encoding generation if N is a packed array
323 function Output_Subscript
(N
: Node_Id
; S
: String) return Boolean;
324 -- Outputs a single subscript value as ?nnn (subscript is compile time
325 -- known value with value nnn) or as ?e (subscript is local constant
326 -- with name e), where S supplies the proper string to use for ?.
327 -- Returns False if the subscript is not of an appropriate type to
328 -- output in one of these two forms. The result is prepended to the
329 -- name stored in Name_Buffer.
331 ----------------------------
332 -- Enable_If_Packed_Array --
333 ----------------------------
335 procedure Enable_If_Packed_Array
(N
: Node_Id
) is
336 T
: constant Entity_Id
:= Underlying_Type
(Etype
(N
));
339 Enable
or else (Ekind
(T
) in Array_Kind
340 and then Present
(Packed_Array_Impl_Type
(T
)));
341 end Enable_If_Packed_Array
;
343 ----------------------
344 -- Output_Subscript --
345 ----------------------
347 function Output_Subscript
(N
: Node_Id
; S
: String) return Boolean is
349 if Compile_Time_Known_Value
(N
) then
350 Prepend_Uint_To_Buffer
(Expr_Value
(N
));
352 elsif Nkind
(N
) = N_Identifier
353 and then Scope
(Entity
(N
)) = Scope
(Ent
)
354 and then Ekind
(Entity
(N
)) = E_Constant
356 Prepend_String_To_Buffer
(Get_Name_String
(Chars
(Entity
(N
))));
362 Prepend_String_To_Buffer
(S
);
364 end Output_Subscript
;
366 -- Start of processing for Debug_Renaming_Declaration
369 if not Comes_From_Source
(N
)
370 and then not Needs_Debug_Info
(Ent
)
375 -- Get renamed entity and compute suffix
385 when N_Expanded_Name
=>
387 -- The entity field for an N_Expanded_Name is on the expanded
388 -- name node itself, so we are done here too.
392 when N_Selected_Component
=>
394 First_Bit
: constant Uint
:=
395 Normalized_First_Bit
(Entity
(Selector_Name
(Ren
)));
399 or else Is_Packed
(Underlying_Type
(Etype
(Prefix
(Ren
))))
400 or else (First_Bit
/= No_Uint
401 and then First_Bit
/= Uint_0
));
403 Prepend_String_To_Buffer
404 (Get_Name_String
(Chars
(Selector_Name
(Ren
))));
405 Prepend_String_To_Buffer
("XR");
408 when N_Indexed_Component
=>
413 Enable_If_Packed_Array
(Prefix
(Ren
));
415 X
:= Last
(Expressions
(Ren
));
416 while Present
(X
) loop
417 if not Output_Subscript
(X
, "XS") then
418 Set_Materialize_Entity
(Ent
);
429 Enable_If_Packed_Array
(Prefix
(Ren
));
430 Typ
:= Etype
(First_Index
(Etype
(Nam
)));
432 if not Output_Subscript
(Type_High_Bound
(Typ
), "XS") then
433 Set_Materialize_Entity
(Ent
);
437 if not Output_Subscript
(Type_Low_Bound
(Typ
), "XL") then
438 Set_Materialize_Entity
(Ent
);
444 when N_Explicit_Dereference
=>
445 Prepend_String_To_Buffer
("XA");
448 -- For now, anything else simply results in no translation
451 Set_Materialize_Entity
(Ent
);
456 -- If we found no reason here to emit an encoding, stop now
459 Set_Materialize_Entity
(Ent
);
463 Prepend_String_To_Buffer
("___XE");
465 -- Include the designation of the form of renaming
468 when N_Object_Renaming_Declaration
=>
469 Prepend_String_To_Buffer
("___XR");
471 when N_Exception_Renaming_Declaration
=>
472 Prepend_String_To_Buffer
("___XRE");
474 when N_Package_Renaming_Declaration
=>
475 Prepend_String_To_Buffer
("___XRP");
481 -- Add the name of the renaming entity to the front
483 Prepend_String_To_Buffer
(Get_Name_String
(Chars
(Ent
)));
485 -- If it is a child unit create a fully qualified name, to disambiguate
486 -- multiple child units with the same name and different parents.
488 if Nkind
(N
) = N_Package_Renaming_Declaration
489 and then Is_Child_Unit
(Ent
)
491 Prepend_String_To_Buffer
("__");
492 Prepend_String_To_Buffer
493 (Get_Name_String
(Chars
(Scope
(Ent
))));
496 -- Create the special object whose name is the debug encoding for the
497 -- renaming declaration.
499 -- For now, the object name contains the suffix encoding for the renamed
500 -- object, but not the name of the leading entity. The object is linked
501 -- the renamed entity using the Debug_Renaming_Link field. Then the
502 -- Qualify_Entity_Name procedure uses this link to create the proper
503 -- fully qualified name.
505 -- The reason we do things this way is that we really need to copy the
506 -- qualification of the renamed entity, and it is really much easier to
507 -- do this after the renamed entity has itself been fully qualified.
509 Obj
:= Make_Defining_Identifier
(Loc
, Chars
=> Name_Enter
);
511 Make_Object_Declaration
(Loc
,
512 Defining_Identifier
=> Obj
,
513 Object_Definition
=> New_Occurrence_Of
514 (Standard_Debug_Renaming_Type
, Loc
));
516 Set_Debug_Renaming_Link
(Obj
, Entity
(Ren
));
518 Set_Debug_Info_Needed
(Obj
);
520 -- The renamed entity may be a temporary, e.g. the result of an
521 -- implicit dereference in an iterator. Indicate that the temporary
522 -- itself requires debug information. If the renamed entity comes
523 -- from source this is a no-op.
525 Set_Debug_Info_Needed
(Entity
(Ren
));
527 -- Mark the object as internal so that it won't be initialized when
528 -- pragma Initialize_Scalars or Normalize_Scalars is in use.
530 Set_Is_Internal
(Obj
);
534 -- If we get an exception, just figure it is a case that we cannot
535 -- successfully handle using our current approach, since this is
536 -- only for debugging, no need to take the compilation with us.
540 return Make_Null_Statement
(Loc
);
541 end Debug_Renaming_Declaration
;
543 -----------------------------
544 -- Is_Handled_Scale_Factor --
545 -----------------------------
547 function Is_Handled_Scale_Factor
(U
: Ureal
) return Boolean is
549 -- Keep in sync with gigi (see E_*_Fixed_Point_Type handling in
550 -- decl.c:gnat_to_gnu_entity).
552 if UI_Eq
(Numerator
(U
), Uint_1
) then
553 if Rbase
(U
) = 2 or else Rbase
(U
) = 10 then
559 (UI_Is_In_Int_Range
(Norm_Num
(U
))
561 UI_Is_In_Int_Range
(Norm_Den
(U
)));
562 end Is_Handled_Scale_Factor
;
564 ----------------------
565 -- Get_Encoded_Name --
566 ----------------------
568 -- Note: see spec for details on encodings
570 procedure Get_Encoded_Name
(E
: Entity_Id
) is
571 Has_Suffix
: Boolean;
574 -- If not generating code, there is no need to create encoded names, and
575 -- problems when the back-end is called to annotate types without full
576 -- code generation. See comments in Get_External_Name for additional
579 -- However we do create encoded names if the back end is active, even
580 -- if Operating_Mode got reset. Otherwise any serious error reported
581 -- by the backend calling Error_Msg changes the Compilation_Mode to
582 -- Check_Semantics, which disables the functionality of this routine,
583 -- causing the generation of spurious additional errors.
585 -- Couldn't we just test Original_Operating_Mode here? ???
587 if Operating_Mode
/= Generate_Code
and then not Generating_Code
then
591 Get_Name_String
(Chars
(E
));
593 -- Nothing to do if we do not have a type
597 -- Or if this is an enumeration base type
599 or else (Is_Enumeration_Type
(E
) and then Is_Base_Type
(E
))
601 -- Or if this is a dummy type for a renaming
603 or else (Name_Len
>= 3 and then
604 Name_Buffer
(Name_Len
- 2 .. Name_Len
) = "_XR")
606 or else (Name_Len
>= 4 and then
607 (Name_Buffer
(Name_Len
- 3 .. Name_Len
) = "_XRE"
609 Name_Buffer
(Name_Len
- 3 .. Name_Len
) = "_XRP"))
611 -- For all these cases, just return the name unchanged
614 Name_Buffer
(Name_Len
+ 1) := ASCII
.NUL
;
620 -- Fixed-point case: generate GNAT encodings when asked to or when we
621 -- know the back-end will not be able to handle the scale factor.
623 if Is_Fixed_Point_Type
(E
)
624 and then (GNAT_Encodings
/= DWARF_GNAT_Encodings_Minimal
625 or else not Is_Handled_Scale_Factor
(Small_Value
(E
)))
627 Get_External_Name
(E
, True, "XF_");
628 Add_Real_To_Buffer
(Delta_Value
(E
));
630 if Small_Value
(E
) /= Delta_Value
(E
) then
631 Add_Str_To_Name_Buffer
("_");
632 Add_Real_To_Buffer
(Small_Value
(E
));
635 -- Discrete case where bounds do not match size. Not necessary if we can
636 -- emit standard DWARF.
638 elsif GNAT_Encodings
/= DWARF_GNAT_Encodings_Minimal
639 and then Is_Discrete_Type
(E
)
640 and then not Bounds_Match_Size
(E
)
643 Lo
: constant Node_Id
:= Type_Low_Bound
(E
);
644 Hi
: constant Node_Id
:= Type_High_Bound
(E
);
646 Lo_Con
: constant Boolean := Compile_Time_Known_Value
(Lo
);
647 Hi_Con
: constant Boolean := Compile_Time_Known_Value
(Hi
);
649 Lo_Discr
: constant Boolean :=
650 Nkind
(Lo
) = N_Identifier
651 and then Ekind
(Entity
(Lo
)) = E_Discriminant
;
653 Hi_Discr
: constant Boolean :=
654 Nkind
(Hi
) = N_Identifier
655 and then Ekind
(Entity
(Hi
)) = E_Discriminant
;
657 Lo_Encode
: constant Boolean := Lo_Con
or Lo_Discr
;
658 Hi_Encode
: constant Boolean := Hi_Con
or Hi_Discr
;
660 Biased
: constant Boolean := Has_Biased_Representation
(E
);
664 Get_External_Name
(E
, True, "XB");
666 Get_External_Name
(E
, True, "XD");
669 if Lo_Encode
or Hi_Encode
then
671 Add_Str_To_Name_Buffer
("_");
675 Add_Str_To_Name_Buffer
("LU_");
677 Add_Str_To_Name_Buffer
("L_");
680 Add_Str_To_Name_Buffer
("U_");
685 Add_Uint_To_Buffer
(Expr_Rep_Value
(Lo
));
687 Get_Name_String_And_Append
(Chars
(Entity
(Lo
)));
690 if Lo_Encode
and Hi_Encode
then
691 Add_Str_To_Name_Buffer
("__");
695 Add_Uint_To_Buffer
(Expr_Rep_Value
(Hi
));
697 Get_Name_String_And_Append
(Chars
(Entity
(Hi
)));
702 -- For all other cases, the encoded name is the normal type name
706 Get_External_Name
(E
);
709 if Debug_Flag_B
and then Has_Suffix
then
710 Write_Str
("**** type ");
711 Write_Name
(Chars
(E
));
712 Write_Str
(" is encoded as ");
713 Write_Str
(Name_Buffer
(1 .. Name_Len
));
717 Name_Buffer
(Name_Len
+ 1) := ASCII
.NUL
;
718 end Get_Encoded_Name
;
720 -----------------------
721 -- Get_External_Name --
722 -----------------------
724 procedure Get_External_Name
726 Has_Suffix
: Boolean := False;
727 Suffix
: String := "")
729 procedure Get_Qualified_Name_And_Append
(Entity
: Entity_Id
);
730 -- Appends fully qualified name of given entity to Name_Buffer
732 -----------------------------------
733 -- Get_Qualified_Name_And_Append --
734 -----------------------------------
736 procedure Get_Qualified_Name_And_Append
(Entity
: Entity_Id
) is
738 -- If the entity is a compilation unit, its scope is Standard,
739 -- there is no outer scope, and the no further qualification
742 -- If the front end has already computed a fully qualified name,
743 -- then it is also the case that no further qualification is
746 if Present
(Scope
(Scope
(Entity
)))
747 and then not Has_Fully_Qualified_Name
(Entity
)
749 Get_Qualified_Name_And_Append
(Scope
(Entity
));
750 Add_Str_To_Name_Buffer
("__");
751 Get_Name_String_And_Append
(Chars
(Entity
));
752 Append_Homonym_Number
(Entity
);
755 Get_Name_String_And_Append
(Chars
(Entity
));
757 end Get_Qualified_Name_And_Append
;
761 E
: Entity_Id
:= Entity
;
763 -- Start of processing for Get_External_Name
766 -- If we are not in code generation mode, this procedure may still be
767 -- called from Back_End (more specifically - from gigi for doing type
768 -- representation annotation or some representation-specific checks).
769 -- But in this mode there is no need to mess with external names.
771 -- Furthermore, the call causes difficulties in this case because the
772 -- string representing the homonym number is not correctly reset as a
773 -- part of the call to Output_Homonym_Numbers_Suffix (which is not
776 if Operating_Mode
/= Generate_Code
then
782 -- If this is a child unit, we want the child
784 if Nkind
(E
) = N_Defining_Program_Unit_Name
then
785 E
:= Defining_Identifier
(Entity
);
788 -- Case of interface name being used
790 if Ekind_In
(E
, E_Constant
,
795 and then Present
(Interface_Name
(E
))
796 and then No
(Address_Clause
(E
))
797 and then not Has_Suffix
799 Add_String_To_Name_Buffer
(Strval
(Interface_Name
(E
)));
801 -- All other cases besides the interface name case
804 -- If this is a library level subprogram (i.e. a subprogram that is a
805 -- compilation unit other than a subunit), then we prepend _ada_ to
806 -- ensure distinctions required as described in the spec.
808 -- Check explicitly for child units, because those are not flagged
809 -- as Compilation_Units by lib. Should they be ???
812 and then (Is_Compilation_Unit
(E
) or Is_Child_Unit
(E
))
813 and then not Has_Suffix
815 Add_Str_To_Name_Buffer
("_ada_");
818 -- If the entity is a subprogram instance that is not a compilation
819 -- unit, generate the name of the original Ada entity, which is the
822 if Is_Generic_Instance
(E
)
823 and then Is_Subprogram
(E
)
824 and then not Is_Compilation_Unit
(Scope
(E
))
825 and then Ekind_In
(Scope
(E
), E_Package
, E_Package_Body
)
826 and then Present
(Related_Instance
(Scope
(E
)))
828 E
:= Related_Instance
(Scope
(E
));
831 Get_Qualified_Name_And_Append
(E
);
835 Add_Str_To_Name_Buffer
("___");
836 Add_Str_To_Name_Buffer
(Suffix
);
839 Name_Buffer
(Name_Len
+ 1) := ASCII
.NUL
;
840 end Get_External_Name
;
842 --------------------------
843 -- Get_Variant_Encoding --
844 --------------------------
846 procedure Get_Variant_Encoding
(V
: Node_Id
) is
849 procedure Choice_Val
(Typ
: Character; Choice
: Node_Id
);
850 -- Output encoded value for a single choice value. Typ is the key
851 -- character ('S', 'F', or 'T') that precedes the choice value.
857 procedure Choice_Val
(Typ
: Character; Choice
: Node_Id
) is
859 if Nkind
(Choice
) = N_Integer_Literal
then
860 Add_Char_To_Name_Buffer
(Typ
);
861 Add_Uint_To_Buffer
(Intval
(Choice
));
863 -- Character literal with no entity present (this is the case
864 -- Standard.Character or Standard.Wide_Character as root type)
866 elsif Nkind
(Choice
) = N_Character_Literal
867 and then No
(Entity
(Choice
))
869 Add_Char_To_Name_Buffer
(Typ
);
870 Add_Uint_To_Buffer
(Char_Literal_Value
(Choice
));
874 Ent
: constant Entity_Id
:= Entity
(Choice
);
877 if Ekind
(Ent
) = E_Enumeration_Literal
then
878 Add_Char_To_Name_Buffer
(Typ
);
879 Add_Uint_To_Buffer
(Enumeration_Rep
(Ent
));
882 pragma Assert
(Ekind
(Ent
) = E_Constant
);
883 Choice_Val
(Typ
, Constant_Value
(Ent
));
889 -- Start of processing for Get_Variant_Encoding
894 Choice
:= First
(Discrete_Choices
(V
));
895 while Present
(Choice
) loop
896 if Nkind
(Choice
) = N_Others_Choice
then
897 Add_Char_To_Name_Buffer
('O');
899 elsif Nkind
(Choice
) = N_Range
then
900 Choice_Val
('R', Low_Bound
(Choice
));
901 Choice_Val
('T', High_Bound
(Choice
));
903 elsif Is_Entity_Name
(Choice
)
904 and then Is_Type
(Entity
(Choice
))
906 Choice_Val
('R', Type_Low_Bound
(Entity
(Choice
)));
907 Choice_Val
('T', Type_High_Bound
(Entity
(Choice
)));
909 elsif Nkind
(Choice
) = N_Subtype_Indication
then
911 Rang
: constant Node_Id
:=
912 Range_Expression
(Constraint
(Choice
));
914 Choice_Val
('R', Low_Bound
(Rang
));
915 Choice_Val
('T', High_Bound
(Rang
));
919 Choice_Val
('S', Choice
);
925 Name_Buffer
(Name_Len
+ 1) := ASCII
.NUL
;
929 VP
: constant Node_Id
:= Parent
(V
); -- Variant_Part
930 CL
: constant Node_Id
:= Parent
(VP
); -- Component_List
931 RD
: constant Node_Id
:= Parent
(CL
); -- Record_Definition
932 FT
: constant Node_Id
:= Parent
(RD
); -- Full_Type_Declaration
935 Write_Str
("**** variant for type ");
936 Write_Name
(Chars
(Defining_Identifier
(FT
)));
937 Write_Str
(" is encoded as ");
938 Write_Str
(Name_Buffer
(1 .. Name_Len
));
942 end Get_Variant_Encoding
;
944 -----------------------------------------
945 -- Build_Subprogram_Instance_Renamings --
946 -----------------------------------------
948 procedure Build_Subprogram_Instance_Renamings
957 E
:= First_Entity
(Wrapper
);
958 while Present
(E
) loop
959 if Nkind
(Parent
(E
)) = N_Object_Declaration
960 and then Is_Elementary_Type
(Etype
(E
))
962 Loc
:= Sloc
(Expression
(Parent
(E
)));
963 Decl
:= Make_Object_Renaming_Declaration
(Loc
,
964 Defining_Identifier
=>
965 Make_Defining_Identifier
(Loc
, Chars
(E
)),
966 Subtype_Mark
=> New_Occurrence_Of
(Etype
(E
), Loc
),
967 Name
=> New_Occurrence_Of
(E
, Loc
));
969 Append
(Decl
, Declarations
(N
));
970 Set_Needs_Debug_Info
(Defining_Identifier
(Decl
));
975 end Build_Subprogram_Instance_Renamings
;
977 ------------------------------------
978 -- Get_Secondary_DT_External_Name --
979 ------------------------------------
981 procedure Get_Secondary_DT_External_Name
983 Ancestor_Typ
: Entity_Id
;
987 Get_External_Name
(Typ
);
989 if Ancestor_Typ
/= Typ
then
991 Len
: constant Natural := Name_Len
;
992 Save_Str
: constant String (1 .. Name_Len
)
993 := Name_Buffer
(1 .. Name_Len
);
995 Get_External_Name
(Ancestor_Typ
);
997 -- Append the extended name of the ancestor to the
998 -- extended name of Typ
1000 Name_Buffer
(Len
+ 2 .. Len
+ Name_Len
+ 1) :=
1001 Name_Buffer
(1 .. Name_Len
);
1002 Name_Buffer
(1 .. Len
) := Save_Str
;
1003 Name_Buffer
(Len
+ 1) := '_';
1004 Name_Len
:= Len
+ Name_Len
+ 1;
1008 Add_Nat_To_Name_Buffer
(Suffix_Index
);
1009 end Get_Secondary_DT_External_Name
;
1011 ---------------------------------
1012 -- Make_Packed_Array_Impl_Type_Name --
1013 ---------------------------------
1015 function Make_Packed_Array_Impl_Type_Name
1021 Get_Name_String
(Chars
(Typ
));
1022 Add_Str_To_Name_Buffer
("___XP");
1023 Add_Uint_To_Buffer
(Csize
);
1025 end Make_Packed_Array_Impl_Type_Name
;
1027 -----------------------------------
1028 -- Output_Homonym_Numbers_Suffix --
1029 -----------------------------------
1031 procedure Output_Homonym_Numbers_Suffix
is
1035 if Homonym_Len
> 0 then
1037 -- Check for all 1's, in which case we do not output
1041 exit when Homonym_Numbers
(J
) /= '1';
1043 -- If we reached end of string we do not output
1045 if J
= Homonym_Len
then
1050 exit when Homonym_Numbers
(J
+ 1) /= '_';
1054 -- If we exit the loop then suffix must be output
1056 Add_Str_To_Name_Buffer
("__");
1057 Add_Str_To_Name_Buffer
(Homonym_Numbers
(1 .. Homonym_Len
));
1060 end Output_Homonym_Numbers_Suffix
;
1062 ------------------------------
1063 -- Prepend_String_To_Buffer --
1064 ------------------------------
1066 procedure Prepend_String_To_Buffer
(S
: String) is
1067 N
: constant Integer := S
'Length;
1069 Name_Buffer
(1 + N
.. Name_Len
+ N
) := Name_Buffer
(1 .. Name_Len
);
1070 Name_Buffer
(1 .. N
) := S
;
1071 Name_Len
:= Name_Len
+ N
;
1072 end Prepend_String_To_Buffer
;
1074 ----------------------------
1075 -- Prepend_Uint_To_Buffer --
1076 ----------------------------
1078 procedure Prepend_Uint_To_Buffer
(U
: Uint
) is
1081 Prepend_String_To_Buffer
("m");
1082 Prepend_Uint_To_Buffer
(-U
);
1084 UI_Image
(U
, Decimal
);
1085 Prepend_String_To_Buffer
(UI_Image_Buffer
(1 .. UI_Image_Length
));
1087 end Prepend_Uint_To_Buffer
;
1089 ------------------------------
1090 -- Qualify_All_Entity_Names --
1091 ------------------------------
1093 procedure Qualify_All_Entity_Names
is
1099 for J
in Name_Qualify_Units
.First
.. Name_Qualify_Units
.Last
loop
1100 Nod
:= Name_Qualify_Units
.Table
(J
);
1102 -- When a scoping construct is ignored Ghost, it is rewritten as
1103 -- a null statement. Skip such constructs as they no longer carry
1106 if Nkind
(Nod
) = N_Null_Statement
then
1110 E
:= Defining_Entity
(Nod
);
1112 Qualify_Entity_Name
(E
);
1114 -- Normally entities in the qualification list are scopes, but in the
1115 -- case of a library-level package renaming there is an associated
1116 -- variable that encodes the debugger name and that variable is
1117 -- entered in the list since it occurs in the Aux_Decls list of the
1118 -- compilation and doesn't have a normal scope.
1120 if Ekind
(E
) /= E_Variable
then
1121 Ent
:= First_Entity
(E
);
1122 while Present
(Ent
) loop
1124 Qualify_Entity_Name
(Ent
);
1127 -- There are odd cases where Last_Entity (E) = E. This happens
1128 -- in the case of renaming of packages. This test avoids
1129 -- getting stuck in such cases.
1138 end Qualify_All_Entity_Names
;
1140 -------------------------
1141 -- Qualify_Entity_Name --
1142 -------------------------
1144 procedure Qualify_Entity_Name
(Ent
: Entity_Id
) is
1146 Full_Qualify_Name
: String (1 .. Name_Buffer
'Length);
1147 Full_Qualify_Len
: Natural := 0;
1148 -- Used to accumulate fully qualified name of subprogram
1150 procedure Fully_Qualify_Name
(E
: Entity_Id
);
1151 -- Used to qualify a subprogram or type name, where full
1152 -- qualification up to Standard is always used. Name is set
1153 -- in Full_Qualify_Name with the length in Full_Qualify_Len.
1154 -- Note that this routine does not prepend the _ada_ string
1155 -- required for library subprograms (this is done in the back end).
1157 function Is_BNPE
(S
: Entity_Id
) return Boolean;
1158 -- Determines if S is a BNPE, i.e. Body-Nested Package Entity, which
1159 -- is defined to be a package which is immediately nested within a
1162 function Qualify_Needed
(S
: Entity_Id
) return Boolean;
1163 -- Given a scope, determines if the scope is to be included in the
1164 -- fully qualified name, True if so, False if not. Blocks and loops
1165 -- are excluded from a qualified name.
1167 procedure Set_BNPE_Suffix
(E
: Entity_Id
);
1168 -- Recursive routine to append the BNPE qualification suffix. Works
1169 -- from right to left with E being the current entity in the list.
1170 -- The result does NOT have the trailing n's and trailing b stripped.
1171 -- The caller must do this required stripping.
1173 procedure Set_Entity_Name
(E
: Entity_Id
);
1174 -- Internal recursive routine that does most of the work. This routine
1175 -- leaves the result sitting in Name_Buffer and Name_Len.
1177 BNPE_Suffix_Needed
: Boolean := False;
1178 -- Set true if a body-nested package entity suffix is required
1180 Save_Chars
: constant Name_Id
:= Chars
(Ent
);
1181 -- Save original name
1183 ------------------------
1184 -- Fully_Qualify_Name --
1185 ------------------------
1187 procedure Fully_Qualify_Name
(E
: Entity_Id
) is
1188 Discard
: Boolean := False;
1191 -- Ignore empty entry (can happen in error cases)
1196 -- If this we are qualifying entities local to a generic instance,
1197 -- use the name of the original instantiation, not that of the
1198 -- anonymous subprogram in the wrapper package, so that gdb doesn't
1199 -- have to know about these.
1201 elsif Is_Generic_Instance
(E
)
1202 and then Is_Subprogram
(E
)
1203 and then not Comes_From_Source
(E
)
1204 and then not Is_Compilation_Unit
(Scope
(E
))
1206 Fully_Qualify_Name
(Related_Instance
(Scope
(E
)));
1210 -- If we reached fully qualified name, then just copy it
1212 if Has_Fully_Qualified_Name
(E
) then
1213 Get_Name_String
(Chars
(E
));
1214 Strip_Suffixes
(Discard
);
1215 Full_Qualify_Name
(1 .. Name_Len
) := Name_Buffer
(1 .. Name_Len
);
1216 Full_Qualify_Len
:= Name_Len
;
1217 Set_Has_Fully_Qualified_Name
(Ent
);
1219 -- Case of non-fully qualified name
1222 if Scope
(E
) = Standard_Standard
then
1223 Set_Has_Fully_Qualified_Name
(Ent
);
1225 Fully_Qualify_Name
(Scope
(E
));
1226 Full_Qualify_Name
(Full_Qualify_Len
+ 1) := '_';
1227 Full_Qualify_Name
(Full_Qualify_Len
+ 2) := '_';
1228 Full_Qualify_Len
:= Full_Qualify_Len
+ 2;
1231 if Has_Qualified_Name
(E
) then
1232 Get_Unqualified_Name_String
(Chars
(E
));
1234 Get_Name_String
(Chars
(E
));
1237 -- Here we do one step of the qualification
1240 (Full_Qualify_Len
+ 1 .. Full_Qualify_Len
+ Name_Len
) :=
1241 Name_Buffer
(1 .. Name_Len
);
1242 Full_Qualify_Len
:= Full_Qualify_Len
+ Name_Len
;
1243 Append_Homonym_Number
(E
);
1247 BNPE_Suffix_Needed
:= True;
1249 end Fully_Qualify_Name
;
1255 function Is_BNPE
(S
: Entity_Id
) return Boolean is
1257 return Ekind
(S
) = E_Package
and then Is_Package_Body_Entity
(S
);
1260 --------------------
1261 -- Qualify_Needed --
1262 --------------------
1264 function Qualify_Needed
(S
: Entity_Id
) return Boolean is
1266 -- If we got all the way to Standard, then we have certainly
1267 -- fully qualified the name, so set the flag appropriately,
1268 -- and then return False, since we are most certainly done.
1270 if S
= Standard_Standard
then
1271 Set_Has_Fully_Qualified_Name
(Ent
, True);
1274 -- Otherwise figure out if further qualification is required
1277 return Is_Subprogram
(Ent
)
1278 or else Ekind
(Ent
) = E_Subprogram_Body
1279 or else (Ekind
(S
) /= E_Block
1280 and then Ekind
(S
) /= E_Loop
1281 and then not Is_Dynamic_Scope
(S
));
1285 ---------------------
1286 -- Set_BNPE_Suffix --
1287 ---------------------
1289 procedure Set_BNPE_Suffix
(E
: Entity_Id
) is
1290 S
: constant Entity_Id
:= Scope
(E
);
1293 if Qualify_Needed
(S
) then
1294 Set_BNPE_Suffix
(S
);
1297 Add_Char_To_Name_Buffer
('b');
1299 Add_Char_To_Name_Buffer
('n');
1303 Add_Char_To_Name_Buffer
('X');
1305 end Set_BNPE_Suffix
;
1307 ---------------------
1308 -- Set_Entity_Name --
1309 ---------------------
1311 procedure Set_Entity_Name
(E
: Entity_Id
) is
1312 S
: constant Entity_Id
:= Scope
(E
);
1315 -- If we reach an already qualified name, just take the encoding
1316 -- except that we strip the package body suffixes, since these
1317 -- will be separately put on later.
1319 if Has_Qualified_Name
(E
) then
1320 Get_Name_String_And_Append
(Chars
(E
));
1321 Strip_Suffixes
(BNPE_Suffix_Needed
);
1323 -- If the top level name we are adding is itself fully
1324 -- qualified, then that means that the name that we are
1325 -- preparing for the Fully_Qualify_Name call will also
1326 -- generate a fully qualified name.
1328 if Has_Fully_Qualified_Name
(E
) then
1329 Set_Has_Fully_Qualified_Name
(Ent
);
1332 -- Case where upper level name is not encoded yet
1335 -- Recurse if further qualification required
1337 if Qualify_Needed
(S
) then
1338 Set_Entity_Name
(S
);
1339 Add_Str_To_Name_Buffer
("__");
1342 -- Otherwise get name and note if it is a BNPE
1344 Get_Name_String_And_Append
(Chars
(E
));
1347 BNPE_Suffix_Needed
:= True;
1350 Append_Homonym_Number
(E
);
1352 end Set_Entity_Name
;
1354 -- Start of processing for Qualify_Entity_Name
1357 if Has_Qualified_Name
(Ent
) then
1360 -- In formal verification mode, simply append a suffix for homonyms.
1361 -- We used to qualify entity names as full expansion does, but this was
1362 -- removed as this prevents the verification back-end from using a short
1363 -- name for debugging and user interaction. The verification back-end
1364 -- already takes care of qualifying names when needed. Still mark the
1365 -- name as being qualified, as Qualify_Entity_Name may be called more
1366 -- than once on the same entity.
1368 elsif GNATprove_Mode
then
1369 if Has_Homonym
(Ent
) then
1370 Get_Name_String
(Chars
(Ent
));
1371 Append_Homonym_Number
(Ent
);
1372 Output_Homonym_Numbers_Suffix
;
1373 Set_Chars
(Ent
, Name_Enter
);
1376 Set_Has_Qualified_Name
(Ent
);
1379 -- If the entity is a variable encoding the debug name for an object
1380 -- renaming, then the qualified name of the entity associated with the
1381 -- renamed object can now be incorporated in the debug name.
1383 elsif Ekind
(Ent
) = E_Variable
1384 and then Present
(Debug_Renaming_Link
(Ent
))
1387 Qualify_Entity_Name
(Debug_Renaming_Link
(Ent
));
1388 Get_Name_String
(Chars
(Ent
));
1390 -- Retrieve the now-qualified name of the renamed entity and insert
1391 -- it in the middle of the name, just preceding the suffix encoding
1392 -- describing the renamed object.
1395 Renamed_Id
: constant String :=
1396 Get_Name_String
(Chars
(Debug_Renaming_Link
(Ent
)));
1397 Insert_Len
: constant Integer := Renamed_Id
'Length + 1;
1398 Index
: Natural := Name_Len
- 3;
1401 -- Loop backwards through the name to find the start of the "___"
1402 -- sequence associated with the suffix.
1404 while Index
>= Name_Buffer
'First
1405 and then (Name_Buffer
(Index
+ 1) /= '_'
1406 or else Name_Buffer
(Index
+ 2) /= '_'
1407 or else Name_Buffer
(Index
+ 3) /= '_')
1412 pragma Assert
(Name_Buffer
(Index
+ 1 .. Index
+ 3) = "___");
1414 -- Insert an underscore separator and the entity name just in
1415 -- front of the suffix.
1417 Name_Buffer
(Index
+ 1 + Insert_Len
.. Name_Len
+ Insert_Len
) :=
1418 Name_Buffer
(Index
+ 1 .. Name_Len
);
1419 Name_Buffer
(Index
+ 1) := '_';
1420 Name_Buffer
(Index
+ 2 .. Index
+ Insert_Len
) := Renamed_Id
;
1421 Name_Len
:= Name_Len
+ Insert_Len
;
1424 -- Reset the name of the variable to the new name that includes the
1425 -- name of the renamed entity.
1427 Set_Chars
(Ent
, Name_Enter
);
1429 -- If the entity needs qualification by its scope then develop it
1430 -- here, add the variable's name, and again reset the entity name.
1432 if Qualify_Needed
(Scope
(Ent
)) then
1434 Set_Entity_Name
(Scope
(Ent
));
1435 Add_Str_To_Name_Buffer
("__");
1437 Get_Name_String_And_Append
(Chars
(Ent
));
1439 Set_Chars
(Ent
, Name_Enter
);
1442 Set_Has_Qualified_Name
(Ent
);
1445 elsif Is_Subprogram
(Ent
)
1446 or else Ekind
(Ent
) = E_Subprogram_Body
1447 or else Is_Type
(Ent
)
1449 Fully_Qualify_Name
(Ent
);
1450 Name_Len
:= Full_Qualify_Len
;
1451 Name_Buffer
(1 .. Name_Len
) := Full_Qualify_Name
(1 .. Name_Len
);
1453 -- Qualification needed for enumeration literals when generating C code
1454 -- (to simplify their management in the backend).
1456 elsif Generate_C_Code
1457 and then Ekind
(Ent
) = E_Enumeration_Literal
1458 and then Scope
(Ultimate_Alias
(Ent
)) /= Standard_Standard
1460 Fully_Qualify_Name
(Ent
);
1461 Name_Len
:= Full_Qualify_Len
;
1462 Name_Buffer
(1 .. Name_Len
) := Full_Qualify_Name
(1 .. Name_Len
);
1464 elsif Qualify_Needed
(Scope
(Ent
)) then
1466 Set_Entity_Name
(Ent
);
1469 Set_Has_Qualified_Name
(Ent
);
1471 -- If a variable is hidden by a subsequent loop variable, qualify
1472 -- the name of that loop variable to prevent visibility issues when
1473 -- translating to C. Note that gdb probably never handled properly
1474 -- this accidental hiding, given that loops are not scopes at
1475 -- runtime. We also qualify a name if it hides an outer homonym,
1476 -- and both are declared in blocks.
1478 if Modify_Tree_For_C
and then Ekind
(Ent
) = E_Variable
then
1479 if Present
(Hiding_Loop_Variable
(Ent
)) then
1481 Var
: constant Entity_Id
:= Hiding_Loop_Variable
(Ent
);
1484 Set_Entity_Name
(Var
);
1485 Add_Str_To_Name_Buffer
("L");
1486 Set_Chars
(Var
, Name_Enter
);
1489 elsif Present
(Homonym
(Ent
))
1490 and then Ekind
(Scope
(Ent
)) = E_Block
1491 and then Ekind
(Scope
(Homonym
(Ent
))) = E_Block
1493 Set_Entity_Name
(Ent
);
1494 Add_Str_To_Name_Buffer
("B");
1495 Set_Chars
(Ent
, Name_Enter
);
1502 -- Fall through with a fully qualified name in Name_Buffer/Name_Len
1504 Output_Homonym_Numbers_Suffix
;
1506 -- Add body-nested package suffix if required
1508 if BNPE_Suffix_Needed
1509 and then Ekind
(Ent
) /= E_Enumeration_Literal
1511 Set_BNPE_Suffix
(Ent
);
1513 -- Strip trailing n's and last trailing b as required. note that
1514 -- we know there is at least one b, or no suffix would be generated.
1516 while Name_Buffer
(Name_Len
) = 'n' loop
1517 Name_Len
:= Name_Len
- 1;
1520 Name_Len
:= Name_Len
- 1;
1523 Set_Chars
(Ent
, Name_Enter
);
1524 Set_Has_Qualified_Name
(Ent
);
1526 if Debug_Flag_BB
then
1528 Write_Name
(Save_Chars
);
1529 Write_Str
(" qualified as ");
1530 Write_Name
(Chars
(Ent
));
1533 end Qualify_Entity_Name
;
1535 --------------------------
1536 -- Qualify_Entity_Names --
1537 --------------------------
1539 procedure Qualify_Entity_Names
(N
: Node_Id
) is
1541 Name_Qualify_Units
.Append
(N
);
1542 end Qualify_Entity_Names
;
1548 procedure Reset_Buffers
is
1554 --------------------
1555 -- Strip_Suffixes --
1556 --------------------
1558 procedure Strip_Suffixes
(BNPE_Suffix_Found
: in out Boolean) is
1561 pragma Warnings
(Off
, BNPE_Suffix_Found
);
1562 -- Since this procedure only ever sets the flag
1565 -- Search for and strip BNPE suffix
1567 for J
in reverse 2 .. Name_Len
loop
1568 if Name_Buffer
(J
) = 'X' then
1570 BNPE_Suffix_Found
:= True;
1574 exit when Name_Buffer
(J
) /= 'b' and then Name_Buffer
(J
) /= 'n';
1577 -- Search for and strip homonym numbers suffix
1579 for J
in reverse 2 .. Name_Len
- 2 loop
1580 if Name_Buffer
(J
) = '_'
1581 and then Name_Buffer
(J
+ 1) = '_'
1583 if Name_Buffer
(J
+ 2) in '0' .. '9' then
1584 if Homonym_Len
> 0 then
1585 Homonym_Len
:= Homonym_Len
+ 1;
1586 Homonym_Numbers
(Homonym_Len
) := '-';
1589 SL
:= Name_Len
- (J
+ 1);
1591 Homonym_Numbers
(Homonym_Len
+ 1 .. Homonym_Len
+ SL
) :=
1592 Name_Buffer
(J
+ 2 .. Name_Len
);
1594 Homonym_Len
:= Homonym_Len
+ SL
;