Skip to content

Commit c38bd43

Browse files
author
Daniel Kroening
committed
show-vcc now uses format()
This outputs the verification conditions in 'first order logic syntax', as opposed to syntax used by a programming language, which may cause confusion.
1 parent ced655b commit c38bd43

File tree

1 file changed

+13
-18
lines changed

1 file changed

+13
-18
lines changed

src/goto-symex/show_vcc.cpp

Lines changed: 13 additions & 18 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>
@@ -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";
66+
out << "{-" << count << "} " << format(p_it->cond_expr) << '\n';
6967

7068
#if 0
71-
languages.from_expr(p_it->guard_expr, string_value);
72-
out << "GUARD: " << string_value << "\n";
73-
out << "\n";
69+
out << "GUARD: " << format(p_it->guard_expr) << '\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)