@@ -15,6 +15,8 @@ Author: Daniel Kroening, kroening@kroening.com
15
15
#include " expr.h"
16
16
#include " expr_cast.h"
17
17
#include " invariant.h"
18
+ #include " validate.h"
19
+ #include " validate_code.h"
18
20
19
21
// / Data structure for representing an arbitrary statement in a program. Every
20
22
// / specific type of statement (e.g. block of statements, assignment,
@@ -59,6 +61,49 @@ class codet:public exprt
59
61
codet &last_statement ();
60
62
const codet &last_statement () const ;
61
63
class code_blockt &make_block ();
64
+
65
+ // / Check that the code statement is well-formed (shallow checks only, i.e.,
66
+ // / enclosed statements, subexpressions, etc. are not checked)
67
+ // /
68
+ // / Subclasses may override this method to provide specific well-formedness
69
+ // / checks for the corresponding types.
70
+ // /
71
+ // / The validation mode indicates whether well-formedness check failures are
72
+ // / reported via DATA_INVARIANT violations or exceptions.
73
+ void check (const validation_modet vm = validation_modet::INVARIANT) const
74
+ {
75
+ }
76
+
77
+ // / Check that the code statement is well-formed, assuming that all its
78
+ // / enclosed statements, subexpressions, etc. have all ready been checked for
79
+ // / well-formedness.
80
+ // /
81
+ // / Subclasses may override this method to provide specific well-formedness
82
+ // / checks for the corresponding types.
83
+ // /
84
+ // / The validation mode indicates whether well-formedness check failures are
85
+ // / reported via DATA_INVARIANT violations or exceptions.
86
+ void validate (
87
+ const namespacet &ns,
88
+ const validation_modet vm = validation_modet::INVARIANT) const
89
+ {
90
+ check_code_pick (*this , vm);
91
+ }
92
+
93
+ // / Check that the code statement is well-formed (full check, including checks
94
+ // / of all subexpressions)
95
+ // /
96
+ // / Subclasses may override this method to provide specific well-formedness
97
+ // / checks for the corresponding types.
98
+ // /
99
+ // / The validation mode indicates whether well-formedness check failures are
100
+ // / reported via DATA_INVARIANT violations or exceptions.
101
+ void validate_full (
102
+ const namespacet &ns,
103
+ const validation_modet vm = validation_modet::INVARIANT) const
104
+ {
105
+ check_code_pick (*this , vm);
106
+ }
62
107
};
63
108
64
109
namespace detail // NOLINT
0 commit comments