@@ -210,6 +210,8 @@ fn build_pointer_or_reference_di_node<'ll, 'tcx>(
210
210
Stub :: Struct ,
211
211
unique_type_id,
212
212
& ptr_type_debuginfo_name,
213
+ unknown_file_metadata ( cx) ,
214
+ UNKNOWN_LINE_NUMBER ,
213
215
cx. size_and_align_of ( ptr_type) ,
214
216
NO_SCOPE_METADATA ,
215
217
DIFlags :: FlagZero ,
@@ -375,6 +377,8 @@ fn build_dyn_type_di_node<'ll, 'tcx>(
375
377
Stub :: Struct ,
376
378
unique_type_id,
377
379
& type_name,
380
+ unknown_file_metadata ( cx) ,
381
+ UNKNOWN_LINE_NUMBER ,
378
382
cx. size_and_align_of ( dyn_type) ,
379
383
NO_SCOPE_METADATA ,
380
384
DIFlags :: FlagZero ,
@@ -793,6 +797,8 @@ fn build_foreign_type_di_node<'ll, 'tcx>(
793
797
Stub :: Struct ,
794
798
unique_type_id,
795
799
& compute_debuginfo_type_name ( cx. tcx , t, false ) ,
800
+ unknown_file_metadata ( cx) ,
801
+ UNKNOWN_LINE_NUMBER ,
796
802
cx. size_and_align_of ( t) ,
797
803
Some ( get_namespace_for_item ( cx, def_id) ) ,
798
804
DIFlags :: FlagZero ,
@@ -1017,13 +1023,24 @@ fn build_struct_type_di_node<'ll, 'tcx>(
1017
1023
let struct_type_and_layout = cx. layout_of ( struct_type) ;
1018
1024
let variant_def = adt_def. non_enum_variant ( ) ;
1019
1025
1026
+ let tcx = cx. tcx ;
1027
+ let struct_span = tcx. def_span ( adt_def. did ( ) ) ;
1028
+ let ( file_metadata, line_number) = if !struct_span. is_dummy ( ) {
1029
+ let loc = cx. lookup_debug_loc ( struct_span. lo ( ) ) ;
1030
+ ( file_metadata ( cx, & loc. file ) , loc. line )
1031
+ } else {
1032
+ ( unknown_file_metadata ( cx) , UNKNOWN_LINE_NUMBER )
1033
+ } ;
1034
+
1020
1035
type_map:: build_type_with_children (
1021
1036
cx,
1022
1037
type_map:: stub (
1023
1038
cx,
1024
1039
Stub :: Struct ,
1025
1040
unique_type_id,
1026
1041
& compute_debuginfo_type_name ( cx. tcx , struct_type, false ) ,
1042
+ file_metadata,
1043
+ line_number,
1027
1044
size_and_align_of ( struct_type_and_layout) ,
1028
1045
Some ( containing_scope) ,
1029
1046
visibility_di_flags ( cx, adt_def. did ( ) , adt_def. did ( ) ) ,
@@ -1127,6 +1144,8 @@ fn build_tuple_type_di_node<'ll, 'tcx>(
1127
1144
Stub :: Struct ,
1128
1145
unique_type_id,
1129
1146
& type_name,
1147
+ unknown_file_metadata ( cx) ,
1148
+ UNKNOWN_LINE_NUMBER ,
1130
1149
size_and_align_of ( tuple_type_and_layout) ,
1131
1150
NO_SCOPE_METADATA ,
1132
1151
DIFlags :: FlagZero ,
@@ -1173,6 +1192,8 @@ fn build_closure_env_di_node<'ll, 'tcx>(
1173
1192
Stub :: Struct ,
1174
1193
unique_type_id,
1175
1194
& type_name,
1195
+ unknown_file_metadata ( cx) ,
1196
+ UNKNOWN_LINE_NUMBER ,
1176
1197
cx. size_and_align_of ( closure_env_type) ,
1177
1198
Some ( containing_scope) ,
1178
1199
DIFlags :: FlagZero ,
@@ -1204,6 +1225,8 @@ fn build_union_type_di_node<'ll, 'tcx>(
1204
1225
Stub :: Union ,
1205
1226
unique_type_id,
1206
1227
& type_name,
1228
+ unknown_file_metadata ( cx) ,
1229
+ UNKNOWN_LINE_NUMBER ,
1207
1230
size_and_align_of ( union_ty_and_layout) ,
1208
1231
Some ( containing_scope) ,
1209
1232
DIFlags :: FlagZero ,
@@ -1387,6 +1410,8 @@ fn build_vtable_type_di_node<'ll, 'tcx>(
1387
1410
Stub :: VTableTy { vtable_holder } ,
1388
1411
unique_type_id,
1389
1412
& vtable_type_name,
1413
+ unknown_file_metadata ( cx) ,
1414
+ UNKNOWN_LINE_NUMBER ,
1390
1415
( size, pointer_align) ,
1391
1416
NO_SCOPE_METADATA ,
1392
1417
DIFlags :: FlagArtificial ,
0 commit comments