Skip to content

Commit f97e518

Browse files
Pull out a get_function_name function
This decrease the size of add_axioms_for_function_application and this new function can be reused.
1 parent 627a706 commit f97e518

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/solvers/refinement/string_constraint_generator_main.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,14 @@ array_string_exprt array_poolt::of_argument(const exprt &arg)
429429
return find(string_argument.op1(), string_argument.op0());
430430
}
431431

432+
static irep_idt get_function_name(const function_application_exprt &expr)
433+
{
434+
const exprt &name = expr.function();
435+
PRECONDITION(name.id() == ID_symbol);
436+
return is_ssa_expr(name) ? to_ssa_expr(name).get_object_name()
437+
: to_symbol_expr(name).get_identifier();
438+
}
439+
432440
/// strings contained in this call are converted to objects of type
433441
/// `string_exprt`, through adding axioms. Axioms are then added to enforce that
434442
/// the result corresponds to the function application.
@@ -437,12 +445,7 @@ array_string_exprt array_poolt::of_argument(const exprt &arg)
437445
exprt string_constraint_generatort::add_axioms_for_function_application(
438446
const function_application_exprt &expr)
439447
{
440-
const exprt &name=expr.function();
441-
PRECONDITION(name.id()==ID_symbol);
442-
443-
const irep_idt &id=is_ssa_expr(name)?to_ssa_expr(name).get_object_name():
444-
to_symbol_expr(name).get_identifier();
445-
448+
const irep_idt &id = get_function_name(expr);
446449
exprt res;
447450

448451
if(id==ID_cprover_char_literal_func)

0 commit comments

Comments
 (0)