/*******************************************************************\

Module: Goto Programs with Functions

Author: Daniel Kroening

Date: October 2005

\*******************************************************************/

#ifndef CPROVER_FUNCTION_DEPENDENCIES_H
#define CPROVER_FUNCTION_DEPENDENCIES_H

#include "goto_functions.h"

class function_dependenciest
{
public:
  typedef hash_set_cont<irep_idt, irep_id_hash> function_sett;
  typedef hash_map_cont<irep_idt, function_sett, irep_id_hash> dependenciest;

  // function calls what?
  dependenciest calls;
  
  // who is calling the function?
  dependenciest called_by;

  void compute(const goto_functionst &goto_functions);
  
  void get_all_calls(
    const irep_idt &identifier,
    function_sett &calls);

  void get_all_calls(function_sett &calls);

protected:
  void compute(
    const goto_functiont &goto_function,
    function_sett &function_set);
    
  void compute(
    const goto_programt &goto_program,
    function_sett &function_set);
    
  void call_rec(
    const exprt &function,
    function_sett &function_set);
};

#endif
