@@ -398,6 +398,16 @@ class goto_programt
398398 // / only be evaluated in the context of a goto_programt (see
399399 // / goto_programt::equals).
400400 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+ }
401411 };
402412
403413 // Never try to change this to vector-we mutate the list while iterating
@@ -677,6 +687,18 @@ class goto_programt
677687 // / the same number of instructions, each pair of instructions compares equal,
678688 // / and relative jumps have the same distance.
679689 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+ }
680702};
681703
682704// / Get control-flow successors of a given instruction. The instruction is
0 commit comments