Skip to content

Commit 0315816

Browse files
authored
Merge pull request #2180 from thomasspriggs/json_id2string
Remove `id2string` from inside calls to the `json_stringt` constructor.
2 parents 8941567 + b6a4382 commit 0315816

File tree

11 files changed

+48
-53
lines changed

11 files changed

+48
-53
lines changed

src/cbmc/all_properties.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,8 @@ void bmc_all_propertiest::report(const cover_goalst &cover_goals)
214214
for(const auto &g : goal_map)
215215
{
216216
json_stream_objectt &result = result_array.push_back_stream_object();
217-
result["property"]=json_stringt(id2string(g.first));
218-
result["description"]=json_stringt(id2string(g.second.description));
217+
result["property"] = json_stringt(g.first);
218+
result["description"] = json_stringt(g.second.description);
219219
result["status"]=json_stringt(g.second.status_string());
220220

221221
if(g.second.status==goalt::statust::FAILURE)

src/cbmc/bmc.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,10 @@ void bmct::error_trace()
7474
json_stream_objectt &json_result =
7575
status().json_stream().push_back_stream_object();
7676
const goto_trace_stept &step=goto_trace.steps.back();
77-
json_result["property"]=
78-
json_stringt(id2string(step.pc->source_location.get_property_id()));
79-
json_result["description"]=
80-
json_stringt(id2string(step.pc->source_location.get_comment()));
77+
json_result["property"] =
78+
json_stringt(step.pc->source_location.get_property_id());
79+
json_result["description"] =
80+
json_stringt(step.pc->source_location.get_comment());
8181
json_result["status"]=json_stringt("failed");
8282
json_stream_arrayt &json_trace =
8383
json_result.push_back_stream_array("trace");

src/cbmc/bmc_cover.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ bool bmc_covert::operator()()
355355

356356
json_result["status"] =
357357
json_stringt(goal.satisfied ? "satisfied" : "failed");
358-
json_result["goal"] = json_stringt(id2string(goal_pair.first));
358+
json_result["goal"] = json_stringt(goal_pair.first);
359359
json_result["description"] = json_stringt(goal.description);
360360

361361
if(goal.source_location.is_not_nil())
@@ -382,7 +382,7 @@ bool bmc_covert::operator()()
382382
if(step.is_input())
383383
{
384384
json_objectt json_input;
385-
json_input["id"]=json_stringt(id2string(step.io_id));
385+
json_input["id"] = json_stringt(step.io_id);
386386
if(step.io_args.size()==1)
387387
json_input["value"]=
388388
json(step.io_args.front(), bmc.ns, ID_unknown);
@@ -393,7 +393,7 @@ bool bmc_covert::operator()()
393393
json_arrayt &goal_refs=result["coveredGoals"].make_array();
394394
for(const auto &goal_id : test.covered_goals)
395395
{
396-
goal_refs.push_back(json_stringt(id2string(goal_id)));
396+
goal_refs.push_back(json_stringt(goal_id));
397397
}
398398
}
399399

src/goto-analyzer/static_analyzer.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,9 @@ void static_analyzert::json_report(const std::string &file_name)
153153
else
154154
j["status"]=json_stringt("UNKNOWN");
155155

156-
j["file"]=json_stringt(id2string(i_it->source_location.get_file()));
156+
j["file"] = json_stringt(i_it->source_location.get_file());
157157
j["line"]=json_numbert(id2string(i_it->source_location.get_line()));
158-
j["description"]=json_stringt(id2string(
159-
i_it->source_location.get_comment()));
158+
j["description"] = json_stringt(i_it->source_location.get_comment());
160159
}
161160
}
162161

src/goto-analyzer/taint_analysis.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -351,10 +351,9 @@ bool taint_analysist::operator()(
351351
if(use_json)
352352
{
353353
json_objectt json;
354-
json["bugClass"]=
355-
json_stringt(id2string(i_it->source_location.get_property_class()));
356-
json["file"]=
357-
json_stringt(id2string(i_it->source_location.get_file()));
354+
json["bugClass"] =
355+
json_stringt(i_it->source_location.get_property_class());
356+
json["file"] = json_stringt(i_it->source_location.get_file());
358357
json["line"]=
359358
json_numbert(id2string(i_it->source_location.get_line()));
360359
json_result.array.push_back(json);

src/goto-analyzer/unreachable_instructions.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ static void add_to_json(
127127
DATA_INVARIANT(end_function->is_end_function(),
128128
"The last instruction in a goto-program must be END_FUNCTION");
129129

130-
entry["function"]=json_stringt(id2string(end_function->function));
130+
entry["function"] = json_stringt(end_function->function);
131131
entry["fileName"]=
132132
json_stringt(concat_dir_file(
133133
id2string(end_function->source_location.get_working_directory()),
@@ -261,7 +261,7 @@ static void json_output_function(
261261
{
262262
json_objectt &entry=dest.push_back().make_object();
263263

264-
entry["function"]=json_stringt(id2string(function));
264+
entry["function"] = json_stringt(function);
265265
entry["file name"]=
266266
json_stringt(concat_dir_file(
267267
id2string(first_location.get_working_directory()),

src/goto-diff/goto_diff_base.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ void goto_difft::convert_function_json(
136136
namespacet ns(goto_model.symbol_table);
137137
const symbolt &symbol = ns.lookup(function_name);
138138

139-
result["name"] = json_stringt(id2string(function_name));
139+
result["name"] = json_stringt(function_name);
140140
result["sourceLocation"] = json(symbol.location);
141141

142142
if(options.get_bool_option("show-properties"))

src/goto-programs/json_goto_trace.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ void convert_assert(
5252
json_failure["hidden"] = jsont::json_boolean(step.hidden);
5353
json_failure["internal"] = jsont::json_boolean(step.internal);
5454
json_failure["thread"] = json_numbert(std::to_string(step.thread_nr));
55-
json_failure["reason"] = json_stringt(id2string(step.comment));
56-
json_failure["property"] = json_stringt(id2string(property_id));
55+
json_failure["reason"] = json_stringt(step.comment);
56+
json_failure["property"] = json_stringt(property_id);
5757

5858
if(!location.is_null())
5959
json_failure["sourceLocation"] = location;
@@ -133,7 +133,7 @@ void convert_decl(
133133
if(type_string == "")
134134
type_string = from_type(ns, identifier, symbol->type);
135135

136-
json_assignment["mode"] = json_stringt(id2string(symbol->mode));
136+
json_assignment["mode"] = json_stringt(symbol->mode);
137137
exprt simplified = simplify_expr(step.full_lhs_value, ns);
138138

139139
full_lhs_value = json(simplified, ns, symbol->mode);
@@ -183,7 +183,7 @@ void convert_output(
183183
json_output["hidden"] = jsont::json_boolean(step.hidden);
184184
json_output["internal"] = jsont::json_boolean(step.internal);
185185
json_output["thread"] = json_numbert(std::to_string(step.thread_nr));
186-
json_output["outputID"] = json_stringt(id2string(step.io_id));
186+
json_output["outputID"] = json_stringt(step.io_id);
187187

188188
// Recovering the mode from the function
189189
irep_idt mode;
@@ -193,7 +193,7 @@ void convert_output(
193193
mode = ID_unknown;
194194
else
195195
mode = function_name->mode;
196-
json_output["mode"] = json_stringt(id2string(mode));
196+
json_output["mode"] = json_stringt(mode);
197197
json_arrayt &json_values = json_output["values"].make_array();
198198

199199
for(const auto &arg : step.io_args)
@@ -226,7 +226,7 @@ void convert_input(
226226
json_input["hidden"] = jsont::json_boolean(step.hidden);
227227
json_input["internal"] = jsont::json_boolean(step.internal);
228228
json_input["thread"] = json_numbert(std::to_string(step.thread_nr));
229-
json_input["inputID"] = json_stringt(id2string(step.io_id));
229+
json_input["inputID"] = json_stringt(step.io_id);
230230

231231
// Recovering the mode from the function
232232
irep_idt mode;
@@ -236,7 +236,7 @@ void convert_input(
236236
mode = ID_unknown;
237237
else
238238
mode = function_name->mode;
239-
json_input["mode"] = json_stringt(id2string(mode));
239+
json_input["mode"] = json_stringt(mode);
240240
json_arrayt &json_values = json_input["values"].make_array();
241241

242242
for(const auto &arg : step.io_args)
@@ -275,8 +275,8 @@ void convert_return(
275275

276276
const symbolt &symbol = ns.lookup(step.identifier);
277277
json_objectt &json_function = json_call_return["function"].make_object();
278-
json_function["displayName"] = json_stringt(id2string(symbol.display_name()));
279-
json_function["identifier"] = json_stringt(id2string(step.identifier));
278+
json_function["displayName"] = json_stringt(symbol.display_name());
279+
json_function["identifier"] = json_stringt(step.identifier);
280280
json_function["sourceLocation"] = json(symbol.location);
281281

282282
if(!location.is_null())

src/goto-programs/show_goto_functions_json.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ json_objectt show_goto_functions_jsont::convert(
4848

4949
json_objectt &json_function=
5050
json_functions.push_back(jsont()).make_object();
51-
json_function["name"]=json_stringt(id2string(function_name));
51+
json_function["name"] = json_stringt(function_name);
5252
json_function["isBodyAvailable"]=
5353
jsont::json_boolean(function.body_available());
5454
bool is_internal=

src/goto-programs/show_properties.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,14 +131,13 @@ void convert_properties_json(
131131

132132
json_objectt &json_property=
133133
json_properties.push_back(jsont()).make_object();
134-
json_property["name"]=json_stringt(id2string(property_id));
135-
json_property["class"]=json_stringt(id2string(property_class));
134+
json_property["name"] = json_stringt(property_id);
135+
json_property["class"] = json_stringt(property_class);
136136
if(!source_location.get_basic_block_covered_lines().empty())
137-
json_property["coveredLines"]=
138-
json_stringt(
139-
id2string(source_location.get_basic_block_covered_lines()));
137+
json_property["coveredLines"] =
138+
json_stringt(source_location.get_basic_block_covered_lines());
140139
json_property["sourceLocation"]=json(source_location);
141-
json_property["description"]=json_stringt(id2string(description));
140+
json_property["description"] = json_stringt(description);
142141
json_property["expression"]=
143142
json_stringt(from_expr(ns, identifier, ins.guard));
144143
}

0 commit comments

Comments
 (0)