Skip to content

Commit 7d71afd

Browse files
authored
Merge pull request #4078 from romainbrenguier/doc/show-program
Document show_program and show_vcc functions [DOC-144]
2 parents 13644d9 + b2c938c commit 7d71afd

File tree

3 files changed

+29
-6
lines changed

3 files changed

+29
-6
lines changed

src/goto-symex/show_program.h

+8
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@ Author: Daniel Kroening, [email protected]
1515
class namespacet;
1616
class symex_target_equationt;
1717

18+
/// Print the steps of \p equation on the standard output.
19+
///
20+
/// For each step, prints the location, then if the step is an assignment,
21+
/// assertion, assume, constraint, shared read or shared write:
22+
/// prints an instruction counter, followed by the instruction type, and the
23+
/// current guard if it is not equal to true.
24+
/// \param ns: namespace
25+
/// \param equation: SSA form of the program
1826
void show_program(const namespacet &ns, const symex_target_equationt &equation);
1927

2028
#endif // CPROVER_GOTO_SYMEX_SHOW_PROGRAM_H

src/goto-symex/show_vcc.cpp

+15-6
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,11 @@ Author: Daniel Kroening, [email protected]
2323
#include <util/json_irep.h>
2424
#include <util/ui_message.h>
2525

26-
void show_vcc_plain(
27-
messaget::mstreamt &out,
28-
const symex_target_equationt &equation)
26+
/// Output equations from \p equation in plain text format to the given output
27+
/// stream \p out.
28+
/// Each equation is prefixed by a negative index, formatted `{-N}`
29+
static void
30+
show_vcc_plain(messaget::mstreamt &out, const symex_target_equationt &equation)
2931
{
3032
bool has_threads = equation.has_threads();
3133
bool first = true;
@@ -99,9 +101,16 @@ void show_vcc_plain(
99101
}
100102
}
101103

102-
void show_vcc_json(
103-
std::ostream &out,
104-
const symex_target_equationt &equation)
104+
/// Output equations from \p equation in the JSON format to the given output
105+
/// stream \p out.
106+
/// The format is an array `vccs`, containing fields:
107+
/// - constraints, which is an array containing the constraints which apply
108+
/// to that equation
109+
/// - expression, a string containing the formatted expression
110+
/// - sourceLocation (optional), the corresponding location in the program
111+
/// - comment (optional)
112+
static void
113+
show_vcc_json(std::ostream &out, const symex_target_equationt &equation)
105114
{
106115
json_objectt json_result;
107116

src/goto-symex/show_vcc.h

+6
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ Author: Daniel Kroening, [email protected]
1717
class optionst;
1818
class symex_target_equationt;
1919

20+
/// Output equations from \p equation to a file or to the standard output.
21+
/// The name of the output file is given by the `outfile` option from
22+
/// \p options, the standard input is used if it is not provided.
23+
/// The format is either JSON or plain text depending on \p ui_message_handler;
24+
/// XML is not supported.
25+
/// See \link show_vcc_json \endlink and \link show_vcc_plain \endlink
2026
void show_vcc(
2127
const optionst &options,
2228
ui_message_handlert &ui_message_handler,

0 commit comments

Comments
 (0)