Exemple #1
0
void var_mapt::init(var_infot &var_info)
{
  if(has_prefix(id2string(var_info.symbol), "symex_dynamic::"))
  {
    var_info.kind=var_infot::SHARED;
  }
  else
  {
    // Check for the presence of va_args
    std::size_t found=id2string(var_info.symbol).find("::va_arg");
    if(found != std::string::npos)
    {
      var_info.kind=var_infot::PROCEDURE_LOCAL;
    }
    else
    {
      const symbolt *symbol=0;
      if(ns.lookup(var_info.symbol, symbol))
        throw "var_mapt::init identifier \""
          +id2string(var_info.full_identifier)
          +"\" lookup in ns failed";

      if(symbol->is_static_lifetime)
      {
        if(symbol->is_thread_local)
          var_info.kind=var_infot::THREAD_LOCAL;
        else
          var_info.kind=var_infot::SHARED;
      }
      else
        var_info.kind=var_infot::PROCEDURE_LOCAL;
    }
  }

  if(var_info.is_shared())
    var_info.number=shared_count++;
  else
    var_info.number=local_count++;
}
Exemple #2
0
void var_mapt::init(var_infot &var_info)
{
  if(has_prefix(id2string(var_info.symbol), "symex_dynamic::"))
  {
    var_info.kind=var_infot::SHARED;
  }
  else
  {
    try
    {
      const symbolt &symbol=ns.lookup(var_info.symbol);

      if(symbol.is_static_lifetime)
      {
        if(symbol.is_thread_local)
          var_info.kind=var_infot::THREAD_LOCAL;
        else
          var_info.kind=var_infot::SHARED;
      }
      else
        var_info.kind=var_infot::PROCEDURE_LOCAL;
    }

    catch(std::string s)
    {
      throw "var_mapt::init identifier \"" +
            id2string(var_info.full_identifier)+
            "\" lookup in ns failed";
    }
  }

  if(var_info.is_shared())
    var_info.number=shared_count++;
  else
    var_info.number=local_count++;
}