CBMC
symex_set_return_value.cpp
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module: Symbolic Execution of ANSI-C
4 
5 Author: Daniel Kroening, kroening@kroening.com
6 
7 \*******************************************************************/
8 
11 
12 #include "goto_symex.h"
13 
15  statet &state,
16  const exprt &return_value)
17 {
18  // we must be inside a function that was called
19  PRECONDITION(!state.call_stack().empty());
20 
21  framet &frame = state.call_stack().top();
22  if(frame.return_value_symbol.has_value())
23  {
24  symex_assign(state, frame.return_value_symbol.value(), return_value);
25  }
26 }
goto_symex_statet
Central data structure: state.
Definition: goto_symex_state.h:41
exprt
Base class for all expressions.
Definition: expr.h:55
goto_symex_statet::call_stack
call_stackt & call_stack()
Definition: goto_symex_state.h:144
framet::return_value_symbol
optionalt< symbol_exprt > return_value_symbol
Definition: frame.h:35
call_stackt::top
framet & top()
Definition: call_stack.h:17
PRECONDITION
#define PRECONDITION(CONDITION)
Definition: invariant.h:463
goto_symex.h
framet
Stack frames – these are used for function calls and for exceptions.
Definition: frame.h:21
goto_symext::symex_set_return_value
void symex_set_return_value(statet &state, const exprt &return_value)
Symbolically execute a SET_RETURN_VALUE instruction.
Definition: symex_set_return_value.cpp:14
goto_symext::symex_assign
void symex_assign(statet &state, const exprt &lhs, const exprt &rhs)
Symbolically execute an ASSIGN instruction or simulate such an execution for a synthetic assignment.
Definition: goto_symex.cpp:40