@@ -204,6 +204,8 @@ fn build_pointer_or_reference_di_node<'ll, 'tcx>(
204
204
Stub :: Struct ,
205
205
unique_type_id,
206
206
& ptr_type_debuginfo_name,
207
+ unknown_file_metadata ( cx) ,
208
+ UNKNOWN_LINE_NUMBER ,
207
209
cx. size_and_align_of ( ptr_type) ,
208
210
NO_SCOPE_METADATA ,
209
211
DIFlags :: FlagZero ,
@@ -371,6 +373,8 @@ fn build_dyn_type_di_node<'ll, 'tcx>(
371
373
Stub :: Struct ,
372
374
unique_type_id,
373
375
& type_name,
376
+ unknown_file_metadata ( cx) ,
377
+ UNKNOWN_LINE_NUMBER ,
374
378
cx. size_and_align_of ( dyn_type) ,
375
379
NO_SCOPE_METADATA ,
376
380
DIFlags :: FlagZero ,
@@ -841,6 +845,8 @@ fn build_foreign_type_di_node<'ll, 'tcx>(
841
845
Stub :: Struct ,
842
846
unique_type_id,
843
847
& compute_debuginfo_type_name ( cx. tcx , t, false ) ,
848
+ unknown_file_metadata ( cx) ,
849
+ UNKNOWN_LINE_NUMBER ,
844
850
cx. size_and_align_of ( t) ,
845
851
Some ( get_namespace_for_item ( cx, def_id) ) ,
846
852
DIFlags :: FlagZero ,
@@ -1044,13 +1050,24 @@ fn build_struct_type_di_node<'ll, 'tcx>(
1044
1050
let struct_type_and_layout = cx. layout_of ( struct_type) ;
1045
1051
let variant_def = adt_def. non_enum_variant ( ) ;
1046
1052
1053
+ let tcx = cx. tcx ;
1054
+ let struct_span = tcx. def_span ( adt_def. did ( ) ) ;
1055
+ let ( file_metadata, line_number) = if !struct_span. is_dummy ( ) {
1056
+ let loc = cx. lookup_debug_loc ( struct_span. lo ( ) ) ;
1057
+ ( file_metadata ( cx, & loc. file ) , loc. line )
1058
+ } else {
1059
+ ( unknown_file_metadata ( cx) , UNKNOWN_LINE_NUMBER )
1060
+ } ;
1061
+
1047
1062
type_map:: build_type_with_children (
1048
1063
cx,
1049
1064
type_map:: stub (
1050
1065
cx,
1051
1066
Stub :: Struct ,
1052
1067
unique_type_id,
1053
1068
& compute_debuginfo_type_name ( cx. tcx , struct_type, false ) ,
1069
+ file_metadata,
1070
+ line_number,
1054
1071
size_and_align_of ( struct_type_and_layout) ,
1055
1072
Some ( containing_scope) ,
1056
1073
visibility_di_flags ( cx, adt_def. did ( ) , adt_def. did ( ) ) ,
@@ -1154,6 +1171,8 @@ fn build_tuple_type_di_node<'ll, 'tcx>(
1154
1171
Stub :: Struct ,
1155
1172
unique_type_id,
1156
1173
& type_name,
1174
+ unknown_file_metadata ( cx) ,
1175
+ UNKNOWN_LINE_NUMBER ,
1157
1176
size_and_align_of ( tuple_type_and_layout) ,
1158
1177
NO_SCOPE_METADATA ,
1159
1178
DIFlags :: FlagZero ,
@@ -1200,6 +1219,8 @@ fn build_closure_env_di_node<'ll, 'tcx>(
1200
1219
Stub :: Struct ,
1201
1220
unique_type_id,
1202
1221
& type_name,
1222
+ unknown_file_metadata ( cx) ,
1223
+ UNKNOWN_LINE_NUMBER ,
1203
1224
cx. size_and_align_of ( closure_env_type) ,
1204
1225
Some ( containing_scope) ,
1205
1226
DIFlags :: FlagZero ,
@@ -1231,6 +1252,8 @@ fn build_union_type_di_node<'ll, 'tcx>(
1231
1252
Stub :: Union ,
1232
1253
unique_type_id,
1233
1254
& type_name,
1255
+ unknown_file_metadata ( cx) ,
1256
+ UNKNOWN_LINE_NUMBER ,
1234
1257
size_and_align_of ( union_ty_and_layout) ,
1235
1258
Some ( containing_scope) ,
1236
1259
DIFlags :: FlagZero ,
@@ -1423,6 +1446,8 @@ fn build_vtable_type_di_node<'ll, 'tcx>(
1423
1446
Stub :: VTableTy { vtable_holder } ,
1424
1447
unique_type_id,
1425
1448
& vtable_type_name,
1449
+ unknown_file_metadata ( cx) ,
1450
+ UNKNOWN_LINE_NUMBER ,
1426
1451
( size, pointer_align) ,
1427
1452
NO_SCOPE_METADATA ,
1428
1453
DIFlags :: FlagArtificial ,
0 commit comments