Skip to content

Commit 453c2f9

Browse files
Add function_name parameter to process_operands
This is in preparation for adding the function_name to the function generating fresh java symbols.
1 parent 71526e3 commit 453c2f9

File tree

2 files changed

+16
-11
lines changed

2 files changed

+16
-11
lines changed

jbmc/src/java_bytecode/java_string_library_preprocess.cpp

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -265,13 +265,15 @@ symbol_exprt java_string_library_preprocesst::fresh_array(
265265
/// calls string_refine_preprocesst::process_operands with a list of parameters.
266266
/// \param params: a list of function parameters
267267
/// \param loc: location in the source
268+
/// \param function_name: name of the function in which the code will be added
268269
/// \param symbol_table: symbol table
269270
/// \param init_code: code block, in which declaration of some arguments may be
270271
/// added
271272
/// \return a list of expressions
272273
exprt::operandst java_string_library_preprocesst::process_parameters(
273274
const java_method_typet::parameterst &params,
274275
const source_locationt &loc,
276+
const irep_idt &function_name,
275277
symbol_table_baset &symbol_table,
276278
code_blockt &init_code)
277279
{
@@ -281,7 +283,7 @@ exprt::operandst java_string_library_preprocesst::process_parameters(
281283
const symbol_exprt sym(p.get_identifier(), p.type());
282284
ops.push_back(sym);
283285
}
284-
return process_operands(ops, loc, symbol_table, init_code);
286+
return process_operands(ops, loc, function_name, symbol_table, init_code);
285287
}
286288

287289
/// Creates a string_exprt from the input exprt representing a char sequence
@@ -322,23 +324,24 @@ java_string_library_preprocesst::convert_exprt_to_string_exprt(
322324
/// for char array references.
323325
/// \param operands: a list of expressions
324326
/// \param loc: location in the source
327+
/// \param function_name: name of the function in which the code will be added
325328
/// \param symbol_table: symbol table
326329
/// \param init_code: code block, in which declaration of some arguments may be
327330
/// added
328331
/// \return a list of expressions
329332
exprt::operandst java_string_library_preprocesst::process_operands(
330333
const exprt::operandst &operands,
331334
const source_locationt &loc,
335+
const irep_idt &function_name,
332336
symbol_table_baset &symbol_table,
333337
code_blockt &init_code)
334338
{
335339
exprt::operandst ops;
336340
for(const auto &p : operands)
337341
{
338342
if(implements_java_char_sequence_pointer(p.type()))
339-
ops.push_back(
340-
convert_exprt_to_string_exprt(
341-
p, loc, symbol_table, loc.get_function(), init_code));
343+
ops.push_back(convert_exprt_to_string_exprt(
344+
p, loc, symbol_table, function_name, init_code));
342345
else if(is_java_char_array_pointer_type(p.type()))
343346
ops.push_back(replace_char_array(p, loc, symbol_table, init_code));
344347
else
@@ -1128,7 +1131,7 @@ code_blockt java_string_library_preprocesst::make_init_function_from_call(
11281131

11291132
// Processing parameters
11301133
const exprt::operandst args =
1131-
process_parameters(params, loc, symbol_table, code);
1134+
process_parameters(params, loc, function_name, symbol_table, code);
11321135

11331136
// string_expr <- function(arg1)
11341137
const refined_string_exprt string_expr =
@@ -1472,8 +1475,8 @@ code_blockt java_string_library_preprocesst::make_string_format_code(
14721475
{
14731476
PRECONDITION(type.parameters().size()==2);
14741477
code_blockt code;
1475-
exprt::operandst args=process_parameters(
1476-
type.parameters(), loc, symbol_table, code);
1478+
exprt::operandst args =
1479+
process_parameters(type.parameters(), loc, function_id, symbol_table, code);
14771480
INVARIANT(args.size()==2, "String.format should have two arguments");
14781481

14791482
// The argument can be:
@@ -1612,8 +1615,8 @@ code_blockt java_string_library_preprocesst::make_function_from_call(
16121615
symbol_table_baset &symbol_table)
16131616
{
16141617
code_blockt code;
1615-
const exprt::operandst args =
1616-
process_parameters(type.parameters(), loc, symbol_table, code);
1618+
const exprt::operandst args = process_parameters(
1619+
type.parameters(), loc, function_name, symbol_table, code);
16171620
code.add(
16181621
code_return_function_application(
16191622
function_name, args, type.return_type(), symbol_table),
@@ -1645,8 +1648,8 @@ java_string_library_preprocesst::make_string_returning_function_from_call(
16451648
code_blockt code;
16461649

16471650
// Calling the function
1648-
const exprt::operandst arguments =
1649-
process_parameters(type.parameters(), loc, symbol_table, code);
1651+
const exprt::operandst arguments = process_parameters(
1652+
type.parameters(), loc, function_name, symbol_table, code);
16501653

16511654
// String expression that will hold the result
16521655
const refined_string_exprt string_expr =

jbmc/src/java_bytecode/java_string_library_preprocess.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ class java_string_library_preprocesst:public messaget
185185
exprt::operandst process_parameters(
186186
const java_method_typet::parameterst &params,
187187
const source_locationt &loc,
188+
const irep_idt &function_name,
188189
symbol_table_baset &symbol_table,
189190
code_blockt &init_code);
190191

@@ -206,6 +207,7 @@ class java_string_library_preprocesst:public messaget
206207
exprt::operandst process_operands(
207208
const exprt::operandst &operands,
208209
const source_locationt &loc,
210+
const irep_idt &function_name,
209211
symbol_table_baset &symbol_table,
210212
code_blockt &init_code);
211213

0 commit comments

Comments
 (0)