@@ -398,6 +398,16 @@ class goto_programt
398
398
// / only be evaluated in the context of a goto_programt (see
399
399
// / goto_programt::equals).
400
400
bool equals (const instructiont &other) const ;
401
+
402
+ // / Check that the instruction is well-formed
403
+ // /
404
+ // / The validation mode indicates whether well-formedness check failures are
405
+ // / reported via DATA_INVARIANT violations or exceptions.
406
+ void validate (const namespacet &ns, const validation_modet vm) const
407
+ {
408
+ validate_code_full_pick (code, ns, vm);
409
+ validate_expr_full_pick (guard, ns, vm);
410
+ }
401
411
};
402
412
403
413
// Never try to change this to vector-we mutate the list while iterating
@@ -677,6 +687,18 @@ class goto_programt
677
687
// / the same number of instructions, each pair of instructions compares equal,
678
688
// / and relative jumps have the same distance.
679
689
bool equals (const goto_programt &other) const ;
690
+
691
+ // / Check that the goto program is well-formed
692
+ // /
693
+ // / The validation mode indicates whether well-formedness check failures are
694
+ // / reported via DATA_INVARIANT violations or exceptions.
695
+ void validate (const namespacet &ns, const validation_modet vm) const
696
+ {
697
+ for (const instructiont &ins : instructions)
698
+ {
699
+ ins.validate (ns, vm);
700
+ }
701
+ }
680
702
};
681
703
682
704
// / Get control-flow successors of a given instruction. The instruction is
0 commit comments