|
12 | 12 | #ifndef CPROVER_GOTO_PROGRAMS_GOTO_MODEL_H
|
13 | 13 | #define CPROVER_GOTO_PROGRAMS_GOTO_MODEL_H
|
14 | 14 |
|
15 |
| -#include <util/symbol_table.h> |
| 15 | +#include <util/base_type.h> |
16 | 16 | #include <util/journalling_symbol_table.h>
|
| 17 | +#include <util/message.h> |
| 18 | +#include <util/symbol_table.h> |
17 | 19 |
|
18 | 20 | #include "abstract_goto_model.h"
|
19 | 21 | #include "goto_functions.h"
|
@@ -95,6 +97,27 @@ class goto_modelt : public abstract_goto_modelt
|
95 | 97 | return goto_functions.function_map.find(id) !=
|
96 | 98 | goto_functions.function_map.end();
|
97 | 99 | }
|
| 100 | + |
| 101 | + /// Iterates over the functions inside the goto model and checks invariants |
| 102 | + /// in all of them. Prints out error message collected. |
| 103 | + /// \param msg message instance to collect errors |
| 104 | + /// \return true if any violation was found |
| 105 | + bool check_internal_invariants(messaget &msg) const |
| 106 | + { |
| 107 | + bool found_violation = false; |
| 108 | + namespacet ns(symbol_table); |
| 109 | + forall_goto_functions(it, goto_functions) |
| 110 | + { |
| 111 | + if(!base_type_eq( |
| 112 | + it->second.type, symbol_table.lookup_ref(it->first).type, ns)) |
| 113 | + { |
| 114 | + msg.error() << "error" << messaget::eom; |
| 115 | + found_violation = true; |
| 116 | + } |
| 117 | + } |
| 118 | + |
| 119 | + return found_violation; |
| 120 | + } |
98 | 121 | };
|
99 | 122 |
|
100 | 123 | /// Class providing the abstract GOTO model interface onto an unrelated
|
|
0 commit comments