@@ -117,20 +117,19 @@ static void add_to_json(
117117 const dead_mapt &dead_map,
118118 json_arrayt &dest)
119119{
120- json_objectt &entry=dest.push_back ().make_object ();
121-
122120 PRECONDITION (!goto_program.instructions .empty ());
123121 goto_programt::const_targett end_function=
124122 goto_program.instructions .end ();
125123 --end_function;
126124 DATA_INVARIANT (end_function->is_end_function (),
127125 " The last instruction in a goto-program must be END_FUNCTION" );
128126
129- entry[" function" ] = json_stringt (end_function->function );
130- entry[" fileName" ]=
131- json_stringt (concat_dir_file (
127+ json_objectt entry (
128+ {{" function" , json_stringt (end_function->function )},
129+ {" fileName" ,
130+ json_stringt (concat_dir_file (
132131 id2string (end_function->source_location .get_working_directory ()),
133- id2string (end_function->source_location .get_file ())));
132+ id2string (end_function->source_location .get_file ())))}}) ;
134133
135134 json_arrayt &dead_ins=entry[" unreachableInstructions" ].make_array ();
136135
@@ -152,11 +151,13 @@ static void add_to_json(
152151 s.erase (s.size ()-1 );
153152
154153 // print info for file actually with full path
155- json_objectt &i_entry=dead_ins.push_back ().make_object ();
156154 const source_locationt &l=it->second ->source_location ;
157- i_entry[" sourceLocation" ]=json (l);
158- i_entry[" statement" ]=json_stringt (s);
155+ json_objectt i_entry (
156+ {{" sourceLocation" , json (l)}, {" statement" , json_stringt (s)}});
157+ dead_ins.push_back (std::move (i_entry));
159158 }
159+
160+ dest.push_back (std::move (entry));
160161}
161162
162163void unreachable_instructions (
@@ -255,17 +256,16 @@ static void json_output_function(
255256 const source_locationt &last_location,
256257 json_arrayt &dest)
257258{
258- json_objectt &entry=dest.push_back ().make_object ();
259-
260- entry[" function" ] = json_stringt (function);
261- entry[" file name" ]=
262- json_stringt (concat_dir_file (
259+ json_objectt entry (
260+ {{" function" , json_stringt (function)},
261+ {" file name" ,
262+ json_stringt (concat_dir_file (
263263 id2string (first_location.get_working_directory ()),
264- id2string (first_location.get_file ())));
265- entry[ " first line" ]=
266- json_numbert (id2string (first_location .get_line ()));
267- entry[ " last line " ]=
268- json_numbert ( id2string (last_location. get_line () ));
264+ id2string (first_location.get_file ())))},
265+ { " first line" , json_numbert ( id2string (first_location. get_line ()))},
266+ { " last line " , json_numbert (id2string (last_location .get_line ()))}} );
267+
268+ dest. push_back ( std::move (entry ));
269269}
270270
271271static void xml_output_function (
0 commit comments