@@ -316,23 +316,25 @@ package body GNATLLVM.Records.Debug is
316
316
return Get_Debug_Metadata (Original_Type);
317
317
end if ;
318
318
319
- -- A type might be self-referential. For example, a
320
- -- record may have a member whose type refers back to the
321
- -- same record type. To handle this case, we construct a
322
- -- empty composite type and record it; then later we
323
- -- update the members of the type.
319
+ -- A type might be self-referential. For example, a record may
320
+ -- have a member whose type refers back to the same record
321
+ -- type. To handle this case, we construct a empty composite
322
+ -- type and record it; then later we update the members of the
323
+ -- type. Note that we pass a unique identifier here; that
324
+ -- prevents LLVM from reusing an existing type in the case that
325
+ -- this composite is nameless.
324
326
if Is_Unchecked_Union (TE) then
325
327
Result := DI_Create_Union_Type
326
328
(Debug_Scope, Name,
327
329
Get_Debug_File_Node (Get_Source_File_Index (S)),
328
330
Get_Physical_Line_Number (S), Size, Align, DI_Flag_Zero,
329
- Empty_Fields, 0 , " " );
331
+ Empty_Fields, 0 , Name );
330
332
else
331
333
Result := DI_Create_Struct_Type
332
334
(Debug_Scope, Name,
333
335
Get_Debug_File_Node (Get_Source_File_Index (S)),
334
336
Get_Physical_Line_Number (S), Size, Align, DI_Flag_Zero,
335
- No_Metadata_T, Empty_Fields, 0 , No_Metadata_T, " " );
337
+ No_Metadata_T, Empty_Fields, 0 , No_Metadata_T, Name );
336
338
end if ;
337
339
338
340
Set_Debug_Metadata (TE, Result);
0 commit comments