Skip to content

Commit 62ea911

Browse files
author
Owen Jones
committed
Address review comments
1 parent 105e297 commit 62ea911

File tree

2 files changed

+34
-34
lines changed

2 files changed

+34
-34
lines changed

src/util/dstring.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Author: Daniel Kroening, kroening@kroening.com
2525
/// saves space.
2626
///
2727
/// `irep_idt` and `irep_namet` are typedef-ed to `dstringt` in irep.h unless
28+
/// `USE_STD_STRING` is set.
2829
///
2930
///
3031
/// Note: Marked final to disable inheritance. No virtual destructor, so

src/util/irep.h

Lines changed: 33 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -88,31 +88,36 @@ const irept &get_nil_irep();
8888
/// CPROVER. `irept` provides a single, unified representation for all of
8989
/// these, allowing structure sharing and reference counting of data. As
9090
/// such `irept` is the basic unit of data in CPROVER. Each `irept`
91-
/// contains[^1] a basic unit of data (of type `dt`) which contains four
92-
/// things:
91+
/// contains (or references, if reference counted data sharing is enabled, as
92+
/// it is by default - see the `SHARING` macro) a basic unit of data (of type
93+
/// `dt`) which contains four things:
9394
///
94-
/// * `data`: A string[^2], which is returned when the `id()` function is
95-
/// used.
95+
/// * `data`: A string, which is returned when the `id()` function is used.
96+
/// (Unless `USE_STD_STRING` is set, this is actually a `dstring` and thus
97+
/// an integer which is a reference into a string table.)
9698
///
9799
/// * `named_sub`: A map from `irep_namet` (a string) to `irept`. This
98100
/// is used for named children, i.e. subexpressions, parameters, etc.
99101
///
100102
/// * `comments`: Another map from `irep_namet` to `irept` which is used
101-
/// for annotations and other ‘non-semantic’ information
103+
/// for annotations and other ‘non-semantic’ information. Note that this
104+
/// map is ignore by the default `operator==`.
102105
///
103106
/// * `sub`: A vector of `irept` which is used to store ordered but
104107
/// unnamed children.
105108
///
106-
/// The `irept::pretty` function outputs the contents of an `irept` directly
107-
/// and can be used to understand and debug problems with `irept`s.
109+
/// The `irept::pretty` function outputs the explicit tree structure of
110+
/// an `irept` and can be used to understand and debug problems with
111+
/// `irept`s.
108112
///
109-
/// On their own `irept`s do not mean anything; they are effectively
113+
/// On their own `irept`s do not "mean" anything; they are effectively
110114
/// generic tree nodes. Their interpretation depends on the contents of
111-
/// result of the `id` function (the `data`) field. `util/irep_ids.txt`
112-
/// contains the complete list of `id` values. During the build process it
113-
/// is used to generate `util/irep_ids.h` which gives constants for each id
114-
/// (named `ID_`). These can then be used to identify what kind of data
115-
/// `irept` stores and thus what can be done with it.
115+
/// result of the `id` function (the `data`) field. `util/irep_ids.def`
116+
/// contains a list of `id` values. During the build process it is used
117+
/// to generate `util/irep_ids.h` which gives constants for each id
118+
/// (named `ID_`). You can also make `irep_id`s which do not come from
119+
/// `util/irep_ids.def`. An `irep_id`can then be used to identify what
120+
/// kind of data `irept` stores and thus what can be done with it.
116121
///
117122
/// To simplify this process, there are a variety of classes that inherit
118123
/// from `irept`, roughly corresponding to the ids listed (i.e. `ID_or`
@@ -130,29 +135,23 @@ const irept &get_nil_irep();
130135
/// with the architecture of the code.
131136
///
132137
/// Many of the key descendant of `exprt` are declared in `std_expr.h`. All
133-
/// expressions have a named subfield / annotation which gives the type of
134-
/// the expression (slightly simplified from C/C++ as `unsignedbv_typet`,
135-
/// `signedbv_typet`, `floatbv_typet`, etc.). All type conversions are
136-
/// explicit with an expression with `id() == ID_typecast` and an ‘interface
137-
/// class’ named `typecast_exprt`. One key descendant of `exprt` is
138-
/// `symbol_exprt` which creates `irept` instances with the id of “symbol”.
139-
/// These are used to represent variables; the name of which can be found
140-
/// using the `get_identifier` accessor function.
138+
/// expressions have a named subexpresion with ID `type`, which gives the
139+
/// type of the expression (slightly simplified from C/C++ as
140+
/// `unsignedbv_typet`, `signedbv_typet`, `floatbv_typet`, etc.). All type
141+
/// conversions are explicit with an expression with `id() == ID_typecast`
142+
/// and a `typecast_exprt`. One key descendant of `exprt` is `symbol_exprt`
143+
/// which creates `irept` instances with the id of “symbol”. These are used
144+
/// to represent variables; the name of which can be found using the
145+
/// `get_identifier` accessor function.
141146
///
142147
/// `codet` inherits from `exprt` and is defined in `std_code.h`. It
143-
/// represents executable code; statements in C rather than expressions. In
144-
/// the front-end there are versions of these that hold whole code blocks,
145-
/// but in goto-programs these have been flattened so that each `irept`
146-
/// represents one sequence point (almost one line of code / one
147-
/// semi-colon). The most common descendants of `codet` are `code_assignt`
148-
/// so a common pattern is to cast the `codet` to an assignment and then
149-
/// recurse on the expression on either side.
150-
///
151-
/// [^1]: Or references, if reference counted data sharing is enabled. It is
152-
/// enabled by default; see the `SHARING` macro.
153-
///
154-
/// [^2]: Unless `USE_STD_STRING` is set, this is actually
155-
/// a `dstring` and thus an integer which is a reference into a string table
148+
/// represents executable code; statements in a C-like language rather than
149+
/// expressions. In the front-end there are versions of these that hold
150+
/// whole code blocks, but in goto-programs these have been flattened so
151+
/// that each `irept` represents one sequence point (almost one line of
152+
/// code / one semi-colon). The most common descendant of `codet` is
153+
/// `code_assignt` so a common pattern is to cast the `codet` to an
154+
/// assignment and then recurse on the expression on either side.
156155
class irept
157156
{
158157
public:

0 commit comments

Comments
 (0)