Skip to content

Commit 94dfee4

Browse files
Add name method to builtin functions
This is useful to make the dot output more informative.
1 parent 71ffd69 commit 94dfee4

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

src/solvers/refinement/string_refinement_util.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ void string_dependenciest::output_dot(std::ostream &stream) const
632632
const auto node_to_string = [&](const nodet &n) { // NOLINT
633633
std::stringstream ostream;
634634
if(n.kind == nodet::BUILTIN)
635-
ostream << "builtin_" << n.index;
635+
ostream << builtin_function_nodes[n.index]->name() << n.index;
636636
else
637637
ostream << '"' << format(string_nodes[n.index].expr) << '"';
638638
return ostream.str();

src/solvers/refinement/string_refinement_util.h

+17
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,8 @@ class string_builtin_functiont
161161
virtual optionalt<exprt>
162162
eval(const std::function<exprt(const exprt &)> &get_value) const = 0;
163163

164+
virtual std::string name() const = 0;
165+
164166
protected:
165167
string_builtin_functiont() = default;
166168
};
@@ -212,6 +214,11 @@ class string_concat_char_builtin_functiont
212214
std::vector<mp_integer> eval(
213215
const std::vector<mp_integer> &input_value,
214216
const std::vector<mp_integer> &args_value) const override;
217+
218+
std::string name() const override
219+
{
220+
return "concat_char";
221+
}
215222
};
216223

217224
/// String inserting a string into another one
@@ -247,6 +254,11 @@ class string_insertion_builtin_functiont : public string_builtin_functiont
247254
optionalt<exprt>
248255
eval(const std::function<exprt(const exprt &)> &get_value) const override;
249256

257+
std::string name() const override
258+
{
259+
return "insert";
260+
}
261+
250262
protected:
251263
string_insertion_builtin_functiont() = default;
252264
};
@@ -263,6 +275,11 @@ class string_concatenation_builtin_functiont final
263275
const std::vector<mp_integer> &input1_value,
264276
const std::vector<mp_integer> &input2_value,
265277
const std::vector<mp_integer> &args_value) const override;
278+
279+
std::string name() const override
280+
{
281+
return "concat";
282+
}
266283
};
267284

268285
/// String creation from other types

0 commit comments

Comments
 (0)