File tree 2 files changed +11
-5
lines changed
src/solvers/smt2_incremental 2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ void smt2_incremental_decision_proceduret::define_dependent_functions(
49
49
return expr_identifier.first ;
50
50
});
51
51
std::stack<exprt> to_be_defined;
52
- const auto dependencies_needed = [&](const exprt &expr) {
52
+ const auto push_dependencies_needed = [&](const exprt &expr) {
53
53
bool result = false ;
54
54
for (const auto &dependency : gather_dependent_expressions (expr))
55
55
{
@@ -60,11 +60,11 @@ void smt2_incremental_decision_proceduret::define_dependent_functions(
60
60
}
61
61
return result;
62
62
};
63
- dependencies_needed (expr);
63
+ push_dependencies_needed (expr);
64
64
while (!to_be_defined.empty ())
65
65
{
66
66
const exprt current = to_be_defined.top ();
67
- if (dependencies_needed (current))
67
+ if (push_dependencies_needed (current))
68
68
continue ;
69
69
if (const auto symbol_expr = expr_try_dynamic_cast<symbol_exprt>(current))
70
70
{
@@ -81,7 +81,7 @@ void smt2_incremental_decision_proceduret::define_dependent_functions(
81
81
}
82
82
else
83
83
{
84
- if (dependencies_needed (symbol->value ))
84
+ if (push_dependencies_needed (symbol->value ))
85
85
continue ;
86
86
const smt_define_function_commandt function{
87
87
symbol->name , {}, convert_expr_to_smt (symbol->value )};
Original file line number Diff line number Diff line change @@ -50,13 +50,19 @@ bool smt_bool_literal_termt::value() const
50
50
51
51
static bool is_valid_smt_identifier (irep_idt identifier)
52
52
{
53
- static const std::regex valid{R"( ^[^\|]*$)" };
53
+ // The below regex matches a complete string which does not contain the `|`
54
+ // character. So it would match the string `foo bar`, but not `|foo bar|`.
55
+ static const std::regex valid{" [^\\ |]*" };
54
56
return std::regex_match (id2string (identifier), valid);
55
57
}
56
58
57
59
smt_identifier_termt::smt_identifier_termt (irep_idt identifier, smt_sortt sort)
58
60
: smt_termt(ID_smt_identifier_term, std::move(sort))
59
61
{
62
+ // The below invariant exists as a sanity check that the string being used for
63
+ // the identifier is in unescaped form. This is because the escaping and
64
+ // unescaping are implementation details of the printing to string and
65
+ // response parsing respectively, not part of the underlying data.
60
66
INVARIANT (
61
67
is_valid_smt_identifier (identifier),
62
68
R"( Identifiers may not contain | characters.)" );
You can’t perform that action at this time.
0 commit comments