Skip to content

Commit 46ecf89

Browse files
Add function_id parameter to process_operands
This is in preparation for adding the function_id to the function generating fresh java symbols.
1 parent 8024d33 commit 46ecf89

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

jbmc/src/java_bytecode/java_string_library_preprocess.cpp

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -265,20 +265,22 @@ 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_id: 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_id,
275277
symbol_table_baset &symbol_table,
276278
code_blockt &init_code)
277279
{
278280
exprt::operandst ops;
279281
for(const auto &p : params)
280282
ops.emplace_back(symbol_exprt(p.get_identifier(), p.type()));
281-
return process_operands(ops, loc, symbol_table, init_code);
283+
return process_operands(ops, loc, function_id, symbol_table, init_code);
282284
}
283285

284286
/// Creates a string_exprt from the input exprt representing a char sequence
@@ -319,13 +321,15 @@ java_string_library_preprocesst::convert_exprt_to_string_exprt(
319321
/// for char array references.
320322
/// \param operands: a list of expressions
321323
/// \param loc: location in the source
324+
/// \param function_id: name of the function in which the code will be added
322325
/// \param symbol_table: symbol table
323326
/// \param init_code: code block, in which declaration of some arguments may be
324327
/// added
325328
/// \return a list of expressions
326329
exprt::operandst java_string_library_preprocesst::process_operands(
327330
const exprt::operandst &operands,
328331
const source_locationt &loc,
332+
const irep_idt &function_id,
329333
symbol_table_baset &symbol_table,
330334
code_blockt &init_code)
331335
{
@@ -335,7 +339,7 @@ exprt::operandst java_string_library_preprocesst::process_operands(
335339
if(implements_java_char_sequence_pointer(p.type()))
336340
ops.push_back(
337341
convert_exprt_to_string_exprt(
338-
p, loc, symbol_table, loc.get_function(), init_code));
342+
p, loc, symbol_table, function_id, init_code));
339343
else if(is_java_char_array_pointer_type(p.type()))
340344
ops.push_back(replace_char_array(p, loc, symbol_table, init_code));
341345
else
@@ -1113,7 +1117,7 @@ code_blockt java_string_library_preprocesst::make_init_function_from_call(
11131117

11141118
// Processing parameters
11151119
const exprt::operandst args =
1116-
process_parameters(params, loc, symbol_table, code);
1120+
process_parameters(params, loc, function_id, symbol_table, code);
11171121

11181122
// string_expr <- function(arg1)
11191123
const refined_string_exprt string_expr =
@@ -1457,8 +1461,8 @@ code_blockt java_string_library_preprocesst::make_string_format_code(
14571461
{
14581462
PRECONDITION(type.parameters().size()==2);
14591463
code_blockt code;
1460-
exprt::operandst args=process_parameters(
1461-
type.parameters(), loc, symbol_table, code);
1464+
exprt::operandst args =
1465+
process_parameters(type.parameters(), loc, function_id, symbol_table, code);
14621466
INVARIANT(args.size()==2, "String.format should have two arguments");
14631467

14641468
// The argument can be:
@@ -1598,7 +1602,7 @@ code_blockt java_string_library_preprocesst::make_function_from_call(
15981602
{
15991603
code_blockt code;
16001604
const exprt::operandst args =
1601-
process_parameters(type.parameters(), loc, symbol_table, code);
1605+
process_parameters(type.parameters(), loc, function_id, symbol_table, code);
16021606
code.add(
16031607
code_return_function_application(
16041608
function_id, args, type.return_type(), symbol_table),
@@ -1631,7 +1635,7 @@ java_string_library_preprocesst::make_string_returning_function_from_call(
16311635

16321636
// Calling the function
16331637
const exprt::operandst arguments =
1634-
process_parameters(type.parameters(), loc, symbol_table, code);
1638+
process_parameters(type.parameters(), loc, function_id, symbol_table, code);
16351639

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