File tree Expand file tree Collapse file tree 3 files changed +4
-35
lines changed
src/goto-instrument/contracts Expand file tree Collapse file tree 3 files changed +4
-35
lines changed Original file line number Diff line number Diff line change @@ -780,9 +780,10 @@ void code_contractst::apply_function_contract(
780780 {
781781 // If the function does return a value, but the return value is
782782 // disregarded, check if the postcondition includes the return value.
783- return_value_visitort v;
784- ensures.visit (v);
785- if (v.found_return_value ())
783+ if (has_subexpr (ensures, [](const exprt &e) {
784+ return e.id () == ID_symbol && to_symbol_expr (e).get_identifier () ==
785+ CPROVER_PREFIX " return_value" ;
786+ }))
786787 {
787788 // The postcondition does mention __CPROVER_return_value, so mint a
788789 // fresh variable to replace __CPROVER_return_value with.
Original file line number Diff line number Diff line change @@ -23,19 +23,6 @@ Date: July 2021
2323#include < util/config.h>
2424#include < util/prefix.h>
2525
26- bool return_value_visitort::found_return_value ()
27- {
28- return found;
29- }
30-
31- void return_value_visitort::operator ()(const exprt &exp)
32- {
33- if (exp.id () != ID_symbol)
34- return ;
35- const symbol_exprt &sym = to_symbol_expr (exp);
36- found |= sym.get_identifier () == CPROVER_PREFIX " return_value" ;
37- }
38-
3926std::set<irep_idt> &functions_in_scope_visitort::function_calls ()
4027{
4128 return function_set;
Original file line number Diff line number Diff line change @@ -101,25 +101,6 @@ class find_is_fresh_calls_visitort
101101 std::set<goto_programt::targett> function_set;
102102};
103103
104- // / Predicate to be used with the exprt::visit() function. The function
105- // / found_return_value() will return `true` iff this predicate is called on an
106- // / expr that contains `__CPROVER_return_value`.
107- class return_value_visitort : public const_expr_visitort
108- {
109- public:
110- return_value_visitort () : const_expr_visitort(), found(false )
111- {
112- }
113-
114- // \brief Has this object been passed to exprt::visit() on an exprt whose
115- // descendants contain __CPROVER_return_value?
116- bool found_return_value ();
117- void operator ()(const exprt &exp) override ;
118-
119- protected:
120- bool found;
121- };
122-
123104// / Predicate to be used with the exprt::visit() function. The function
124105// / found_return_value() will return `true` iff this predicate is called on an
125106// / expr that contains `__CPROVER_return_value`.
You can’t perform that action at this time.
0 commit comments