Skip to content

Commit 830e9ff

Browse files
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 7905492 commit 830e9ff

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, kroening@kroening.com
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++;
@@ -83,9 +80,7 @@ void show_vcc_plain(
8380
out << u8"\u2500";
8481
out << '\n';
8582

86-
std::string string_value =
87-
from_expr(ns, s_it->source.pc->function, s_it->cond_expr);
88-
out << "{" << 1 << "} " << string_value << "\n";
83+
out << '{' << 1 << "} " << format(s_it->cond_expr) << '\n';
8984
}
9085
}
9186

@@ -134,15 +129,15 @@ void show_vcc_json(
134129
(p_it->is_assume() || p_it->is_assignment() || p_it->is_constraint()) &&
135130
!p_it->ignore)
136131
{
137-
std::string string_value =
138-
from_expr(ns, p_it->source.pc->function, p_it->cond_expr);
139-
json_constraints.push_back(json_stringt(string_value));
132+
std::ostringstream string_value;
133+
string_value << format(p_it->cond_expr);
134+
json_constraints.push_back(json_stringt(string_value.str()));
140135
}
141136
}
142137

143-
std::string string_value =
144-
from_expr(ns, s_it->source.pc->function, s_it->cond_expr);
145-
object["expression"] = json_stringt(string_value);
138+
std::ostringstream string_value;
139+
string_value << format(s_it->cond_expr);
140+
object["expression"] = json_stringt(string_value.str());
146141
}
147142

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

0 commit comments

Comments
 (0)