authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-11-29 18:02:13-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-11-29 18:02:13-07:00
log52b24d572522f3bfcd401315942d45beb20ccfa9
tree270b831c6e94d6872dbd973455c567adfe91b7c3
parent3fb0cc0a14df149da5a5b69d7c5065ffade8ddb5

stage1: add some code comments for ConstValSpecial


1 files changed, 15 insertions(+), 0 deletions(-)

src/stage1/all_types.hpp+15
......@@ -338,9 +338,22 @@ struct ConstArgTuple {
338338};
339339
340340enum ConstValSpecial {
341 // The value is only available at runtime. However there may be runtime hints
342 // narrowing the possible values down via the `data.rh_*` fields.
341343 ConstValSpecialRuntime,
344 // The value is comptime-known and resolved. The `data.x_*` fields can be
345 // accessed.
342346 ConstValSpecialStatic,
347 // The value is comptime-known to be `undefined`.
343348 ConstValSpecialUndef,
349 // The value is comptime-known, but not yet resolved. The lazy value system
350 // helps avoid dependency loops by providing answers to certain questions
351 // about values without forcing them to be resolved. For example, the
352 // equation `@sizeOf(Foo) == 0` can be resolved without forcing the struct
353 // layout of `Foo` because we can know whether `Foo` is zero bits without
354 // performing field layout.
355 // A `ZigValue` can be converted from Lazy to Static/Undef by calling the
356 // appropriate resolve function.
344357 ConstValSpecialLazy,
345358};
346359
......@@ -484,6 +497,8 @@ struct LazyValueErrUnionType {
484497
485498struct ZigValue {
486499 ZigType *type;
500 // This field determines how the value is stored. It must be checked
501 // before accessing the `data` union.
487502 ConstValSpecial special;
488503 uint32_t llvm_align;
489504 ConstParent parent;