stage1: add some code comments for ConstValSpecial

This commit is contained in:
Andrew Kelley 2020-11-29 18:02:13 -07:00
parent 3fb0cc0a14
commit 52b24d5725

View File

@ -338,9 +338,22 @@ struct ConstArgTuple {
};
enum ConstValSpecial {
// The value is only available at runtime. However there may be runtime hints
// narrowing the possible values down via the `data.rh_*` fields.
ConstValSpecialRuntime,
// The value is comptime-known and resolved. The `data.x_*` fields can be
// accessed.
ConstValSpecialStatic,
// The value is comptime-known to be `undefined`.
ConstValSpecialUndef,
// The value is comptime-known, but not yet resolved. The lazy value system
// helps avoid dependency loops by providing answers to certain questions
// about values without forcing them to be resolved. For example, the
// equation `@sizeOf(Foo) == 0` can be resolved without forcing the struct
// layout of `Foo` because we can know whether `Foo` is zero bits without
// performing field layout.
// A `ZigValue` can be converted from Lazy to Static/Undef by calling the
// appropriate resolve function.
ConstValSpecialLazy,
};
@ -484,6 +497,8 @@ struct LazyValueErrUnionType {
struct ZigValue {
ZigType *type;
// This field determines how the value is stored. It must be checked
// before accessing the `data` union.
ConstValSpecial special;
uint32_t llvm_align;
ConstParent parent;