File tree 2 files changed +21
-0
lines changed 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -481,6 +481,21 @@ string_dependenciest::get_string_node(node_indext i) const
481
481
return {};
482
482
}
483
483
484
+ optionalt<exprt> string_dependenciest::eval (
485
+ const array_string_exprt &s,
486
+ const std::function<exprt(const exprt &)> &get_value) const
487
+ {
488
+ const auto node = node_at (s);
489
+ if (node && node->dependencies .size () == 1 )
490
+ {
491
+ const auto &f = get_builtin_function (node->dependencies [0 ]);
492
+ const auto result = f.string_result ();
493
+ if (result && *result == s)
494
+ return f.eval (get_value);
495
+ }
496
+ return {};
497
+ }
498
+
484
499
bool add_node (
485
500
string_dependenciest &dependencies,
486
501
const equal_exprt &equation,
Original file line number Diff line number Diff line change @@ -306,6 +306,12 @@ class string_dependenciest
306
306
// / Mark node for `e` as depending on unknown builtin_function
307
307
void add_unknown_dependency (const array_string_exprt &e);
308
308
309
+ // / Attempt to evaluate the given string from the dependencies and valuation
310
+ // / of strings on which it depends
311
+ optionalt<exprt> eval (
312
+ const array_string_exprt &s,
313
+ const std::function<exprt(const exprt &)> &get_value) const ;
314
+
309
315
void output_dot (std::ostream &stream) const ;
310
316
311
317
private:
You can’t perform that action at this time.
0 commit comments