Skip to content

Commit c8857bd

Browse files
committed
Comment fix.
Noticed only because I was searching the codebase for "materializeForSet".
1 parent 46981fe commit c8857bd

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

lib/SILGen/FormalEvaluation.h

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -148,23 +148,25 @@ class FormalEvaluationContext {
148148
void dump(SILGenFunction &SGF);
149149
};
150150

151-
/// A scope associated with the beginning of the formal evaluation of an lvalue.
151+
/// A scope associated with the beginning of the evaluation of an lvalue.
152152
///
153-
/// A formal evaluation of an lvalue occurs when emitting:
153+
/// The evaluation of an l-value is split into two stages: its formal
154+
/// evaluation, which evaluates any independent r-values embedded in the l-value
155+
/// expression (e.g. class references and subscript indices), and its formal
156+
/// access duration, which delimits the span of time for which the referenced
157+
/// storage is actually accessed.
154158
///
155-
/// 1. accessors.
156-
/// 2. getters.
157-
/// 3. materializeForSets.
159+
/// Note that other evaluations can be interleaved between the formal evaluation
160+
/// and the beginning of the formal access. For example, in a simple assignment
161+
/// statement, the left-hand side of the assignment is first formally evaluated
162+
/// as an l-value, then the right-hand side is evaluated as an r-value, and only
163+
/// then does the write access begin to the l-value.
158164
///
159-
/// for lvalues. The general form of such an evaluation is:
160-
///
161-
/// formally evaluate the lvalue "x" into memory
162-
/// begin formal access to "x"
163-
/// end formal access to "x"
164-
/// ... *more formal access*
165-
/// begin formal access to "x"
166-
/// end formal access to "x"
167-
/// end formal evaluation of lvalue into memory
165+
/// Note also that the formal evaluation of an l-value will sometimes require
166+
/// its component l-values to be formally accessed. For example, the formal
167+
/// access of the l-value `x?.prop` will initiate an access to `x` immediately
168+
/// because the downstream evaluation must be skipped if `x` has no value, which
169+
/// cannot be determined without beginning the access.
168170
///
169171
/// *NOTE* All formal access contain a pointer to a cleanup in the normal
170172
/// cleanup stack. This is to ensure that when SILGen calls

0 commit comments

Comments
 (0)