Skip to content

Commit 4943ee9

Browse files
author
Joel Allred
committed
Make try_get_string_data_array a non-member function
It doesn't need to be. It's truly static. We want to be able to call it from local static functions.
1 parent 684729c commit 4943ee9

File tree

2 files changed

+19
-18
lines changed

2 files changed

+19
-18
lines changed

src/util/simplify_expr.cpp

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@ struct simplify_expr_cachet
6363
simplify_expr_cachet simplify_expr_cache;
6464
#endif
6565

66+
static optionalt<std::reference_wrapper<const array_exprt>>
67+
try_get_string_data_array(
68+
const refined_string_exprt &s,
69+
const namespacet &ns);
70+
6671
simplify_exprt::resultt<> simplify_exprt::simplify_abs(const abs_exprt &expr)
6772
{
6873
if(expr.op().is_constant())
@@ -1818,8 +1823,20 @@ optionalt<std::string> simplify_exprt::expr2bits(
18181823
return {};
18191824
}
18201825

1821-
optionalt<std::reference_wrapper<const array_exprt>>
1822-
simplify_exprt::try_get_string_data_array(
1826+
/// Get char sequence from refined string expression
1827+
///
1828+
/// If `s.content()` is of the form `&id[e]`, where `id` is an array-typed
1829+
/// symbol expression (and `e` is any expression), return the value of the
1830+
/// symbol `id` (as given by the `value` field of the symbol in the namespace
1831+
/// `ns`); otherwise return an empty optional.
1832+
///
1833+
/// \param s: refined string expression
1834+
/// \param ns: namespace
1835+
/// \return array expression representing the char sequence which forms the
1836+
/// content of the refined string expression, empty optional if the content
1837+
/// cannot be determined
1838+
static optionalt<std::reference_wrapper<const array_exprt>>
1839+
try_get_string_data_array(
18231840
const refined_string_exprt &s,
18241841
const namespacet &ns)
18251842
{

src/util/simplify_expr_class.h

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -221,22 +221,6 @@ class simplify_exprt
221221
replace_mapt local_replace_map;
222222
#endif
223223

224-
/// Get char sequence from refined string expression
225-
///
226-
/// If `s.content()` is of the form `&id[e]`, where `id` is an array-typed
227-
/// symbol expression (and `e` is any expression), return the value of the
228-
/// symbol `id` (as given by the `value` field of the symbol in the namespace
229-
/// `ns`); otherwise return an empty optional.
230-
///
231-
/// \param s: refined string expression
232-
/// \param ns: namespace
233-
/// \return array expression representing the char sequence which forms the
234-
/// content of the refined string expression, empty optional if the content
235-
/// cannot be determined
236-
static optionalt<std::reference_wrapper<const array_exprt>>
237-
try_get_string_data_array(
238-
const refined_string_exprt &s,
239-
const namespacet &ns);
240224
};
241225

242226
#endif // CPROVER_UTIL_SIMPLIFY_EXPR_CLASS_H

0 commit comments

Comments
 (0)