Skip to content

Commit c203ef2

Browse files
committed
Lazy goto model: support validation
This mirrors existing support in goto_modelt.
1 parent eda5f14 commit c203ef2

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

src/goto-programs/abstract_goto_model.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ class abstract_goto_modelt
4949
/// underneath them, so this should only be used to lend a reference to code
5050
/// that cannot also call get_goto_function.
5151
virtual const symbol_tablet &get_symbol_table() const = 0;
52+
53+
/// Check that the goto model is well-formed
54+
///
55+
/// The validation mode indicates whether well-formedness check failures are
56+
/// reported via DATA_INVARIANT violations or exceptions.
57+
virtual void validate(const validation_modet vm) const = 0;
5258
};
5359

5460
#endif

src/goto-programs/goto_model.h

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ class goto_modelt : public abstract_goto_modelt
9494
///
9595
/// The validation mode indicates whether well-formedness check failures are
9696
/// reported via DATA_INVARIANT violations or exceptions.
97-
void validate(const validation_modet vm) const
97+
void validate(const validation_modet vm) const override
9898
{
9999
symbol_table.validate(vm);
100100

@@ -138,6 +138,18 @@ class wrapper_goto_modelt : public abstract_goto_modelt
138138
goto_functions.function_map.end();
139139
}
140140

141+
/// Check that the goto model is well-formed
142+
///
143+
/// The validation mode indicates whether well-formedness check failures are
144+
/// reported via DATA_INVARIANT violations or exceptions.
145+
void validate(const validation_modet vm) const override
146+
{
147+
symbol_table.validate(vm);
148+
149+
const namespacet ns(symbol_table);
150+
goto_functions.validate(ns, vm);
151+
}
152+
141153
private:
142154
const symbol_tablet &symbol_table;
143155
const goto_functionst &goto_functions;

src/goto-programs/lazy_goto_model.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,15 @@ class lazy_goto_modelt : public abstract_goto_modelt
243243
return goto_functions.at(id);
244244
}
245245

246+
/// Check that the goto model is well-formed
247+
///
248+
/// The validation mode indicates whether well-formedness check failures are
249+
/// reported via DATA_INVARIANT violations or exceptions.
250+
void validate(const validation_modet vm) const override
251+
{
252+
goto_model->validate(vm);
253+
}
254+
246255
private:
247256
std::unique_ptr<goto_modelt> goto_model;
248257

0 commit comments

Comments
 (0)