@@ -46,6 +46,45 @@ struct static_verifier_resultt
4646 irep_idt function_id;
4747 ai_history_baset::trace_sett unknown_histories;
4848 ai_history_baset::trace_sett false_histories;
49+
50+ jsont output_json (void ) const
51+ {
52+ json_arrayt unknown_json;
53+ for (const auto &trace_ptr : this ->unknown_histories )
54+ unknown_json.push_back (trace_ptr->output_json ());
55+
56+ json_arrayt false_json;
57+ for (const auto &trace_ptr : this ->false_histories )
58+ false_json.push_back (trace_ptr->output_json ());
59+
60+ return json_objectt{
61+ {" status" , json_stringt{message (this ->status )}},
62+ {" sourceLocation" , json (this ->source_location )},
63+ {" unknownHistories" , unknown_json},
64+ {" falseHistories" , false_json},
65+ };
66+ }
67+
68+ xmlt output_xml (void ) const
69+ {
70+ xmlt x (" result" );
71+
72+ x.set_attribute (" status" , message (this ->status ));
73+ x.set_attribute (" file" , id2string (this ->source_location .get_file ()));
74+ x.set_attribute (" line" , id2string (this ->source_location .get_line ()));
75+ x.set_attribute (
76+ " description" , id2string (this ->source_location .get_comment ()));
77+
78+ xmlt &unknown_xml = x.new_element (" unknown" );
79+ for (const auto &trace_ptr : this ->unknown_histories )
80+ unknown_xml.new_element (trace_ptr->output_xml ());
81+
82+ xmlt &false_xml = x.new_element (" false" );
83+ for (const auto &trace_ptr : this ->false_histories )
84+ false_xml.new_element (trace_ptr->output_xml ());
85+
86+ return x;
87+ }
4988};
5089
5190static statust
@@ -248,9 +287,7 @@ static void static_verifier_json(
248287 m.status () << " Writing JSON report" << messaget::eom;
249288 out << make_range (results)
250289 .map ([](const static_verifier_resultt &result) {
251- return json_objectt{
252- {" status" , json_stringt{message (result.status )}},
253- {" sourceLocation" , json (result.source_location )}};
290+ return result.output_json ();
254291 })
255292 .collect <json_arrayt>();
256293}
@@ -263,17 +300,8 @@ static void static_verifier_xml(
263300 m.status () << " Writing XML report" << messaget::eom;
264301
265302 xmlt xml_result{" cprover" };
266-
267303 for (const auto &result : results)
268- {
269- xmlt &x = xml_result.new_element (" result" );
270-
271- x.set_attribute (" status" , message (result.status ));
272- x.set_attribute (" file" , id2string (result.source_location .get_file ()));
273- x.set_attribute (" line" , id2string (result.source_location .get_line ()));
274- x.set_attribute (
275- " description" , id2string (result.source_location .get_comment ()));
276- }
304+ xml_result.new_element (result.output_xml ());
277305
278306 out << xml_result;
279307}
0 commit comments