40 const json_irept no_comments_irep_converter(
false);
43 const irep_idt &function_name=function_entry.first;
49 json_function[
"isBodyAvailable"]=
55 if(
function.body_available())
59 for(
const goto_programt::instructiont &instruction :
60 function.body.instructions)
64 instruction_entry[
"instructionId"]=
67 if(instruction.code.source_location().is_not_nil())
69 instruction_entry[
"sourceLocation"]=
70 json(instruction.code.source_location());
73 std::ostringstream instruction_builder;
74 function.body.output_instruction(
75 ns, function_name, instruction_builder, instruction);
77 instruction_entry[
"instruction"]=
80 if(!instruction.code.operands().empty())
87 operand, operand_object);
90 instruction_entry[
"operands"]=operand_array;
93 if(!instruction.guard.is_true())
100 instruction_entry[
"guard"]=guard_object;
103 json_instruction_array.
push_back(instruction_entry);
106 json_function[
"instructions"]=json_instruction_array;
110 json_result[
"functions"]=json_functions;
const std::string & id2string(const irep_idt &d)
void convert_from_irep(const irept &irep, jsont &json) const
To convert to JSON from an irep structure by recursively generating JSON for the different sub trees...
Goto Programs with Functions.
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...
jsont & push_back(const jsont &json)
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...
static irep_idt entry_point()
show_goto_functions_jsont(const namespacet &ns)
For outputting the GOTO program in a readable JSON format.
function_mapt function_map
bool has_prefix(const std::string &s, const std::string &prefix)
Base class for all expressions.
json_objectt & make_object()
goto_functionst goto_functions
json_objectt json(const source_locationt &location)