Skip to content

Commit 6609247

Browse files
Add a maybe_testing_function to builtin functions
This is to know whether the result of a function can be used outside of string operations.
1 parent 97ee2d6 commit 6609247

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/solvers/refinement/string_builtin_function.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,14 @@ class string_builtin_functiont
4040

4141
exprt return_code;
4242

43+
/// Tells whether the builtin function can be a testing function, that is a
44+
/// function that does not return a string, for instance like `equals`,
45+
/// `indexOf` or `compare`.
46+
virtual bool maybe_testing_function() const
47+
{
48+
return true;
49+
}
50+
4351
private:
4452
string_builtin_functiont() = default;
4553

@@ -84,6 +92,11 @@ class string_transformation_builtin_functiont : public string_builtin_functiont
8492

8593
optionalt<exprt>
8694
eval(const std::function<exprt(const exprt &)> &get_value) const override;
95+
96+
bool maybe_testing_function() const override
97+
{
98+
return false;
99+
}
87100
};
88101

89102
/// Adding a character at the end of a string
@@ -170,6 +183,11 @@ class string_insertion_builtin_functiont : public string_builtin_functiont
170183
UNREACHABLE;
171184
};
172185

186+
bool maybe_testing_function() const override
187+
{
188+
return false;
189+
}
190+
173191
protected:
174192
explicit string_insertion_builtin_functiont(const exprt &return_code)
175193
: string_builtin_functiont(return_code)
@@ -225,6 +243,11 @@ class string_creation_builtin_functiont : public string_builtin_functiont
225243
{
226244
return result;
227245
}
246+
247+
bool maybe_testing_function() const override
248+
{
249+
return false;
250+
}
228251
};
229252

230253
/// String test

0 commit comments

Comments
 (0)