@@ -188,10 +188,11 @@ static LL_MDRef lldbg_fwd_local_variable(LL_DebugInfo *db, int sptr, int findex,
188
188
static LL_MDRef lldbg_create_imported_entity (LL_DebugInfo *db, SPTR entity_sptr,
189
189
SPTR func_sptr,
190
190
IMPORT_TYPE entity_type,
191
- LL_MDRef elements_mdnode);
191
+ LL_MDRef elements_mdnode,
192
+ LL_MDRef imported_list);
192
193
static void lldbg_emit_imported_entity (LL_DebugInfo *db, SPTR entity_sptr,
193
194
SPTR func_sptr, IMPORT_TYPE entity_type,
194
- LL_MDRef elements);
195
+ LL_MDRef elements, LL_MDRef imported_list );
195
196
static LL_MDRef lldbg_create_subrange_mdnode (LL_DebugInfo *db, LL_MDRef count,
196
197
LL_MDRef lb, LL_MDRef ub,
197
198
LL_MDRef st);
@@ -530,6 +531,7 @@ lldbg_create_subprogram_mdnode(
530
531
llmd_add_md (mdb, lv_list_mdnode);
531
532
} else if (ll_feature_debug_info_ver13 (&db->module ->ir ))
532
533
llmd_add_md (mdb, lv_list_mdnode);
534
+
533
535
llmd_add_i32 (mdb, scope);
534
536
535
537
/* Request a distinct mdnode so that it can be updated with a function pointer
@@ -2417,6 +2419,7 @@ lldbg_emit_subprogram(LL_DebugInfo *db, SPTR sptr, DTYPE ret_dtype, int findex,
2417
2419
LL_MDRef lv_list_mdnode;
2418
2420
LL_MDRef context_mdnode;
2419
2421
LL_MDRef scope;
2422
+ LL_MDRef imported_list;
2420
2423
const char *mips_linkage_name = " " ;
2421
2424
const char *func_name;
2422
2425
int virtuality = 0 ;
@@ -2471,6 +2474,8 @@ lldbg_emit_subprogram(LL_DebugInfo *db, SPTR sptr, DTYPE ret_dtype, int findex,
2471
2474
ll_get_md_null (), lv_list_mdnode, lineno);
2472
2475
if (!db->subroutine_mdnodes )
2473
2476
db->subroutine_mdnodes = hashmap_alloc (hash_functions_direct);
2477
+ imported_list = ll_feature_debug_info_ver17 (&db->module ->ir ) ?
2478
+ lv_list_mdnode : db->llvm_dbg_imported ;
2474
2479
scopeData = (hash_data_t )(unsigned long )db->cur_subprogram_mdnode ;
2475
2480
hashmap_replace (db->subroutine_mdnodes , INT2HKEY (sptr), &scopeData);
2476
2481
while (db->import_entity_list ) {
@@ -2480,10 +2485,12 @@ lldbg_emit_subprogram(LL_DebugInfo *db, SPTR sptr, DTYPE ret_dtype, int findex,
2480
2485
/* There are pending entities to be imported into this func */
2481
2486
lldbg_emit_imported_entity (db, db->import_entity_list ->entity , sptr,
2482
2487
db->import_entity_list ->entity_type ,
2483
- elements_mdnode);
2488
+ elements_mdnode, imported_list );
2484
2489
while (child) {
2485
2490
LL_MDRef element = lldbg_create_imported_entity (db, child->entity , sptr,
2486
- child->entity_type , (LL_MDRef) NULL );
2491
+ child->entity_type ,
2492
+ (LL_MDRef) NULL ,
2493
+ (LL_MDRef) NULL );
2487
2494
ll_extend_md_node (db->module , elements_mdnode, element);
2488
2495
child = child->next ;
2489
2496
}
@@ -4107,7 +4114,8 @@ lldbg_function_end(LL_DebugInfo *db, int func)
4107
4114
4108
4115
static LL_MDRef
4109
4116
lldbg_create_imported_entity (LL_DebugInfo *db, SPTR entity_sptr, SPTR func_sptr,
4110
- IMPORT_TYPE entity_type, LL_MDRef elements_mdnode)
4117
+ IMPORT_TYPE entity_type, LL_MDRef elements_mdnode,
4118
+ LL_MDRef imported_list)
4111
4119
{
4112
4120
LLMD_Builder mdb;
4113
4121
LL_MDRef entity_mdnode, scope_mdnode = 0 , file_mdnode, cur_mdnode;
@@ -4164,14 +4172,16 @@ lldbg_create_imported_entity(LL_DebugInfo *db, SPTR entity_sptr, SPTR func_sptr,
4164
4172
llmd_add_md (mdb, elements_mdnode); // elements
4165
4173
4166
4174
cur_mdnode = llmd_finish (mdb);
4167
- ll_extend_md_node (db->module , db->llvm_dbg_imported , cur_mdnode);
4175
+ if (imported_list)
4176
+ ll_extend_md_node (db->module , imported_list, cur_mdnode);
4168
4177
return cur_mdnode;
4169
4178
}
4170
4179
4171
4180
static void
4172
4181
lldbg_emit_imported_entity (LL_DebugInfo *db, SPTR entity_sptr,
4173
4182
SPTR func_sptr, IMPORT_TYPE entity_type,
4174
- LL_MDRef elements_mdnode)
4183
+ LL_MDRef elements_mdnode,
4184
+ LL_MDRef imported_list)
4175
4185
{
4176
4186
static hashset_t entity_func_added;
4177
4187
const char *entity_func;
@@ -4185,7 +4195,7 @@ lldbg_emit_imported_entity(LL_DebugInfo *db, SPTR entity_sptr,
4185
4195
return ;
4186
4196
hashset_insert (entity_func_added, entity_func);
4187
4197
lldbg_create_imported_entity (db, entity_sptr, func_sptr, entity_type,
4188
- elements_mdnode);
4198
+ elements_mdnode, imported_list );
4189
4199
}
4190
4200
4191
4201
void
0 commit comments