Skip to content

Commit adb3d7b

Browse files
authored
Merge pull request #3872 from tautschnig/symbol_exprt-function_application
Use consistent types with function_application_exprt [blocks: #3766]
2 parents 5eb754c + b4a3c0c commit adb3d7b

File tree

4 files changed

+11
-16
lines changed

4 files changed

+11
-16
lines changed

jbmc/src/java_bytecode/java_utils.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,9 @@ void java_add_components_to_class(
247247
/// \param function_name: a name
248248
/// \param type: a type
249249
/// \param symbol_table: symbol table
250-
void declare_function(
251-
irep_idt function_name,
250+
/// \return newly created symbol
251+
static auxiliary_symbolt declare_function(
252+
const irep_idt &function_name,
252253
const typet &type,
253254
symbol_table_baset &symbol_table)
254255
{
@@ -260,6 +261,8 @@ void declare_function(
260261
func_symbol.name=function_name;
261262
func_symbol.type=type;
262263
symbol_table.add(func_symbol);
264+
265+
return func_symbol;
263266
}
264267

265268
/// Create a function application expression.
@@ -275,14 +278,11 @@ exprt make_function_application(
275278
const typet &type,
276279
symbol_table_baset &symbol_table)
277280
{
278-
// Names of function to call
279-
std::string fun_name=id2string(function_name);
280-
281281
// Declaring the function
282-
declare_function(fun_name, type, symbol_table);
282+
const auto symbol = declare_function(function_name, type, symbol_table);
283283

284284
// Function application
285-
return function_application_exprt(symbol_exprt(fun_name), arguments, type);
285+
return function_application_exprt(symbol.symbol_expr(), arguments, type);
286286
}
287287

288288
/// Strip java:: prefix from given identifier

jbmc/src/java_bytecode/java_utils.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,6 @@ size_t find_closing_delimiter(
8787
char open_char,
8888
char close_char);
8989

90-
void declare_function(
91-
irep_idt function_name,
92-
const typet &type,
93-
symbol_table_baset &symbol_table);
94-
9590
exprt make_function_application(
9691
const irep_idt &function_name,
9792
const exprt::operandst &arguments,

jbmc/unit/solvers/strings/string_constraint_instantiation/instantiate_not_contains.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ SCENARIO(
194194
{
195195
// Creating "ab".lastIndexOf("b", 0)
196196
const function_application_exprt func(
197-
symbol_exprt(ID_cprover_string_last_index_of_func),
197+
symbol_exprt(ID_cprover_string_last_index_of_func, t.length_type()),
198198
{ab, b, from_integer(2)},
199199
t.length_type());
200200

jbmc/unit/solvers/strings/string_refinement/dependency_graph.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,19 +64,19 @@ SCENARIO("dependency_graph", "[core][solvers][refinement][string_refinement]")
6464

6565
// fun1 is s3 = s1.concat(s2)
6666
const function_application_exprt fun1(
67-
symbol_exprt(ID_cprover_string_concat_func),
67+
symbol_exprt(ID_cprover_string_concat_func, fun_type),
6868
{string3.op0(), string3.op1(), string1, string2},
6969
fun_type);
7070

7171
// fun2 is s5 = s3.concat(s4)
7272
const function_application_exprt fun2(
73-
symbol_exprt(ID_cprover_string_concat_func),
73+
symbol_exprt(ID_cprover_string_concat_func, fun_type),
7474
{string5.op0(), string5.op1(), string3, string4},
7575
fun_type);
7676

7777
// fun3 is s6 = s5.concat(s2)
7878
const function_application_exprt fun3(
79-
symbol_exprt(ID_cprover_string_concat_func),
79+
symbol_exprt(ID_cprover_string_concat_func, fun_type),
8080
{string6.op0(), string6.op1(), string5, string2},
8181
fun_type);
8282

0 commit comments

Comments
 (0)