@@ -90,19 +90,23 @@ class ai_baset
90
90
finalize ();
91
91
}
92
92
93
- // / Get the abstract state before the given instruction, without needing to
94
- // / know what kind of domain or history is used. Note: intended for
95
- // / users of the abstract interpreter; don't use internally.
93
+ // / Get a copy of the abstract state before the given instruction, without
94
+ // / needing to know what kind of domain or history is used. Note: intended
95
+ // / for users of the abstract interpreter; derived classes should
96
+ // / use \ref get_state or \ref find_state to access the actual underlying
97
+ // / state.
96
98
// / PRECONDITION(l is dereferenceable)
97
99
// / \param l: The location we want the domain before
98
100
// / \return The domain before `l`. We return a pointer to a copy as the method
99
101
// / should be const and there are some non-trivial cases including merging
100
102
// / domains, etc.
101
103
virtual std::unique_ptr<statet> abstract_state_before (locationt l) const = 0;
102
104
103
- // / Get the abstract state after the given instruction, without needing to
104
- // / know what kind of domain or history is used. Note: intended for
105
- // / users of the abstract interpreter; don't use internally.
105
+ // / Get a copy of the abstract state after the given instruction, without
106
+ // / needing to know what kind of domain or history is used. Note: intended
107
+ // / for users of the abstract interpreter; derived classes should
108
+ // / use \ref get_state or \ref find_state to access the actual underlying
109
+ // / state.
106
110
// / \param l: The location we want the domain after
107
111
// / \return The domain after `l`. We return a pointer to a copy as the method
108
112
// / should be const and there are some non-trivial cases including merging
@@ -212,16 +216,15 @@ class ai_baset
212
216
}
213
217
214
218
protected:
215
- // / Initialize all the domains for a single function. Overloaded this to add a
216
- // / factory .
219
+ // / Initialize all the domains for a single function. Override this to do
220
+ // / custom per-domain initialization .
217
221
virtual void initialize (const goto_programt &goto_program);
218
222
219
- // / Initialize all the domains for a single function. Overloaded this to add a
220
- // / factory.
223
+ // / Initialize all the domains for a single function.
221
224
virtual void initialize (const goto_functionst::goto_functiont &goto_function);
222
225
223
- // / Initialize all the domains for a whole program. Overloaded this to add a
224
- // / factory .
226
+ // / Initialize all the domains for a whole program. Override this to do custom
227
+ // / per-analysis initialization .
225
228
virtual void initialize (const goto_functionst &goto_functions);
226
229
227
230
// / Override this to add a cleanup step after fixedpoint has run
@@ -341,8 +344,16 @@ class ai_baset
341
344
locationt from,
342
345
locationt to,
343
346
const namespacet &ns)=0;
347
+
348
+ // / Get the state for the given location, creating it in a default way if it
349
+ // / doesn't exist
344
350
virtual statet &get_state (locationt l)=0;
351
+
352
+ // / Get the state for the given location if it already exists; throw an
353
+ // / exception if it doesn't
345
354
virtual const statet &find_state (locationt l) const =0;
355
+
356
+ // / Make a copy of a state
346
357
virtual std::unique_ptr<statet> make_temporary_state (const statet &s)=0;
347
358
};
348
359
0 commit comments