Skip to content

Commit 6e9b1a7

Browse files
author
Daniel Kroening
committed
string refiner no longer needs to consider renamed function symbols
The mathematical functions used by the string refiner are no longer renamed, and thus, there's no longer any need to extract the original name from an ssa_exprt.
1 parent 74dc99f commit 6e9b1a7

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

src/solvers/strings/string_constraint_generator_main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,8 +346,8 @@ static irep_idt get_function_name(const function_application_exprt &expr)
346346
{
347347
const exprt &name = expr.function();
348348
PRECONDITION(name.id() == ID_symbol);
349-
return is_ssa_expr(name) ? to_ssa_expr(name).get_object_name()
350-
: to_symbol_expr(name).get_identifier();
349+
PRECONDITION(!is_ssa_expr(name));
350+
return to_symbol_expr(name).get_identifier();
351351
}
352352

353353
optionalt<exprt> string_constraint_generatort::make_array_pointer_association(

src/solvers/strings/string_refinement_util.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,9 @@ static std::unique_ptr<string_builtin_functiont> to_string_builtin_function(
209209
array_poolt &array_pool)
210210
{
211211
const auto name = expr_checked_cast<symbol_exprt>(fun_app.function());
212-
const irep_idt &id = is_ssa_expr(name) ? to_ssa_expr(name).get_object_name()
213-
: name.get_identifier();
212+
PRECONDITION(!is_ssa_expr(name));
213+
214+
const irep_idt &id = name.get_identifier();
214215

215216
if(id == ID_cprover_string_insert_func)
216217
return util_make_unique<string_insertion_builtin_functiont>(

src/util/simplify_expr.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,12 @@ bool simplify_exprt::simplify_function_application(exprt &expr)
165165
{
166166
const function_application_exprt &function_app =
167167
to_function_application_expr(expr);
168-
irep_idt func_id =
169-
function_app.function().find(ID_expression).get(ID_identifier);
168+
169+
if(function_app.function().id() != ID_symbol)
170+
return true;
171+
172+
const irep_idt func_id =
173+
to_symbol_expr(function_app.function()).get_identifier();
170174

171175
// Starts-with is used for .equals.
172176
if(func_id == ID_cprover_string_startswith_func)

0 commit comments

Comments
 (0)