Skip to content

Commit 8024d33

Browse files
Add function_id parameter to decl_string_expr
This is in preparation for giving function_id as an argument to the function creating fresh java symbols.
1 parent ccd628b commit 8024d33

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

jbmc/src/java_bytecode/java_string_library_preprocess.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ java_string_library_preprocesst::convert_exprt_to_string_exprt(
306306
{
307307
PRECONDITION(implements_java_char_sequence_pointer(expr_to_process.type()));
308308
const refined_string_exprt string_expr =
309-
decl_string_expr(loc, symbol_table, init_code);
309+
decl_string_expr(loc, function_id, symbol_table, init_code);
310310
code_assign_java_string_to_string_expr(
311311
string_expr, expr_to_process, loc, symbol_table, init_code);
312312
return string_expr;
@@ -496,11 +496,13 @@ symbol_exprt java_string_library_preprocesst::fresh_string(
496496
/// Add declaration of a refined string expr whose content and length are
497497
/// fresh symbols.
498498
/// \param loc: source location
499+
/// \param function_id: name of the function in which the string is defined
499500
/// \param symbol_table: the symbol table
500501
/// \param [out] code: code block to which the declaration is added
501502
/// \return refined string expr with fresh content and length symbols
502503
refined_string_exprt java_string_library_preprocesst::decl_string_expr(
503504
const source_locationt &loc,
505+
const irep_idt &function_id,
504506
symbol_table_baset &symbol_table,
505507
code_blockt &code)
506508
{
@@ -542,7 +544,8 @@ refined_string_exprt java_string_library_preprocesst::make_nondet_string_expr(
542544
code_blockt &code)
543545
{
544546
/// \todo refactor with initialize_nonddet_string_struct
545-
const refined_string_exprt str = decl_string_expr(loc, symbol_table, code);
547+
const refined_string_exprt str =
548+
decl_string_expr(loc, function_id, symbol_table, code);
546549

547550
const side_effect_expr_nondett nondet_length(str.length().type(), loc);
548551
code.add(code_assignt(str.length(), nondet_length), loc);
@@ -1672,7 +1675,7 @@ code_blockt java_string_library_preprocesst::make_copy_string_code(
16721675

16731676
// String expression that will hold the result
16741677
const refined_string_exprt string_expr =
1675-
decl_string_expr(loc, symbol_table, code);
1678+
decl_string_expr(loc, function_id, symbol_table, code);
16761679

16771680
// Assign the argument to string_expr
16781681
const java_method_typet::parametert &op = type.parameters()[0];
@@ -1719,7 +1722,7 @@ code_blockt java_string_library_preprocesst::make_copy_constructor_code(
17191722

17201723
// String expression that will hold the result
17211724
const refined_string_exprt string_expr =
1722-
decl_string_expr(loc, symbol_table, code);
1725+
decl_string_expr(loc, function_id, symbol_table, code);
17231726

17241727
// Assign argument to a string_expr
17251728
const java_method_typet::parameterst &params = type.parameters();

jbmc/src/java_bytecode/java_string_library_preprocess.h

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ class java_string_library_preprocesst:public messaget
233233

234234
refined_string_exprt decl_string_expr(
235235
const source_locationt &loc,
236+
const irep_idt &function_id,
236237
symbol_table_baset &symbol_table,
237238
code_blockt &code);
238239

@@ -250,13 +251,13 @@ class java_string_library_preprocesst:public messaget
250251
code_blockt &code);
251252

252253
codet code_return_function_application(
253-
const irep_idt &function_name,
254+
const irep_idt &function_id,
254255
const exprt::operandst &arguments,
255256
const typet &type,
256257
symbol_table_baset &symbol_table);
257258

258259
refined_string_exprt string_expr_of_function(
259-
const irep_idt &function_name,
260+
const irep_idt &function_id,
260261
const exprt::operandst &arguments,
261262
const source_locationt &loc,
262263
symbol_table_baset &symbol_table,
@@ -289,32 +290,32 @@ class java_string_library_preprocesst:public messaget
289290
code_blockt &code);
290291

291292
code_blockt make_function_from_call(
292-
const irep_idt &function_name,
293+
const irep_idt &function_id,
293294
const java_method_typet &type,
294295
const source_locationt &loc,
295296
symbol_table_baset &symbol_table);
296297

297298
code_blockt make_init_function_from_call(
298-
const irep_idt &function_name,
299+
const irep_idt &function_id,
299300
const java_method_typet &type,
300301
const source_locationt &loc,
301302
symbol_table_baset &symbol_table,
302303
bool is_constructor = true);
303304

304305
code_blockt make_assign_and_return_function_from_call(
305-
const irep_idt &function_name,
306+
const irep_idt &function_id,
306307
const java_method_typet &type,
307308
const source_locationt &loc,
308309
symbol_table_baset &symbol_table);
309310

310311
code_blockt make_assign_function_from_call(
311-
const irep_idt &function_name,
312+
const irep_idt &function_id,
312313
const java_method_typet &type,
313314
const source_locationt &loc,
314315
symbol_table_baset &symbol_table);
315316

316317
code_blockt make_string_returning_function_from_call(
317-
const irep_idt &function_name,
318+
const irep_idt &function_id,
318319
const java_method_typet &type,
319320
const source_locationt &loc,
320321
symbol_table_baset &symbol_table);

0 commit comments

Comments
 (0)