예제 #1
0
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));
  }
}
예제 #2
0
void goto_difft::convert_function_group(
  json_arrayt &result,
  const irep_id_sett &function_group) const
{
  for(irep_id_sett::const_iterator it=function_group.begin();
      it!=function_group.end(); ++it)
  {
    convert_function(result.push_back(jsont()).make_object(), *it);
  }
}
예제 #3
0
파일: loop_ids.cpp 프로젝트: lihaol/cbmc
void show_loop_ids_json(
  ui_message_handlert::uit ui,
  const goto_programt &goto_program,
  json_arrayt &loops)
{
  assert(ui==ui_message_handlert::JSON_UI); //use function above

  forall_goto_program_instructions(it, goto_program)
  {
    if(it->is_backwards_goto())
    {
      unsigned loop_id=it->loop_number;
      std::string id=id2string(it->function)+"."+std::to_string(loop_id);

      json_objectt &loop=loops.push_back().make_object();
      loop["name"]=json_stringt(id);
      loop["sourceLocation"]=json(it->source_location);
    }
  }
}