Skip to content

Commit b855ddd

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 b855ddd

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

jbmc/src/java_bytecode/java_string_library_preprocess.cpp

Lines changed: 13 additions & 9 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,13 +324,15 @@ 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
{
@@ -338,7 +342,7 @@ exprt::operandst java_string_library_preprocesst::process_operands(
338342
if(implements_java_char_sequence_pointer(p.type()))
339343
ops.push_back(
340344
convert_exprt_to_string_exprt(
341-
p, loc, symbol_table, loc.get_function(), init_code));
345+
p, loc, symbol_table, function_name, init_code));
342346
else if(is_java_char_array_pointer_type(p.type()))
343347
ops.push_back(replace_char_array(p, loc, symbol_table, init_code));
344348
else
@@ -1128,7 +1132,7 @@ code_blockt java_string_library_preprocesst::make_init_function_from_call(
11281132

11291133
// Processing parameters
11301134
const exprt::operandst args =
1131-
process_parameters(params, loc, symbol_table, code);
1135+
process_parameters(params, loc, function_name, symbol_table, code);
11321136

11331137
// string_expr <- function(arg1)
11341138
const refined_string_exprt string_expr =
@@ -1472,8 +1476,8 @@ code_blockt java_string_library_preprocesst::make_string_format_code(
14721476
{
14731477
PRECONDITION(type.parameters().size()==2);
14741478
code_blockt code;
1475-
exprt::operandst args=process_parameters(
1476-
type.parameters(), loc, symbol_table, code);
1479+
exprt::operandst args =
1480+
process_parameters(type.parameters(), loc, function_id, symbol_table, code);
14771481
INVARIANT(args.size()==2, "String.format should have two arguments");
14781482

14791483
// The argument can be:
@@ -1612,8 +1616,8 @@ code_blockt java_string_library_preprocesst::make_function_from_call(
16121616
symbol_table_baset &symbol_table)
16131617
{
16141618
code_blockt code;
1615-
const exprt::operandst args =
1616-
process_parameters(type.parameters(), loc, symbol_table, code);
1619+
const exprt::operandst args = process_parameters(
1620+
type.parameters(), loc, function_name, symbol_table, code);
16171621
code.add(
16181622
code_return_function_application(
16191623
function_name, args, type.return_type(), symbol_table),
@@ -1645,8 +1649,8 @@ java_string_library_preprocesst::make_string_returning_function_from_call(
16451649
code_blockt code;
16461650

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

16511655
// String expression that will hold the result
16521656
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)