Skip to content

Commit cabcb17

Browse files
authored
dwarf_extractor: Constify a bit (#2278)
1 parent bd96696 commit cabcb17

File tree

2 files changed

+24
-19
lines changed

2 files changed

+24
-19
lines changed

core/iwasm/compilation/debug/dwarf_extractor.cpp

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ destroy_dwarf_extractor(dwar_extractor_handle_t handle)
114114
}
115115

116116
LLVMMetadataRef
117-
dwarf_gen_file_info(AOTCompContext *comp_ctx)
117+
dwarf_gen_file_info(const AOTCompContext *comp_ctx)
118118
{
119119
dwar_extractor *extractor;
120120
int units_number;
@@ -191,7 +191,7 @@ dwarf_gen_mock_vm_info(AOTCompContext *comp_ctx)
191191
#endif
192192

193193
LLVMMetadataRef
194-
dwarf_gen_comp_unit_info(AOTCompContext *comp_ctx)
194+
dwarf_gen_comp_unit_info(const AOTCompContext *comp_ctx)
195195
{
196196
dwar_extractor *extractor;
197197
int units_number;
@@ -257,7 +257,7 @@ lldb_get_basic_type_encoding(BasicType basic_type)
257257
}
258258

259259
static LLVMMetadataRef
260-
lldb_type_to_type_dbi(AOTCompContext *comp_ctx, SBType &type)
260+
lldb_type_to_type_dbi(const AOTCompContext *comp_ctx, SBType &type)
261261
{
262262
LLVMMetadataRef type_info = NULL;
263263
BasicType basic_type = type.GetBasicType();
@@ -282,8 +282,9 @@ lldb_type_to_type_dbi(AOTCompContext *comp_ctx, SBType &type)
282282
}
283283

284284
static LLVMMetadataRef
285-
lldb_function_to_function_dbi(AOTCompContext *comp_ctx, SBSymbolContext &sc,
286-
AOTFuncContext *func_ctx)
285+
lldb_function_to_function_dbi(const AOTCompContext *comp_ctx,
286+
SBSymbolContext &sc,
287+
const AOTFuncContext *func_ctx)
287288
{
288289
SBFunction function(sc.GetFunction());
289290
const char *function_name = function.GetName();
@@ -388,7 +389,8 @@ lldb_function_to_function_dbi(AOTCompContext *comp_ctx, SBSymbolContext &sc,
388389
}
389390

390391
LLVMMetadataRef
391-
dwarf_gen_func_info(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx)
392+
dwarf_gen_func_info(const AOTCompContext *comp_ctx,
393+
const AOTFuncContext *func_ctx)
392394
{
393395
LLVMMetadataRef func_info = NULL;
394396
dwar_extractor *extractor;
@@ -417,8 +419,8 @@ dwarf_gen_func_info(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx)
417419
}
418420

419421
void
420-
dwarf_get_func_name(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
421-
char *name, int len)
422+
dwarf_get_func_name(const AOTCompContext *comp_ctx,
423+
const AOTFuncContext *func_ctx, char *name, int len)
422424
{
423425
LLVMMetadataRef func_info = NULL;
424426
dwar_extractor *extractor;
@@ -448,8 +450,8 @@ dwarf_get_func_name(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
448450
}
449451

450452
LLVMMetadataRef
451-
dwarf_gen_location(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
452-
uint64_t vm_offset)
453+
dwarf_gen_location(const AOTCompContext *comp_ctx,
454+
const AOTFuncContext *func_ctx, uint64_t vm_offset)
453455
{
454456
LLVMMetadataRef location_info = NULL;
455457
dwar_extractor *extractor;
@@ -487,7 +489,8 @@ dwarf_gen_location(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
487489
}
488490

489491
LLVMMetadataRef
490-
dwarf_gen_func_ret_location(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx)
492+
dwarf_gen_func_ret_location(const AOTCompContext *comp_ctx,
493+
const AOTFuncContext *func_ctx)
491494
{
492495
LLVMMetadataRef func_info = NULL;
493496
dwar_extractor *extractor;

core/iwasm/compilation/debug/dwarf_extractor.h

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,24 +30,26 @@ dwar_extractor_handle_t
3030
create_dwarf_extractor(aot_comp_data_t comp_data, char *file_name);
3131

3232
LLVMMetadataRef
33-
dwarf_gen_file_info(AOTCompContext *comp_ctx);
33+
dwarf_gen_file_info(const AOTCompContext *comp_ctx);
3434

3535
LLVMMetadataRef
36-
dwarf_gen_comp_unit_info(AOTCompContext *comp_ctx);
36+
dwarf_gen_comp_unit_info(const AOTCompContext *comp_ctx);
3737

3838
LLVMMetadataRef
39-
dwarf_gen_func_info(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx);
39+
dwarf_gen_func_info(const AOTCompContext *comp_ctx,
40+
const AOTFuncContext *func_ctx);
4041

4142
LLVMMetadataRef
42-
dwarf_gen_location(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
43-
uint64_t vm_offset);
43+
dwarf_gen_location(const AOTCompContext *comp_ctx,
44+
const AOTFuncContext *func_ctx, uint64_t vm_offset);
4445

4546
LLVMMetadataRef
46-
dwarf_gen_func_ret_location(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx);
47+
dwarf_gen_func_ret_location(const AOTCompContext *comp_ctx,
48+
const AOTFuncContext *func_ctx);
4749

4850
void
49-
dwarf_get_func_name(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
50-
char *name, int len);
51+
dwarf_get_func_name(const AOTCompContext *comp_ctx,
52+
const AOTFuncContext *func_ctx, char *name, int len);
5153

5254
#ifdef __cplusplus
5355
}

0 commit comments

Comments
 (0)