Skip to content

Commit 145603c

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 7de9df8 commit 145603c

File tree

1 file changed

+15
-22
lines changed

1 file changed

+15
-22
lines changed

src/goto-symex/show_vcc.cpp

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,13 @@ 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

17-
#include <goto-symex/symex_target_equation.h>
18-
19-
#include <langapi/language_util.h>
20-
#include <langapi/mode.h>
21-
19+
#include <util/format_expr.h>
2220
#include <util/json.h>
2321
#include <util/json_expr.h>
2422
#include <util/ui_message.h>
@@ -45,10 +43,10 @@ void show_vcc_plain(
4543
out << '\n';
4644

4745
if(s_it->source.pc->source_location.is_not_nil())
48-
out << s_it->source.pc->source_location << "\n";
46+
out << s_it->source.pc->source_location << '\n';
4947

5048
if(s_it->comment != "")
51-
out << s_it->comment << "\n";
49+
out << s_it->comment << '\n';
5250

5351
symex_target_equationt::SSA_stepst::const_iterator p_it =
5452
equation.SSA_steps.begin();
@@ -62,14 +60,11 @@ void show_vcc_plain(
6260
{
6361
if(!p_it->ignore)
6462
{
65-
std::string string_value =
66-
from_expr(ns, p_it->source.pc->function, p_it->cond_expr);
67-
out << "{-" << count << "} " << string_value << "\n";
63+
out << "{-" << count << "} " << format(p_it->cond_expr) << '\n';
6864

6965
#if 0
70-
languages.from_expr(p_it->guard_expr, string_value);
71-
out << "GUARD: " << string_value << "\n";
72-
out << "\n";
66+
out << "GUARD: " << format(p_it->guard_expr) << '\n';
67+
out << '\n';
7368
#endif
7469

7570
count++;
@@ -82,9 +77,7 @@ void show_vcc_plain(
8277
out << u8"\u2500";
8378
out << '\n';
8479

85-
std::string string_value =
86-
from_expr(ns, s_it->source.pc->function, s_it->cond_expr);
87-
out << "{" << 1 << "} " << string_value << "\n";
80+
out << '{' << 1 << "} " << format(s_it->cond_expr) << '\n';
8881
}
8982
}
9083

@@ -133,15 +126,15 @@ void show_vcc_json(
133126
(p_it->is_assume() || p_it->is_assignment() || p_it->is_constraint()) &&
134127
!p_it->ignore)
135128
{
136-
std::string string_value =
137-
from_expr(ns, p_it->source.pc->function, p_it->cond_expr);
138-
json_constraints.push_back(json_stringt(string_value));
129+
std::ostringstream string_value;
130+
string_value << format(p_it->cond_expr);
131+
json_constraints.push_back(json_stringt(string_value.str()));
139132
}
140133
}
141134

142-
std::string string_value =
143-
from_expr(ns, s_it->source.pc->function, s_it->cond_expr);
144-
object["expression"] = json_stringt(string_value);
135+
std::ostringstream string_value;
136+
string_value << format(s_it->cond_expr);
137+
object["expression"] = json_stringt(string_value.str());
145138
}
146139

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

0 commit comments

Comments
 (0)