Skip to content

Commit d447c26

Browse files
author
martin
committed
Document the invariants on iterators arguments to transform and merge.
In many, but not all, cases they are comparable. However they should always be dereferenceable.
1 parent e3db794 commit d447c26

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/analyses/ai.h

+14
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,15 @@ class ai_domain_baset
4848
// b) there is an edge from the last instruction (END_FUNCTION)
4949
// of the function to the instruction _following_ the call site
5050
// (this also needs to set the LHS, if applicable)
51+
//
52+
// "this" is the domain before the instruction "from"
53+
// "from" is the instruction to be interpretted
54+
// "to" is the next instruction (for GOTO, FUNCTION_CALL, END_FUNCTION)
55+
//
56+
// PRECONDITION(from.is_dereferenceable(), "Must not be _::end()")
57+
// PRECONDITION(to.is_dereferenceable(), "Must not be _::end()")
58+
// PRECONDITION(are_comparable(from,to) ||
59+
// (from->is_function_call() || from->is_end_function())
5160

5261
virtual void transform(
5362
locationt from,
@@ -90,6 +99,11 @@ class ai_domain_baset
9099
//
91100
// This computes the join between "this" and "b".
92101
// Return true if "this" has changed.
102+
// In the usual case, "b" is the updated state after "from"
103+
// and "this" is the state before "to".
104+
//
105+
// PRECONDITION(from.is_dereferenceable(), "Must not be _::end()")
106+
// PRECONDITION(to.is_dereferenceable(), "Must not be _::end()")
93107

94108
// This method allows an expression to be simplified / evaluated using the
95109
// current state. It is used to evaluate assertions and in program

0 commit comments

Comments
 (0)