Skip to content

Commit 2b15ce0

Browse files
committed
Remove unnecessary brackets in constructon of json_objectt
With the new constructors, these brackets are no longer required and can be removed, in order to improve readability.
1 parent 4453296 commit 2b15ce0

File tree

13 files changed

+109
-110
lines changed

13 files changed

+109
-110
lines changed

jbmc/src/jbmc/jbmc_parse_options.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ int jbmc_parse_optionst::doit()
465465
break;
466466
case ui_message_handlert::uit::JSON_UI:
467467
{
468-
json_objectt json_options({{"options", options.to_json()}});
468+
json_objectt json_options{{"options", options.to_json()}};
469469
debug() << json_options;
470470
break;
471471
}

src/analyses/ai.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,11 @@ jsont ai_baset::output_json(
101101
std::ostringstream out;
102102
goto_program.output_instruction(ns, identifier, out, *i_it);
103103

104-
json_objectt location(
105-
{{"locationNumber", json_numbert(std::to_string(i_it->location_number))},
106-
{"sourceLocation", json_stringt(i_it->source_location.as_string())},
107-
{"abstractState", abstract_state_before(i_it)->output_json(*this, ns)},
108-
{"instruction", json_stringt(out.str())}});
104+
json_objectt location{
105+
{"locationNumber", json_numbert(std::to_string(i_it->location_number))},
106+
{"sourceLocation", json_stringt(i_it->source_location.as_string())},
107+
{"abstractState", abstract_state_before(i_it)->output_json(*this, ns)},
108+
{"instruction", json_stringt(out.str())}};
109109

110110
contents.push_back(std::move(location));
111111
}

src/analyses/dependence_graph.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -283,19 +283,19 @@ jsont dep_graph_domaint::output_json(
283283

284284
for(const auto &cd : control_deps)
285285
{
286-
json_objectt link(
287-
{{"locationNumber", json_numbert(std::to_string(cd->location_number))},
288-
{"sourceLocation", json(cd->source_location)},
289-
{"type", json_stringt("control")}});
286+
json_objectt link{
287+
{"locationNumber", json_numbert(std::to_string(cd->location_number))},
288+
{"sourceLocation", json(cd->source_location)},
289+
{"type", json_stringt("control")}};
290290
graph.push_back(std::move(link));
291291
}
292292

293293
for(const auto &dd : data_deps)
294294
{
295-
json_objectt link(
296-
{{"locationNumber", json_numbert(std::to_string(dd->location_number))},
297-
{"sourceLocation", json(dd->source_location)},
298-
{"type", json_stringt("data")}});
295+
json_objectt link{
296+
{"locationNumber", json_numbert(std::to_string(dd->location_number))},
297+
{"sourceLocation", json(dd->source_location)},
298+
{"type", json_stringt("data")}};
299299
graph.push_back(std::move(link));
300300
}
301301

src/cbmc/bmc_cover.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ bool bmc_covert::operator()()
383383
{
384384
if(step.is_input())
385385
{
386-
json_objectt json_input({{"id", json_stringt(step.io_id)}});
386+
json_objectt json_input{{"id", json_stringt(step.io_id)}};
387387
if(step.io_args.size()==1)
388388
json_input["value"]=
389389
json(step.io_args.front(), bmc.ns, ID_unknown);

src/goto-analyzer/taint_analysis.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -353,12 +353,12 @@ bool taint_analysist::operator()(
353353

354354
if(use_json)
355355
{
356-
json_objectt json(
357-
{{"bugClass",
358-
json_stringt(i_it->source_location.get_property_class())},
359-
{"file", json_stringt(i_it->source_location.get_file())},
360-
{"line",
361-
json_numbert(id2string(i_it->source_location.get_line()))}});
356+
json_objectt json{
357+
{"bugClass",
358+
json_stringt(i_it->source_location.get_property_class())},
359+
{"file", json_stringt(i_it->source_location.get_file())},
360+
{"line",
361+
json_numbert(id2string(i_it->source_location.get_line()))}};
362362
json_result.push_back(std::move(json));
363363
}
364364
else

src/goto-analyzer/unreachable_instructions.cpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,12 @@ static void add_to_json(
124124
DATA_INVARIANT(end_function->is_end_function(),
125125
"The last instruction in a goto-program must be END_FUNCTION");
126126

127-
json_objectt entry(
128-
{{"function", json_stringt(end_function->function)},
129-
{"fileName",
130-
json_stringt(concat_dir_file(
131-
id2string(end_function->source_location.get_working_directory()),
132-
id2string(end_function->source_location.get_file())))}});
127+
json_objectt entry{
128+
{"function", json_stringt(end_function->function)},
129+
{"fileName",
130+
json_stringt(concat_dir_file(
131+
id2string(end_function->source_location.get_working_directory()),
132+
id2string(end_function->source_location.get_file())))}};
133133

134134
json_arrayt &dead_ins=entry["unreachableInstructions"].make_array();
135135

@@ -152,8 +152,8 @@ static void add_to_json(
152152

153153
// print info for file actually with full path
154154
const source_locationt &l=it->second->source_location;
155-
json_objectt i_entry(
156-
{{"sourceLocation", json(l)}, {"statement", json_stringt(s)}});
155+
json_objectt i_entry{{"sourceLocation", json(l)},
156+
{"statement", json_stringt(s)}};
157157
dead_ins.push_back(std::move(i_entry));
158158
}
159159

@@ -256,14 +256,14 @@ static void json_output_function(
256256
const source_locationt &last_location,
257257
json_arrayt &dest)
258258
{
259-
json_objectt entry(
260-
{{"function", json_stringt(function)},
261-
{"file name",
262-
json_stringt(concat_dir_file(
263-
id2string(first_location.get_working_directory()),
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()))}});
259+
json_objectt entry{
260+
{"function", json_stringt(function)},
261+
{"file name",
262+
json_stringt(concat_dir_file(
263+
id2string(first_location.get_working_directory()),
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()))}};
267267

268268
dest.push_back(std::move(entry));
269269
}

src/goto-diff/goto_diff_base.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ void goto_difft::output_functions() const
3838
}
3939
case ui_message_handlert::uit::JSON_UI:
4040
{
41-
json_objectt json_result(
42-
{{"totalNumberOfFunctions",
43-
json_stringt(std::to_string(total_functions_count))}});
41+
json_objectt json_result{
42+
{"totalNumberOfFunctions",
43+
json_stringt(std::to_string(total_functions_count))}};
4444
convert_function_group_json(
4545
json_result["newFunctions"].make_array(), new_functions, goto_model2);
4646
convert_function_group_json(

src/goto-instrument/unwind.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -339,11 +339,10 @@ jsont goto_unwindt::unwind_logt::output_log_json() const
339339
goto_programt::const_targett target=it->first;
340340
unsigned location_number=it->second;
341341

342-
json_objectt object(
343-
{{"originalLocationNumber",
344-
json_numbert(std::to_string(location_number))},
345-
{"newLocationNumber",
346-
json_numbert(std::to_string(target->location_number))}});
342+
json_objectt object{
343+
{"originalLocationNumber", json_numbert(std::to_string(location_number))},
344+
{"newLocationNumber",
345+
json_numbert(std::to_string(target->location_number))}};
347346

348347
json_unwound.push_back(std::move(object));
349348
}

src/goto-programs/goto_inline_class.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -887,17 +887,17 @@ jsont goto_inlinet::goto_inline_logt::output_inline_log_json() const
887887

888888
PRECONDITION(start->location_number <= end->location_number);
889889

890-
json_arrayt json_orig(
891-
{json_numbert(std::to_string(info.begin_location_number)),
892-
json_numbert(std::to_string(info.end_location_number))});
893-
json_arrayt json_new({json_numbert(std::to_string(start->location_number)),
894-
json_numbert(std::to_string(end->location_number))});
895-
896-
json_objectt object(
897-
{{"call", json_numbert(std::to_string(info.call_location_number))},
898-
{"function", json_stringt(info.function.c_str())},
899-
{"originalSegment", std::move(json_orig)},
900-
{"inlinedSegment", std::move(json_new)}});
890+
json_arrayt json_orig{
891+
json_numbert(std::to_string(info.begin_location_number)),
892+
json_numbert(std::to_string(info.end_location_number))};
893+
json_arrayt json_new{json_numbert(std::to_string(start->location_number)),
894+
json_numbert(std::to_string(end->location_number))};
895+
896+
json_objectt object{
897+
{"call", json_numbert(std::to_string(info.call_location_number))},
898+
{"function", json_stringt(info.function.c_str())},
899+
{"originalSegment", std::move(json_orig)},
900+
{"inlinedSegment", std::move(json_new)}};
901901

902902
json_inlined.push_back(std::move(object));
903903
}

src/goto-programs/json_expr.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,8 @@ json_objectt json(const typet &type, const namespacet &ns, const irep_idt &mode)
172172
to_struct_type(type).components();
173173
for(const auto &component : components)
174174
{
175-
json_objectt e({{"name", json_stringt(component.get_name())},
176-
{"type", json(component.type(), ns, mode)}});
175+
json_objectt e{{"name", json_stringt(component.get_name())},
176+
{"type", json(component.type(), ns, mode)}};
177177
members.push_back(std::move(e));
178178
}
179179
}
@@ -185,8 +185,8 @@ json_objectt json(const typet &type, const namespacet &ns, const irep_idt &mode)
185185
to_union_type(type).components();
186186
for(const auto &component : components)
187187
{
188-
json_objectt e({{"name", json_stringt(component.get_name())},
189-
{"type", json(component.type(), ns, mode)}});
188+
json_objectt e{{"name", json_stringt(component.get_name())},
189+
{"type", json(component.type(), ns, mode)}};
190190
members.push_back(std::move(e));
191191
}
192192
}
@@ -348,8 +348,8 @@ json_objectt json(const exprt &expr, const namespacet &ns, const irep_idt &mode)
348348

349349
forall_operands(it, expr)
350350
{
351-
json_objectt e({{"index", json_numbert(std::to_string(index))},
352-
{"value", json(*it, ns, mode)}});
351+
json_objectt e{{"index", json_numbert(std::to_string(index))},
352+
{"value", json(*it, ns, mode)}};
353353
elements.push_back(std::move(e));
354354
index++;
355355
}
@@ -370,8 +370,8 @@ json_objectt json(const exprt &expr, const namespacet &ns, const irep_idt &mode)
370370
json_arrayt &members = result["members"].make_array();
371371
for(std::size_t m = 0; m < expr.operands().size(); m++)
372372
{
373-
json_objectt e({{"value", json(expr.operands()[m], ns, mode)},
374-
{"name", json_stringt(components[m].get_name())}});
373+
json_objectt e{{"value", json(expr.operands()[m], ns, mode)},
374+
{"name", json_stringt(components[m].get_name())}};
375375
members.push_back(std::move(e));
376376
}
377377
}

0 commit comments

Comments
 (0)