File tree Expand file tree Collapse file tree 3 files changed +16
-5
lines changed Expand file tree Collapse file tree 3 files changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -162,10 +162,7 @@ bool remove_returnst::do_function_calls(
162
162
to_symbol_expr (function_call.function ()).get_identifier ();
163
163
164
164
// Do we return anything?
165
- if (
166
- to_code_type (function_call.function ().type ()).return_type () !=
167
- empty_typet () &&
168
- function_call.lhs ().is_not_nil ())
165
+ if (does_function_call_return (function_call))
169
166
{
170
167
// replace "lhs=f(...)" by
171
168
// "f(...); lhs=f#return_value; DEAD f#return_value;"
@@ -430,3 +427,10 @@ bool is_return_value_symbol(const symbol_exprt &symbol_expr)
430
427
{
431
428
return is_return_value_identifier (symbol_expr.get_identifier ());
432
429
}
430
+
431
+ bool does_function_call_return (const code_function_callt &function_call)
432
+ {
433
+ return to_code_type (function_call.function ().type ()).return_type () !=
434
+ empty_typet () &&
435
+ function_call.lhs ().is_not_nil ();
436
+ }
Original file line number Diff line number Diff line change @@ -73,6 +73,7 @@ Date: September 2009
73
73
74
74
#include < functional>
75
75
76
+ #include < util/std_code.h>
76
77
#include < util/std_types.h>
77
78
78
79
class goto_functionst ;
@@ -111,4 +112,9 @@ bool is_return_value_identifier(const irep_idt &id);
111
112
// / \ref return_value_symbol
112
113
bool is_return_value_symbol (const symbol_exprt &symbol_expr);
113
114
115
+ // / Check if the \p function_call returns anything
116
+ // / \param function_call: the function call to be investigated
117
+ // / \return true if non-void return type and non-nil lhs
118
+ bool does_function_call_return (const code_function_callt &function_call);
119
+
114
120
#endif // CPROVER_GOTO_PROGRAMS_REMOVE_RETURNS_H
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ Date: Oct 2018
14
14
#include < util/invariant.h>
15
15
16
16
#include " goto_functions.h"
17
+ #include " remove_returns.h"
17
18
18
19
namespace
19
20
{
@@ -132,7 +133,7 @@ void validate_goto_modelt::check_returns_removed()
132
133
const auto &function_call = instr.get_function_call ();
133
134
DATA_CHECK (
134
135
vm,
135
- function_call. lhs (). is_nil ( ),
136
+ ! does_function_call_return (function_call ),
136
137
" function call lhs return should be nil" );
137
138
}
138
139
}
You can’t perform that action at this time.
0 commit comments