当前位置: 首页>>代码示例>>C++>>正文


C++ id2string函数代码示例

本文整理汇总了C++中id2string函数的典型用法代码示例。如果您正苦于以下问题:C++ id2string函数的具体用法?C++ id2string怎么用?C++ id2string使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了id2string函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: show_properties_json

void show_properties_json(
  json_arrayt &json_properties,
  const namespacet &ns,
  const irep_idt &identifier,
  const goto_programt &goto_program)
{
  for(const auto &ins : goto_program.instructions)
  {
    if(!ins.is_assert())
      continue;

    const source_locationt &source_location=ins.source_location;

    const irep_idt &comment=source_location.get_comment();
    // const irep_idt &function=location.get_function();
    const irep_idt &property_class=source_location.get_property_class();
    const irep_idt description=
      (comment==""?"assertion":comment);

    irep_idt property_id=source_location.get_property_id();

    json_objectt &json_property=
      json_properties.push_back(jsont()).make_object();
    json_property["name"]=json_stringt(id2string(property_id));
    json_property["class"]=json_stringt(id2string(property_class));
    json_property["sourceLocation"]=json(source_location);
    json_property["description"]=json_stringt(id2string(description));
    json_property["expression"]=
      json_stringt(from_expr(ns, identifier, ins.guard));
  }
}
开发者ID:danpoe,项目名称:cbmc,代码行数:31,代码来源:show_properties.cpp

示例2: status

void fault_localizationt::report(irep_idt goal_id)
{
  if(goal_id==ID_nil)
    goal_id=failed->source.pc->source_location.get_property_id();

  lpointst &lpoints = lpoints_map[goal_id];

  if(lpoints.empty())
  {
    status() << "["+id2string(goal_id)+"]: \n"
                   << "   unable to localize fault"
                   << eom;
    return;
  }

  debug() << "Fault localization scores:" << eom;
  lpointt &max=lpoints.begin()->second;
  for(auto &l : lpoints)
  {
    debug() << l.second.target->source_location
            << "\n  score: " << l.second.score << eom;
    if(max.score<l.second.score)
      max=l.second;
  }
  status() << "["+id2string(goal_id)+"]: \n"
                   << "  " << max.target->source_location
                   << eom;
}
开发者ID:dcattaruzza,项目名称:cbmc,代码行数:28,代码来源:fault_localization.cpp

示例3: edge

void graphml_witness_extt::add_edge(
  const graphmlt::node_indext &from,
  const dynamic_cfg_nodet &from_cfg_node,
  const graphmlt::node_indext &to,
  const dynamic_cfg_nodet &to_cfg_node)
{
  const source_locationt &source_location=from_cfg_node.id.pc->source_location;

  xmlt edge("edge");
  edge.set_attribute("source", graphml[from].node_name);
  edge.set_attribute("target", graphml[to].node_name);

  {
    xmlt &data_f=edge.new_element("data");
    data_f.set_attribute("key", "originfile");
    data_f.data=id2string(source_location.get_file());

    xmlt &data_l=edge.new_element("data");
    data_l.set_attribute("key", "startline");
    data_l.data=id2string(source_location.get_line());

    if(to_cfg_node.is_loop_head)
    {
      xmlt &data_l=edge.new_element("data");
      data_l.set_attribute("key", "enterLoopHead");
      data_l.data="true";
    }
  }

  graphml[to].in[from].xml_node=edge;
  graphml[from].out[to].xml_node=edge;
}
开发者ID:diffblue,项目名称:2ls,代码行数:32,代码来源:graphml_witness_ext.cpp

示例4: forall_irep

irep_idt cpp_declarator_convertert::get_pretty_name()
{
    if(is_code)
    {
        const irept::subt &parameters=
            final_type.find(ID_parameters).get_sub();

        std::string result=scope->prefix+id2string(base_name)+"(";

        forall_irep(it, parameters)
        {
            const typet &parameter_type=((exprt &)*it).type();

            if(it!=parameters.begin())
                result+=", ";

            result+=cpp_typecheck.to_string(parameter_type);
        }

        result+=')';

        return result;
    }

    return scope->prefix+id2string(base_name);
}
开发者ID:sarnold,项目名称:cbmc,代码行数:26,代码来源:cpp_declarator_converter.cpp

示例5: if

void component_exprt::gen_loc_var(
    exprt &loc_var,
    const exprt &expr, 
    std::string suffix)
{
  std::string base;
  if (expr.id()==ID_symbol)
    base="."+id2string(to_symbol_expr(expr).get_identifier());
  else if (expr.id()==ID_constant)
    base=".const";
  else if (expr.id()==ID_typecast)
  {
    base=".typecast__"+id2string(expr.type().id());
    if (expr.type().id()==ID_signedbv)
    {
      base=base+i2string(to_signedbv_type(expr.type()).get_width());
    }
    else if (expr.type().id()==ID_unsignedbv)
    {
      base=base+i2string(to_unsignedbv_type(expr.type()).get_width());
    }
  }
  else if(id_maps.find(expr.id())!=id_maps.end())
    base=".OPERATOR."+id_maps[expr.id()];
  else
    base=".OPERATOR."+id2string(expr.id());
  std::string final_name="L."+id2string(source_location.get_line())+"."+i2string(instruction_number)+"_"+i2string(component_cnt)+"_"+i2string(unique_identifier)+base+suffix;
  //typet type(ID_integer);
  //exprt loc_var(ID_symbol, type);
  to_symbol_expr(loc_var).set_identifier(final_name);
}
开发者ID:rbavishi,项目名称:iCBMC,代码行数:31,代码来源:component_e.cpp

示例6: warning

void java_bytecode_convertt::generate_class_stub(const irep_idt &class_name)
{
  class_typet class_type;

  class_type.set_tag(class_name);
  class_type.set(ID_base_name, class_name);

  class_type.set(ID_incomplete_class, true);

  // produce class symbol
  symbolt new_symbol;
  new_symbol.base_name=class_name;
  new_symbol.pretty_name=class_name;
  new_symbol.name="java::"+id2string(class_name);
  class_type.set(ID_name, new_symbol.name);
  new_symbol.type=class_type;
  new_symbol.mode=ID_java;
  new_symbol.is_type=true;
  
  symbolt *class_symbol;
  
  if(symbol_table.move(new_symbol, class_symbol))
  {
    warning() << "stub class symbol "+id2string(new_symbol.name)+" already exists";
  }
  else
  {
    // create the class identifier
    create_class_identifier(*class_symbol);
  }
}
开发者ID:romainbrenguier,项目名称:cbmc,代码行数:31,代码来源:java_bytecode_convert.cpp

示例7: get_language

std::unique_ptr<languaget> get_language(
  const namespacet &ns,
  const irep_idt &identifier)
{
  if(identifier=="")
    return std::unique_ptr<languaget>(get_default_language());
  else
  {
    const symbolt *symbol;
    
    if(ns.lookup(identifier, symbol))
      return std::unique_ptr<languaget>(get_default_language());
    else if(symbol->mode=="")
      return std::unique_ptr<languaget>(get_default_language());
    else
    {
      languaget *ptr=get_language_from_mode(symbol->mode);

      if(ptr==NULL)
        throw "symbol `"+id2string(symbol->name)+
              "' has unknown mode '"+id2string(symbol->mode)+"'";

      return std::unique_ptr<languaget>(ptr);
    }
  }
}
开发者ID:sarnold,项目名称:cbmc,代码行数:26,代码来源:language_util.cpp

示例8: assert

var_mapt::var_infot & var_mapt::operator()(
  const irep_idt &symbol,
  const irep_idt &suffix,
  const typet &type)
{
  assert(symbol!=irep_idt());

  std::string full_identifier=
    id2string(symbol)+id2string(suffix);

  std::pair<id_mapt::iterator, bool> result;

  result=id_map.insert(std::pair<irep_idt, var_infot>(
    full_identifier, var_infot()));

  if(result.second) // inserted?
  {
    result.first->second.full_identifier=full_identifier;
    result.first->second.symbol=symbol;
    result.first->second.suffix=suffix;
    result.first->second.type=type;
    init(result.first->second);
  }

  return result.first->second;
}
开发者ID:lihaol,项目名称:cbmc,代码行数:26,代码来源:var_map.cpp

示例9: type_eq

bool type_eq(const typet &type1, const typet &type2, const namespacet &ns)
{
  if(type1 == type2)
    return true;

  if(type1.id() == "symbol")
  {
    const symbolt &symbol = ns.lookup(type1);
    if(!symbol.is_type)
      throw "symbol " + id2string(symbol.name) + " is not a type";

    return type_eq(symbol.type, type2, ns);
  }

  if(type2.id() == "symbol")
  {
    const symbolt &symbol = ns.lookup(type2);
    if(!symbol.is_type)
      throw "symbol " + id2string(symbol.name) + " is not a type";

    return type_eq(type1, symbol.type, ns);
  }

  return false;
}
开发者ID:esbmc,项目名称:esbmc,代码行数:25,代码来源:type_eq.cpp

示例10: if

void cpp_declarator_convertert::get_final_identifier()
{
  std::string identifier=id2string(base_name);

  // main is always "C" linkage, as a matter of principle
  if(is_code &&
     base_name==ID_main &&
     scope->prefix=="")
  {
    linkage_spec=ID_C;
  }

  if(is_code)
  {
    // is there already an `extern "C"' function with the same name?
    
    if(linkage_spec==ID_auto &&
       scope->prefix=="" &&
       cpp_typecheck.context.symbols.find("c::"+identifier)!=
       cpp_typecheck.context.symbols.end())
    {
    }
    else if(linkage_spec!=ID_C)
    {
      // add C++ decoration
      identifier+=id2string(cpp_typecheck.function_identifier(final_type));
    }
  }

  final_identifier=
    "c::"+
    scope->prefix+
    identifier;
}
开发者ID:ashokkelur,项目名称:CBMC-With-DSP-C,代码行数:34,代码来源:cpp_declarator_converter.cpp

示例11: id2string

void java_class_loadert::read_jar_file(
  java_class_loader_limitt &class_loader_limit,
  const irep_idt &file)
{
  // done already?
  if(jar_map.find(file)!=jar_map.end())
    return;

  jar_filet &jar_file=jar_pool(class_loader_limit, id2string(file));

  if(!jar_file)
  {
    error() << "failed to open JAR file `" << file << "'" << eom;
    return;
  }

  debug() << "adding JAR file `" << file << "'" << eom;

  auto &jm=jar_map[file];

  for(auto &jar_entry : jar_file.filtered_jar)
  {
    std::string file_name=id2string(jar_entry.first);

    // does it end on .class?
    if(has_suffix(file_name, ".class"))
    {
      irep_idt class_name=file_to_class_name(file_name);

      // record
      jm.entries[class_name].class_file_name=file_name;
    }
  }
}
开发者ID:danpoe,项目名称:cbmc,代码行数:34,代码来源:java_class_loader.cpp

示例12: array_name

std::string array_name(
  const namespacet &ns,
  const exprt &expr)
{
  if(expr.id()==ID_index)
  {
    if(expr.operands().size()!=2)
      throw "index takes two operands";

    return array_name(ns, expr.op0())+"[]";
  }
  else if(is_ssa_expr(expr))
  {
    const symbolt &symbol=
      ns.lookup(to_ssa_expr(expr).get_object_name());
    return "array `"+id2string(symbol.base_name)+"'";
  }
  else if(expr.id()==ID_symbol)
  {
    const symbolt &symbol=ns.lookup(expr);
    return "array `"+id2string(symbol.base_name)+"'";
  }
  else if(expr.id()==ID_string_constant)
  {
    return "string constant";
  }
  else if(expr.id()==ID_member)
  {
    assert(expr.operands().size()==1);
    return array_name(ns, expr.op0())+"."+
           expr.get_string(ID_component_name);
  }

  return "array";
}
开发者ID:dcattaruzza,项目名称:cbmc,代码行数:35,代码来源:array_name.cpp

示例13: show_properties

void show_properties(
  const namespacet &ns,
  const irep_idt &identifier,
  ui_message_handlert::uit ui,
  const goto_programt &goto_program)
{
  for(const auto &ins : goto_program.instructions)
  {
    if(!ins.is_assert())
      continue;

    const source_locationt &source_location=ins.source_location;

    const irep_idt &comment=source_location.get_comment();
    const irep_idt &property_class=source_location.get_property_class();
    const irep_idt description=
      (comment==""?"assertion":comment);

    irep_idt property_id=source_location.get_property_id();

    switch(ui)
    {
    case ui_message_handlert::uit::XML_UI:
      {
        // use me instead
        xmlt xml_property("property");
        xml_property.set_attribute("name", id2string(property_id));
        xml_property.set_attribute("class", id2string(property_class));

        xmlt &property_l=xml_property.new_element();
        property_l=xml(source_location);

        xml_property.new_element("description").data=id2string(description);
        xml_property.new_element("expression").data=
          from_expr(ns, identifier, ins.guard);

        std::cout << xml_property << '\n';
      }
      break;

    case ui_message_handlert::uit::JSON_UI:
      UNREACHABLE;
      break;

    case ui_message_handlert::uit::PLAIN:
      std::cout << "Property " << property_id << ":\n";

      std::cout << "  " << ins.source_location << '\n'
                << "  " << description << '\n'
                << "  " << from_expr(ns, identifier, ins.guard)
                        << '\n';

      std::cout << '\n';
      break;

    default:
      UNREACHABLE;
    }
  }
}
开发者ID:danpoe,项目名称:cbmc,代码行数:60,代码来源:show_properties.cpp

示例14: convert

void java_bytecode_convert_classt::convert(
  symbolt &class_symbol,
  const fieldt &f)
{
  typet field_type=java_type_from_string(f.signature);

  // is this a static field?
  if(f.is_static)
  {
    // Create the symbol; we won't add to the struct type.
    symbolt new_symbol;

    new_symbol.is_static_lifetime=true;
    new_symbol.is_lvalue=true;
    new_symbol.is_state_var=true;
    new_symbol.name=id2string(class_symbol.name)+"."+id2string(f.name);
    new_symbol.base_name=f.name;
    new_symbol.type=field_type;
    new_symbol.pretty_name=id2string(class_symbol.pretty_name)+
      "."+id2string(f.name);
    new_symbol.mode=ID_java;
    new_symbol.is_type=false;
    const namespacet ns(symbol_table);
    new_symbol.value=
      zero_initializer(
        field_type,
        class_symbol.location,
        ns,
        get_message_handler());

    // Do we have the static field symbol already?
    const auto s_it=symbol_table.symbols.find(new_symbol.name);
    if(s_it!=symbol_table.symbols.end())
      symbol_table.symbols.erase(s_it); // erase, we stubbed it

    if(symbol_table.add(new_symbol))
      assert(false && "failed to add static field symbol");
  }
  else
  {
    class_typet &class_type=to_class_type(class_symbol.type);

    class_type.components().push_back(class_typet::componentt());
    class_typet::componentt &component=class_type.components().back();

    component.set_name(f.name);
    component.set_base_name(f.name);
    component.set_pretty_name(f.name);
    component.type()=field_type;

    if(f.is_private)
      component.set_access(ID_private);
    else if(f.is_protected)
      component.set_access(ID_protected);
    else if(f.is_public)
      component.set_access(ID_public);
  }
}
开发者ID:lihaol,项目名称:cbmc,代码行数:58,代码来源:java_bytecode_convert_class.cpp

示例15: is_jsa_heap

bool is_jsa_heap(const typet &type)
{
  const irep_idt &type_id=type.id();
  if (ID_symbol == type_id)
    return id2string(to_symbol_type(type).get_identifier()) == JSA_HEAP_TAG;
  if (ID_struct != type_id) return false;
  const irep_idt tag(to_struct_type(type).get_tag());
  return id2string(tag) == JSA_HEAP_TAG;
}
开发者ID:lihaol,项目名称:cbmc,代码行数:9,代码来源:jsa_meta_data.cpp


注:本文中的id2string函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。