File tree Expand file tree Collapse file tree 2 files changed +62
-7
lines changed
Expand file tree Collapse file tree 2 files changed +62
-7
lines changed Original file line number Diff line number Diff line change 1515#include < iomanip>
1616
1717#include < util/std_expr.h>
18+ #include < util/validate.h>
1819
1920#include < langapi/language_util.h>
2021
@@ -668,6 +669,62 @@ bool goto_programt::instructiont::equals(const instructiont &other) const
668669 // clang-format on
669670}
670671
672+ void goto_programt::instructiont::validate (
673+ const namespacet &ns,
674+ const validation_modet vm) const
675+ {
676+ validate_code_full_pick (code, ns, vm);
677+ validate_expr_full_pick (guard, ns, vm);
678+
679+ switch (type)
680+ {
681+ case NO_INSTRUCTION_TYPE:
682+ break ;
683+ case GOTO:
684+ break ;
685+ case ASSUME:
686+ break ;
687+ case ASSERT:
688+ break ;
689+ case OTHER:
690+ break ;
691+ case SKIP:
692+ break ;
693+ case START_THREAD:
694+ break ;
695+ case END_THREAD:
696+ break ;
697+ case LOCATION:
698+ break ;
699+ case END_FUNCTION:
700+ break ;
701+ case ATOMIC_BEGIN:
702+ break ;
703+ case ATOMIC_END:
704+ break ;
705+ case RETURN:
706+ break ;
707+ case ASSIGN:
708+ DATA_CHECK (
709+ code.get_statement () == ID_assign,
710+ " assign instruction should contain an assign statement" );
711+ DATA_CHECK (targets.empty (), " assign instruction should not have a target" );
712+ break ;
713+ case DECL:
714+ break ;
715+ case DEAD:
716+ break ;
717+ case FUNCTION_CALL:
718+ break ;
719+ case THROW:
720+ break ;
721+ case CATCH:
722+ break ;
723+ case INCOMPLETE_GOTO:
724+ break ;
725+ }
726+ }
727+
671728bool goto_programt::equals (const goto_programt &other) const
672729{
673730 if (instructions.size () != other.instructions .size ())
Original file line number Diff line number Diff line change 2020
2121#include < util/invariant.h>
2222#include < util/namespace.h>
23- #include < util/symbol_table.h>
2423#include < util/source_location.h>
25- #include < util/std_expr.h>
2624#include < util/std_code.h>
25+ #include < util/std_expr.h>
26+ #include < util/symbol_table.h>
27+
28+ enum class validation_modet ;
2729
2830// / The type of an instruction in a GOTO program.
2931enum goto_program_instruction_typet
@@ -403,11 +405,7 @@ class goto_programt
403405 // /
404406 // / The validation mode indicates whether well-formedness check failures are
405407 // / 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- }
408+ void validate (const namespacet &ns, const validation_modet vm) const ;
411409 };
412410
413411 // Never try to change this to vector-we mutate the list while iterating
You can’t perform that action at this time.
0 commit comments