|
15 | 15 | #include <cassert>
|
16 | 16 | #include <memory>
|
17 | 17 |
|
| 18 | +#include <util/json_irep.h> |
18 | 19 | #include <util/std_expr.h>
|
19 | 20 | #include <util/std_code.h>
|
20 | 21 |
|
@@ -115,20 +116,28 @@ jsont static_analysis_baset::output_json(
|
115 | 116 | const irep_idt &identifier) const
|
116 | 117 | {
|
117 | 118 | json_arrayt retval;
|
| 119 | + json_irept irep_converter(true); |
118 | 120 |
|
119 | 121 | forall_goto_program_instructions(i_it, goto_program)
|
120 | 122 | {
|
121 |
| - std::ostringstream out; |
122 |
| - out << "**** " << i_it->location_number << " " |
123 |
| - << i_it->source_location << "\n"; |
124 |
| - |
125 |
| - get_state(i_it).output(ns, out); |
126 |
| - out << "\n"; |
127 |
| - #if 1 |
128 |
| - goto_program.output_instruction(ns, identifier, out, i_it); |
129 |
| - out << "\n"; |
130 |
| - #endif |
131 |
| - retval.push_back(json_stringt(out.str())); |
| 123 | + json_objectt instruction_object; |
| 124 | + instruction_object["location_number"]= |
| 125 | + json_numbert(std::to_string(i_it->location_number)); |
| 126 | + instruction_object["source_location"]= |
| 127 | + irep_converter.convert_from_irep(i_it->source_location); |
| 128 | + instruction_object["code"]= |
| 129 | + irep_converter.convert_from_irep(i_it->code); |
| 130 | + { |
| 131 | + std::ostringstream pretty_type; |
| 132 | + pretty_type << i_it->type; |
| 133 | + instruction_object["instruction_type"]=json_stringt(pretty_type.str()); |
| 134 | + } |
| 135 | + { |
| 136 | + std::ostringstream state_text; |
| 137 | + get_state(i_it).output(ns, state_text); |
| 138 | + instruction_object["state"]=json_stringt(state_text.str()); |
| 139 | + } |
| 140 | + retval.push_back(instruction_object); |
132 | 141 | }
|
133 | 142 |
|
134 | 143 | return retval;
|
|
0 commit comments