@@ -213,6 +213,8 @@ fn build_pointer_or_reference_di_node<'ll, 'tcx>(
213
213
Stub :: Struct ,
214
214
unique_type_id,
215
215
& ptr_type_debuginfo_name,
216
+ unknown_file_metadata ( cx) ,
217
+ UNKNOWN_LINE_NUMBER ,
216
218
cx. size_and_align_of ( ptr_type) ,
217
219
NO_SCOPE_METADATA ,
218
220
DIFlags :: FlagZero ,
@@ -367,6 +369,8 @@ fn build_dyn_type_di_node<'ll, 'tcx>(
367
369
Stub :: Struct ,
368
370
unique_type_id,
369
371
& type_name,
372
+ unknown_file_metadata ( cx) ,
373
+ UNKNOWN_LINE_NUMBER ,
370
374
cx. size_and_align_of ( dyn_type) ,
371
375
NO_SCOPE_METADATA ,
372
376
DIFlags :: FlagZero ,
@@ -748,6 +752,8 @@ fn build_foreign_type_di_node<'ll, 'tcx>(
748
752
Stub :: Struct ,
749
753
unique_type_id,
750
754
& compute_debuginfo_type_name ( cx. tcx , t, false ) ,
755
+ unknown_file_metadata ( cx) ,
756
+ UNKNOWN_LINE_NUMBER ,
751
757
cx. size_and_align_of ( t) ,
752
758
Some ( get_namespace_for_item ( cx, def_id) ) ,
753
759
DIFlags :: FlagZero ,
@@ -978,13 +984,24 @@ fn build_struct_type_di_node<'ll, 'tcx>(
978
984
let struct_type_and_layout = cx. layout_of ( struct_type) ;
979
985
let variant_def = adt_def. non_enum_variant ( ) ;
980
986
987
+ let tcx = cx. tcx ;
988
+ let struct_span = tcx. def_span ( adt_def. did ( ) ) ;
989
+ let ( file_metadata, line_number) = if !struct_span. is_dummy ( ) {
990
+ let loc = cx. lookup_debug_loc ( struct_span. lo ( ) ) ;
991
+ ( file_metadata ( cx, & loc. file ) , loc. line )
992
+ } else {
993
+ ( unknown_file_metadata ( cx) , UNKNOWN_LINE_NUMBER )
994
+ } ;
995
+
981
996
type_map:: build_type_with_children (
982
997
cx,
983
998
type_map:: stub (
984
999
cx,
985
1000
Stub :: Struct ,
986
1001
unique_type_id,
987
1002
& compute_debuginfo_type_name ( cx. tcx , struct_type, false ) ,
1003
+ file_metadata,
1004
+ line_number,
988
1005
size_and_align_of ( struct_type_and_layout) ,
989
1006
Some ( containing_scope) ,
990
1007
DIFlags :: FlagZero ,
@@ -1095,6 +1112,8 @@ fn build_tuple_type_di_node<'ll, 'tcx>(
1095
1112
Stub :: Struct ,
1096
1113
unique_type_id,
1097
1114
& type_name,
1115
+ unknown_file_metadata ( cx) ,
1116
+ UNKNOWN_LINE_NUMBER ,
1098
1117
size_and_align_of ( tuple_type_and_layout) ,
1099
1118
NO_SCOPE_METADATA ,
1100
1119
DIFlags :: FlagZero ,
@@ -1140,6 +1159,8 @@ fn build_closure_env_di_node<'ll, 'tcx>(
1140
1159
Stub :: Struct ,
1141
1160
unique_type_id,
1142
1161
& type_name,
1162
+ unknown_file_metadata ( cx) ,
1163
+ UNKNOWN_LINE_NUMBER ,
1143
1164
cx. size_and_align_of ( closure_env_type) ,
1144
1165
Some ( containing_scope) ,
1145
1166
DIFlags :: FlagZero ,
@@ -1171,6 +1192,8 @@ fn build_union_type_di_node<'ll, 'tcx>(
1171
1192
Stub :: Union ,
1172
1193
unique_type_id,
1173
1194
& type_name,
1195
+ unknown_file_metadata ( cx) ,
1196
+ UNKNOWN_LINE_NUMBER ,
1174
1197
size_and_align_of ( union_ty_and_layout) ,
1175
1198
Some ( containing_scope) ,
1176
1199
DIFlags :: FlagZero ,
@@ -1356,6 +1379,8 @@ fn build_vtable_type_di_node<'ll, 'tcx>(
1356
1379
Stub :: VTableTy { vtable_holder } ,
1357
1380
unique_type_id,
1358
1381
& vtable_type_name,
1382
+ unknown_file_metadata ( cx) ,
1383
+ UNKNOWN_LINE_NUMBER ,
1359
1384
( size, pointer_align) ,
1360
1385
NO_SCOPE_METADATA ,
1361
1386
DIFlags :: FlagArtificial ,
0 commit comments