Skip to content

Commit 2fc12b0

Browse files
authored
Merge pull request #2977 from diffblue/show-vcc-format
--show-vcc now uses format()
2 parents a819a11 + 857797c commit 2fc12b0

File tree

2 files changed

+21
-26
lines changed

2 files changed

+21
-26
lines changed

regression/cbmc/show-vcc/test.desc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ main.c
44
^EXIT=0$
55
^SIGNAL=0$
66
^some property$
7-
^\{-.*\} a!0@1#1$
8-
^\{-.*\} b!0@1#1$
9-
^\{1\} c!0@1#1$
10-
^\{2\} d!0@1#1$
7+
^\{-.*\} main::1::a!0@1#1$
8+
^\{-.*\} main::1::b!0@1#1$
9+
^\{1\} main::1::c!0@1#1$
10+
^\{2\} main::1::d!0@1#1$
1111
--

src/goto-symex/show_vcc.cpp

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@ Author: Daniel Kroening, [email protected]
1010
/// Output of the verification conditions (VCCs)
1111

1212
#include "show_vcc.h"
13+
#include "symex_target_equation.h"
1314

1415
#include <fstream>
1516
#include <iostream>
17+
#include <sstream>
1618

1719
#include <goto-symex/symex_target_equation.h>
1820

19-
#include <langapi/language_util.h>
20-
#include <langapi/mode.h>
21-
2221
#include <util/exception_utils.h>
22+
#include <util/format_expr.h>
2323
#include <util/json.h>
2424
#include <util/json_expr.h>
2525
#include <util/ui_message.h>
@@ -46,10 +46,10 @@ void show_vcc_plain(
4646
out << '\n';
4747

4848
if(s_it->source.pc->source_location.is_not_nil())
49-
out << s_it->source.pc->source_location << "\n";
49+
out << s_it->source.pc->source_location << '\n';
5050

5151
if(s_it->comment != "")
52-
out << s_it->comment << "\n";
52+
out << s_it->comment << '\n';
5353

5454
symex_target_equationt::SSA_stepst::const_iterator p_it =
5555
equation.SSA_steps.begin();
@@ -63,14 +63,11 @@ void show_vcc_plain(
6363
{
6464
if(!p_it->ignore)
6565
{
66-
std::string string_value =
67-
from_expr(ns, p_it->source.pc->function, p_it->cond_expr);
68-
out << "{-" << count << "} " << string_value << "\n";
69-
70-
#if 0
71-
languages.from_expr(p_it->guard_expr, string_value);
72-
out << "GUARD: " << string_value << "\n";
73-
out << "\n";
66+
out << "{-" << count << "} " << format(p_it->cond_expr) << '\n';
67+
68+
#ifdef DEBUG
69+
out << "GUARD: " << format(p_it->guard) << '\n';
70+
out << '\n';
7471
#endif
7572

7673
count++;
@@ -94,9 +91,7 @@ void show_vcc_plain(
9491
std::size_t count = 1;
9592
for(const auto &disjunct : disjuncts)
9693
{
97-
std::string string_value =
98-
from_expr(ns, s_it->source.pc->function, disjunct);
99-
out << "{" << count << "} " << string_value << "\n";
94+
out << '{' << count << "} " << format(disjunct) << '\n';
10095
count++;
10196
}
10297
}
@@ -147,15 +142,15 @@ void show_vcc_json(
147142
(p_it->is_assume() || p_it->is_assignment() || p_it->is_constraint()) &&
148143
!p_it->ignore)
149144
{
150-
std::string string_value =
151-
from_expr(ns, p_it->source.pc->function, p_it->cond_expr);
152-
json_constraints.push_back(json_stringt(string_value));
145+
std::ostringstream string_value;
146+
string_value << format(p_it->cond_expr);
147+
json_constraints.push_back(json_stringt(string_value.str()));
153148
}
154149
}
155150

156-
std::string string_value =
157-
from_expr(ns, s_it->source.pc->function, s_it->cond_expr);
158-
object["expression"] = json_stringt(string_value);
151+
std::ostringstream string_value;
152+
string_value << format(s_it->cond_expr);
153+
object["expression"] = json_stringt(string_value.str());
159154
}
160155

161156
out << ",\n" << json_result;

0 commit comments

Comments
 (0)