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)); } }
void bmct::show_vcc_json(std::ostream &out) { json_objectt json_result; json_arrayt &json_vccs=json_result["vccs"].make_array(); languagest languages(ns, new_ansi_c_language()); bool has_threads=equation.has_threads(); for(symex_target_equationt::SSA_stepst::iterator s_it=equation.SSA_steps.begin(); s_it!=equation.SSA_steps.end(); s_it++) { if(!s_it->is_assert()) continue; // vcc object json_objectt &object=json_vccs.push_back(jsont()).make_object(); const source_locationt &source_location=s_it->source.pc->source_location; if(source_location.is_not_nil()) object["sourceLocation"]=json(source_location); const std::string &s=s_it->comment; if(!s.empty()) object["comment"]=json_stringt(s); // we show everything in case there are threads symex_target_equationt::SSA_stepst::const_iterator last_it=has_threads?equation.SSA_steps.end():s_it; json_arrayt &json_constraints=object["constraints"].make_array(); for(symex_target_equationt::SSA_stepst::const_iterator p_it =equation.SSA_steps.begin(); p_it!=last_it; p_it++) { if((p_it->is_assume() || p_it->is_assignment() || p_it->is_constraint()) && !p_it->ignore) { std::string string_value; languages.from_expr(p_it->cond_expr, string_value); json_constraints.push_back(json_stringt(string_value)); } } std::string string_value; languages.from_expr(s_it->cond_expr, string_value); object["expression"]=json_stringt(string_value); } out << ",\n" << json_result; }
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); } }