Skip to content

--show-vcc now uses format() #2977

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions regression/cbmc/show-vcc/test.desc
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ main.c
^EXIT=0$
^SIGNAL=0$
^some property$
^\{-.*\} a!0@1#1$
^\{-.*\} b!0@1#1$
^\{1\} c!0@1#1$
^\{2\} d!0@1#1$
^\{-.*\} main::1::a!0@1#1$
^\{-.*\} main::1::b!0@1#1$
^\{1\} main::1::c!0@1#1$
^\{2\} main::1::d!0@1#1$
--
39 changes: 17 additions & 22 deletions src/goto-symex/show_vcc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ Author: Daniel Kroening, [email protected]
/// Output of the verification conditions (VCCs)

#include "show_vcc.h"
#include "symex_target_equation.h"

#include <fstream>
#include <iostream>
#include <sstream>

#include <goto-symex/symex_target_equation.h>

#include <langapi/language_util.h>
#include <langapi/mode.h>

#include <util/exception_utils.h>
#include <util/format_expr.h>
#include <util/json.h>
#include <util/json_expr.h>
#include <util/ui_message.h>
Expand All @@ -46,10 +46,10 @@ void show_vcc_plain(
out << '\n';

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

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

symex_target_equationt::SSA_stepst::const_iterator p_it =
equation.SSA_steps.begin();
Expand All @@ -63,14 +63,11 @@ void show_vcc_plain(
{
if(!p_it->ignore)
{
std::string string_value =
from_expr(ns, p_it->source.pc->function, p_it->cond_expr);
out << "{-" << count << "} " << string_value << "\n";

#if 0
languages.from_expr(p_it->guard_expr, string_value);
out << "GUARD: " << string_value << "\n";
out << "\n";
out << "{-" << count << "} " << format(p_it->cond_expr) << '\n';

#ifdef DEBUG
out << "GUARD: " << format(p_it->guard) << '\n';
out << '\n';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there actually value in this? If there is, then it should likely be guarded by #ifdef DEBUG instead of #if 0

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok

#endif

count++;
Expand All @@ -94,9 +91,7 @@ void show_vcc_plain(
std::size_t count = 1;
for(const auto &disjunct : disjuncts)
{
std::string string_value =
from_expr(ns, s_it->source.pc->function, disjunct);
out << "{" << count << "} " << string_value << "\n";
out << '{' << count << "} " << format(disjunct) << '\n';
count++;
}
}
Expand Down Expand Up @@ -147,15 +142,15 @@ void show_vcc_json(
(p_it->is_assume() || p_it->is_assignment() || p_it->is_constraint()) &&
!p_it->ignore)
{
std::string string_value =
from_expr(ns, p_it->source.pc->function, p_it->cond_expr);
json_constraints.push_back(json_stringt(string_value));
std::ostringstream string_value;
string_value << format(p_it->cond_expr);
json_constraints.push_back(json_stringt(string_value.str()));
}
}

std::string string_value =
from_expr(ns, s_it->source.pc->function, s_it->cond_expr);
object["expression"] = json_stringt(string_value);
std::ostringstream string_value;
string_value << format(s_it->cond_expr);
object["expression"] = json_stringt(string_value.str());
}

out << ",\n" << json_result;
Expand Down