@@ -82,15 +82,22 @@ class ai_baset
82
82
finalize ();
83
83
}
84
84
85
+ // / Accessing individual domains at particular domains
86
+ // / (without needing to know what kind of domain or history is used)
87
+ // / A pointer to a copy as the method should be const and
88
+ // / there are some non-trivial cases including merging domains, etc.
89
+
85
90
// / Returns the abstract state before the given instruction
86
- virtual const ai_domain_baset & abstract_state_before (
87
- goto_programt::const_targett t ) const = 0;
91
+ // / PRECONDITION(l is dereferenceable)
92
+ virtual std::unique_ptr<statet> abstract_state_before (locationt l ) const = 0;
88
93
89
94
// / Returns the abstract state after the given instruction
90
- virtual const ai_domain_baset & abstract_state_after (
91
- goto_programt::const_targett t) const
95
+ virtual std::unique_ptr<statet> abstract_state_after (locationt l) const
92
96
{
93
- return abstract_state_before (std::next (t));
97
+ // / PRECONDITION(l is dereferenceable && std::next(l) is dereferenceable)
98
+ // / Check relies on a DATA_INVARIANT of goto_programs
99
+ INVARIANT (!l->is_end_function (), " No state after the last instruction" );
100
+ return abstract_state_before (std::next (l));
94
101
}
95
102
96
103
virtual void clear ()
@@ -304,10 +311,17 @@ class ait:public ai_baset
304
311
return it->second ;
305
312
}
306
313
307
- const ai_domain_baset & abstract_state_before (
308
- goto_programt::const_targett t) const override
314
+ std::unique_ptr<statet> abstract_state_before (locationt t) const override
309
315
{
310
- return (*this )[t];
316
+ typename state_mapt::const_iterator it=state_map.find (t);
317
+ if (it==state_map.end ())
318
+ {
319
+ std::unique_ptr<statet> d = util_make_unique<domainT>();
320
+ CHECK_RETURN (d->is_bottom ());
321
+ return d;
322
+ }
323
+
324
+ return util_make_unique<domainT>(it->second );
311
325
}
312
326
313
327
void clear () override
0 commit comments