Ejemplo n.º 1
0
void static_lifetime_init(
  const contextt &context,
  codet &dest)
{
  dest=code_blockt();

  // Do assignments based on "value".
  context.foreach_operand_in_order(
    [&dest] (const symbolt& s)
    {
      if(s.static_lifetime)
        init_variable(dest, s);
    }
  );

  // call designated "initialization" functions
  context.foreach_operand_in_order(
    [&dest] (const symbolt& s)
    {
      if(s.type.initialization() && s.type.is_code())
      {
        code_function_callt function_call;
        function_call.function() = symbol_expr(s);
        dest.move_to_operands(function_call);
      }
    }
  );
}
Ejemplo n.º 2
0
void add_failed_symbol(symbolt &symbol, contextt &context)
{
  if(!symbol.is_lvalue) return;
  
  if(symbol.type.get("#failed_symbol")!="")
    return;

  if(symbol.type.id()==ID_pointer)
  {
    symbolt new_symbol;
    new_symbol.is_lvalue=true;
    new_symbol.module=symbol.module;
    new_symbol.mode=symbol.mode;
    new_symbol.base_name=id2string(symbol.base_name)+"$object";
    new_symbol.name=failed_symbol_id(symbol.name);
    new_symbol.type=symbol.type.subtype();
    new_symbol.value.make_nil();
    new_symbol.type.set(ID_C_is_failed_symbol, true);
    
    symbol.type.set(ID_C_failed_symbol, new_symbol.name);
    
    if(new_symbol.type.id()==ID_pointer)
      add_failed_symbol(new_symbol, context); // recursive call
        
    context.move(new_symbol);
  }
}
Ejemplo n.º 3
0
reachability_treet::reachability_treet(
    const goto_functionst &goto_functions,
    const namespacet &ns,
    optionst &opts,
    std::shared_ptr<symex_targett> target,
    contextt &context,
    message_handlert &_message_handler) :
    goto_functions(goto_functions),
    permanent_context(context),
    ns(ns),
    options(opts),
    message_handler(_message_handler)
{
  // Put a few useful symbols in the symbol table.
  symbolt sym;
  sym.type = bool_typet();
  sym.name = "execution_statet::\\guard_exec";
  sym.base_name = "execution_statet::\\guard_exec";
  context.move(sym);

  CS_bound = atoi(options.get_option("context-bound").c_str());
  TS_slice = atoi(options.get_option("time-slice").c_str());
  state_hashing = options.get_bool_option("state-hashing");
  directed_interleavings = options.get_bool_option("direct-interleavings");
  interactive_ileaves = options.get_bool_option("interactive-ileaves");
  round_robin = options.get_bool_option("round-robin");
  schedule = options.get_bool_option("schedule");

  if (options.get_bool_option("no-por") || options.get_bool_option("control-flow-test"))
    por = false;
  else
    por = true;

  target_template = target;
}
Ejemplo n.º 4
0
void fix_symbolt::fix_context(contextt &context)
{
  for(type_mapt::const_iterator
      t_it=type_map.begin();
      t_it!=type_map.end();
      t_it++)
  {
    symbolst::iterator s_it=context.symbols.find(t_it->first);
    assert(s_it!=context.symbols.end());

    symbolt s=s_it->second;
    s.name=t_it->second.identifier();
    context.symbols.erase(s_it);
    context.move(s);
  }
}