|
11 | 11 |
|
12 | 12 | #include "goto_program.h" |
13 | 13 |
|
14 | | -#include <ostream> |
| 14 | +#include <algorithm> |
15 | 15 | #include <iomanip> |
| 16 | +#include <ostream> |
16 | 17 |
|
| 18 | +#include <util/expr_iterator.h> |
17 | 19 | #include <util/find_symbols.h> |
18 | 20 | #include <util/std_expr.h> |
19 | 21 | #include <util/validate.h> |
@@ -685,11 +687,18 @@ void goto_programt::instructiont::validate( |
685 | 687 | source_location); |
686 | 688 |
|
687 | 689 | auto expr_symbol_finder = [&](const exprt &e) { |
688 | | - forall_subtypes(it, e.type()) |
| 690 | + find_symbols_sett typetags; |
| 691 | + find_type_symbols(e.type(), typetags); |
| 692 | + find_symbols(e, typetags); |
| 693 | + const symbolt *symbol; |
| 694 | + for(const auto &identifier : typetags) |
689 | 695 | { |
690 | | - find_typetag_in_namespace(*it, source_location, ns, vm); |
| 696 | + DATA_CHECK_WITH_DIAGNOSTICS( |
| 697 | + vm, |
| 698 | + !ns.lookup(identifier, symbol), |
| 699 | + id2string(identifier) + " not found", |
| 700 | + source_location); |
691 | 701 | } |
692 | | - find_symbol_in_namespace(e, source_location, ns, vm); |
693 | 702 | }; |
694 | 703 |
|
695 | 704 | auto ¤t_source_location = source_location; |
@@ -742,8 +751,8 @@ void goto_programt::instructiont::validate( |
742 | 751 | "assert instruction should not have a target", |
743 | 752 | source_location); |
744 | 753 |
|
745 | | - guard.visit(expr_symbol_finder); |
746 | | - guard.visit(type_finder); |
| 754 | + std::for_each(guard.depth_begin(), guard.depth_end(), expr_symbol_finder); |
| 755 | + std::for_each(guard.depth_begin(), guard.depth_end(), type_finder); |
747 | 756 | break; |
748 | 757 | case OTHER: |
749 | 758 | break; |
@@ -809,8 +818,8 @@ void goto_programt::instructiont::validate( |
809 | 818 | "function call instruction should contain a call statement", |
810 | 819 | source_location); |
811 | 820 |
|
812 | | - code.visit(expr_symbol_finder); |
813 | | - code.visit(type_finder); |
| 821 | + std::for_each(code.depth_begin(), code.depth_end(), expr_symbol_finder); |
| 822 | + std::for_each(code.depth_begin(), code.depth_end(), type_finder); |
814 | 823 | break; |
815 | 824 | case THROW: |
816 | 825 | break; |
|
0 commit comments