pub enum PlaceKind {
Object(ObjectId),
Deref(Box<Expr>),
Index {
base: Box<Expr>,
index: Box<Expr>,
},
Field {
base: Box<Place>,
record: RecordId,
index: usize,
},
ComplexPart {
base: Box<Place>,
imag: bool,
},
Str(StrId),
Temporary(Box<Expr>),
CompoundLiteral {
object: ObjectId,
init: Box<Expr>,
},
}Expand description
The shape of a Place.
Variants§
Object(ObjectId)
A named object.
Deref(Box<Expr>)
*ptr, where ptr has pointer type.
Index
base[index], where base has pointer type: the same thing as
*(base + index), which is what C says it is.
Fields
Field
base.field, where field indexes the record’s member list. p->f
arrives as a Field over a Deref.
Fields
ComplexPart
__real__ z or __imag__ z: one part of a complex object, which GNU C
makes an lvalue whenever z is one, so __imag__ z = 1.0; assigns.
The type of the place is the corresponding real
type; base is the complex object, which may be
a PlaceKind::Temporary when the operand was an rvalue.
Fields
Str(StrId)
A string literal, whose type is an array of char (or of wchar_t).
Temporary(Box<Expr>)
A temporary holding the value of an expression, which is what makes
f().field work for a struct returned by value.
CompoundLiteral
The object a block-scope compound literal ((T){ … }, C99 6.5.2.5)
denotes.
Unlike a PlaceKind::Temporary it is a real object with automatic
storage duration and the lifetime of the enclosing block, so its
address may be taken and used for the rest of that block. object is a
hidden local sema declares at the top of that block, zero-initialised;
init is the value the literal was written with, and is evaluated
here — where the literal stands — so that C’s evaluation order
survives and a literal inside a loop is built afresh on every
iteration. A compound literal at file scope is an ordinary
Storage::Static object instead and arrives as a
PlaceKind::Object.