Skip to content

Commit 24eafa4

Browse files
committed
Make ui_message_handlert the only class to provide a json_stream
It always was the only place that had one, but various other APIs claimed they did so as well.
1 parent 4e9e135 commit 24eafa4

File tree

6 files changed

+6
-19
lines changed

6 files changed

+6
-19
lines changed

src/cbmc/all_properties.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ void bmc_all_propertiest::report(const cover_goalst &cover_goals)
207207
case ui_message_handlert::uit::JSON_UI:
208208
{
209209
json_stream_objectt &json_result =
210-
result().json_stream().push_back_stream_object();
210+
bmc.ui_message_handler.get_json_stream().push_back_stream_object();
211211
json_stream_arrayt &result_array =
212212
json_result.push_back_stream_array("result");
213213

src/cbmc/bmc.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ void bmct::error_trace()
7070
case ui_message_handlert::uit::JSON_UI:
7171
{
7272
json_stream_objectt &json_result =
73-
status().json_stream().push_back_stream_object();
73+
ui_message_handler.get_json_stream().push_back_stream_object();
7474
const goto_trace_stept &step=goto_trace.steps.back();
7575
json_result["property"] =
7676
json_stringt(step.pc->source_location.get_property_id());

src/cbmc/bmc_cover.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ bool bmc_covert::operator()()
348348
case ui_message_handlert::uit::JSON_UI:
349349
{
350350
json_stream_objectt &json_result =
351-
status().json_stream().push_back_stream_object();
351+
bmc.ui_message_handler.get_json_stream().push_back_stream_object();
352352
for(const auto &goal_pair : goal_map)
353353
{
354354
const goalt &goal=goal_pair.second;

src/goto-programs/class_hierarchy.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ void show_class_hierarchy(
206206
msg.result() << messaget::eom;
207207
break;
208208
case ui_message_handlert::uit::JSON_UI:
209-
hierarchy.output(msg.result().json_stream(), children_only);
209+
hierarchy.output(message_handler.get_json_stream(), children_only);
210210
break;
211211
case ui_message_handlert::uit::XML_UI:
212212
UNIMPLEMENTED;

src/util/message.h

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,6 @@ class message_handlert
3636
// no-op by default
3737
}
3838

39-
/// Return the underlying JSON stream
40-
virtual json_stream_arrayt &get_json_stream()
41-
{
42-
UNREACHABLE;
43-
}
44-
4539
virtual void print(unsigned level, const jsont &json)
4640
{
4741
// no-op by default
@@ -248,14 +242,6 @@ class messaget
248242
return func(*this);
249243
}
250244

251-
/// Returns a reference to the top-level JSON array stream
252-
json_stream_arrayt &json_stream()
253-
{
254-
if(this->tellp() > 0)
255-
*this << eom; // force end of previous message
256-
return message.message_handler->get_json_stream();
257-
}
258-
259245
private:
260246
void assign_from(const mstreamt &other)
261247
{

src/util/ui_message.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ class ui_message_handlert : public message_handlert
5151

5252
virtual void flush(unsigned level) override;
5353

54-
json_stream_arrayt &get_json_stream() override
54+
/// Return the underlying JSON stream
55+
json_stream_arrayt &get_json_stream()
5556
{
5657
PRECONDITION(json_stream!=nullptr);
5758
return *json_stream;

0 commit comments

Comments
 (0)