25 : list_only(_list_only)
35 const json_irept no_comments_irep_converter(
false);
37 const auto sorted = goto_functions.
sorted();
39 for(
const auto &function_entry : sorted)
41 const irep_idt &function_name = function_entry->first;
47 json_function[
"isBodyAvailable"]=
59 if(function.body_available())
64 function.body.instructions)
67 {
"instructionId",
json_stringt(instruction.to_string())}};
69 if(instruction.code().source_location().is_not_nil())
71 instruction_entry[
"sourceLocation"] =
72 json(instruction.code().source_location());
75 std::ostringstream instruction_builder;
76 instruction.output(instruction_builder);
78 instruction_entry[
"instruction"]=
81 if(!instruction.code().operands().empty())
84 for(
const exprt &operand : instruction.code().operands())
91 instruction_entry[
"operands"] = std::move(operand_array);
94 if(instruction.has_condition())
98 instruction.condition());
100 instruction_entry[
"guard"] = std::move(guard_object);
103 json_instruction_array.
push_back(std::move(instruction_entry));
106 json_function[
"instructions"] = std::move(json_instruction_array);
129 out <<
convert(goto_functions);
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Base class for all expressions.
A collection of goto functions.
std::vector< function_mapt::const_iterator > sorted() const
returns a vector of the iterators in alphabetical order
::goto_functiont goto_functiont
This class represents an instruction in the GOTO intermediate representation.
jsont & push_back(const jsont &json)
json_objectt convert_from_irep(const irept &) const
To convert to JSON from an irep structure by recursively generating JSON for the different sub trees.
static jsont json_boolean(bool value)
void operator()(const goto_functionst &goto_functions, std::ostream &out, bool append=true)
Print the json object generated by show_goto_functions_jsont::show_goto_functions to the provided str...
json_objectt convert(const goto_functionst &goto_functions)
Walks through all of the functions in the program and returns a JSON object representing all their fu...
show_goto_functions_jsont(bool _list_only=false)
For outputting the GOTO program in a readable JSON format.
bool has_prefix(const std::string &s, const std::string &prefix)
Goto Programs with Functions.
const std::string & id2string(const irep_idt &d)
static void json(json_objectT &result, const irep_idt &property_id, const property_infot &property_info)