Skip to content

Commit e222680

Browse files
Add function_name argument to decl_string_expr
This is in preparation for giving function_name as an argument to the function creating new string objects.
1 parent 9187a16 commit e222680

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
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
@@ -305,7 +305,7 @@ java_string_library_preprocesst::convert_exprt_to_string_exprt(
305305
{
306306
PRECONDITION(implements_java_char_sequence_pointer(expr_to_process.type()));
307307
const refined_string_exprt string_expr =
308-
decl_string_expr(loc, symbol_table, init_code);
308+
decl_string_expr(loc, loc.get_function(), symbol_table, init_code);
309309
code_assign_java_string_to_string_expr(
310310
string_expr, expr_to_process, loc, symbol_table, init_code);
311311
return string_expr;
@@ -492,11 +492,13 @@ symbol_exprt java_string_library_preprocesst::fresh_string(
492492
/// Add declaration of a refined string expr whose content and length are
493493
/// fresh symbols.
494494
/// \param loc: source location
495+
/// \param function_name: name of the function in which the stirng is defined
495496
/// \param symbol_table: the symbol table
496497
/// \param code [out] : code block to which the declaration is added
497498
/// \return refined string expr with fresh content and length symbols
498499
refined_string_exprt java_string_library_preprocesst::decl_string_expr(
499500
const source_locationt &loc,
501+
const irep_idt &function_name,
500502
symbol_table_baset &symbol_table,
501503
code_blockt &code)
502504
{
@@ -538,7 +540,8 @@ refined_string_exprt java_string_library_preprocesst::make_nondet_string_expr(
538540
code_blockt &code)
539541
{
540542
/// \todo refactor with initialize_nonddet_string_struct
541-
const refined_string_exprt str = decl_string_expr(loc, symbol_table, code);
543+
const refined_string_exprt str =
544+
decl_string_expr(loc, loc.get_function(), symbol_table, code);
542545

543546
const side_effect_expr_nondett nondet_length(str.length().type(), loc);
544547
code.add(code_assignt(str.length(), nondet_length), loc);
@@ -1654,7 +1657,7 @@ codet java_string_library_preprocesst::make_copy_string_code(
16541657

16551658
// String expression that will hold the result
16561659
const refined_string_exprt string_expr =
1657-
decl_string_expr(loc, symbol_table, code);
1660+
decl_string_expr(loc, loc.get_function(), symbol_table, code);
16581661

16591662
// Assign the argument to string_expr
16601663
const java_method_typet::parametert op = type.parameters()[0];
@@ -1699,7 +1702,7 @@ codet java_string_library_preprocesst::make_copy_constructor_code(
16991702

17001703
// String expression that will hold the result
17011704
const refined_string_exprt string_expr =
1702-
decl_string_expr(loc, symbol_table, code);
1705+
decl_string_expr(loc, function_id, symbol_table, code);
17031706

17041707
// Assign argument to a string_expr
17051708
const java_method_typet::parameterst params = type.parameters();

jbmc/src/java_bytecode/java_string_library_preprocess.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ class java_string_library_preprocesst:public messaget
232232

233233
refined_string_exprt decl_string_expr(
234234
const source_locationt &loc,
235+
const irep_idt &function_name,
235236
symbol_table_baset &symbol_table,
236237
code_blockt &code);
237238

0 commit comments

Comments
 (0)