dmd.aggregate
Defines a Dsymbol representing an aggregate, which is a struct, union or class.
Specification: Structs, Unions, Class.
License
Source: aggregate.d
Documentation: https://dlang.org/phobos/dmd_aggregate.html
-
Declaration
enumClassKind: ubyte;The
ClassKindenum is used in AggregateDeclaration AST nodes to specify the linkage type of the struct/class/interface or if it is an anonymous class. If the class is anonymous it is also considered to be a D class.-
Declaration
dthe aggregate is a
d(efault) class -
Declaration
cppthe aggregate is a C++ struct/class/interface
-
Declaration
objcthe aggregate is an Objective-C class/interface
-
Declaration
cthe aggregate is a C struct
-
-
Declaration
const(char)*toChars(ClassKindc);Give a nice string for a class kind for error messages
Parameters
ClassKindcclass kind
Return Value
0-terminated string for
c -
Declaration
structMangleOverride;If an aggregate has a pargma(mangle, ...) this holds the information to mangle.
-
Declaration
abstract classAggregateDeclaration: dmd.dsymbol.ScopeDsymbol;Abstract aggregate as a common ancestor for Class- and StructDeclaration.
-
Declaration
Typetype; -
Declaration
StorageClassstorage_class; -
Declaration
uintstructsize;size of struct
-
Declaration
uintalignsize;size of struct for alignment purposes
-
Declaration
VarDeclarationsfields;VarDeclaration
fields -
Declaration
Dsymboldeferred;any
deferredsemantic2() or semantic3() symbol -
Declaration
ClassKindclassKind;specifies whether this is a D, C++, Objective-C or anonymous struct/class/interface
-
Declaration
CPPMANGLEcppmangle;Specify whether to mangle the aggregate as a
classor astructThis information is used by the MSVC mangler Only valid for class and struct. TODO: Merge with ClassKind ? -
Declaration
MangleOverride*pMangleOverride;overridden symbol with pragma(mangle, "...") if not
null -
Declaration
Dsymbolenclosing;!=
nullif is nested pointing to the dsymbol that directlyenclosingit.- The function that
enclosingit (nested struct and class) - The class that
enclosingit (nested class only) - If
enclosingaggregate is template, itsenclosingdsymbol.
Discussion
See AggregateDeclaraton::makeNested for the details.
- The function that
-
Declaration
VarDeclarationvthis;'this' parameter if this aggregate is nested
-
Declaration
VarDeclarationvthis2;'this' parameter if this aggregate is a template and is nested
-
Declaration
FuncDeclarationsinvs;Array of invariants
-
Declaration
FuncDeclarationinv;Merged invariant calling all members of invs
-
Declaration
Dsymbolctor;CtorDeclaration or TemplateDeclaration
-
Declaration
CtorDeclarationdefaultCtor;default constructor - should have no arguments, because it would be stored in TypeInfo_Class.defaultConstructor
-
Declaration
AliasThisaliasthis;forward unresolved lookups to
aliasthis -
Declaration
DtorDeclarationsuserDtors;user-defined destructors (
~this()) - mixins can yield multiple ones -
Declaration
DtorDeclarationaggrDtor;aggregate destructor calling userDtors and fieldDtor (and base class aggregate dtor for C++ classes)
-
Declaration
DtorDeclarationdtor;the aggregate destructor exposed as
__xdtoralias -
Declaration
DtorDeclarationtidtor;(same as aggrDtor, except for C++ classes with virtual dtor on Windows)
Discussion
aggregate destructor used in TypeInfo (must have extern(D) ABI)
-
Declaration
DtorDeclarationfieldDtor;function destructing (non-inherited) fields
-
Declaration
ExpressiongetRTInfo;pointer to GC info generated by object.RTInfo(this)
-
Declaration
Visibilityvisibility; -
Declaration
boolnoDefaultCtor;no default construction
-
Declaration
booldisableNew;disallow allocations using
new -
Declaration
Sizeoksizeok;set when structsize contains valid data
-
Declaration
Scope*newScope(Scope*sc);Create a new scope from
sc. semantic, semantic2 and semantic3 will use this for aggregate members. -
Declaration
final size_tnonHiddenFields();Return Value
The total number of fields minus the number of hidden fields.
-
Declaration
final booldetermineSize(const ref Locloc);Collect all instance fields, then determine instance size.
Return Value
falseif failed to determine the size. -
Declaration
final boolcheckOverlappedFields();Calculate field[i].overlapped and overlapUnsafe, and check that all of explicit field initializers have unique memory space on instance.
Return Value
trueif any errors happen. -
Declaration
final boolfill(const ref Locloc, ref Expressionselements, boolctorinit);Fill out remainder of
elements[] with default initializers for fields[].Parameters
Locloclocation
Expressionselementsexplicit arguments which given to construct object.
boolctorinittrueif theelementswill be used for default initialization.Return Value
falseif any errors occur. Otherwise, returnstrueand the missing arguments will be pushed inelements[]. -
Declaration
static pure nothrow @safe voidalignmember(structalign_talignment, uintmemalignsize, uint*poffset);Do byte or word
alignmentas necessary. Align sizes of 0, as we may not know array sizes yet.Parameters
structalign_talignmentstruct
alignmentthat is in effectuintmemalignsizenatural
alignmentof fielduint*poffsetpointer to offset to be aligned
-
Declaration
static uintplaceField(uint*nextoffset, uintmemsize, uintmemalignsize, structalign_talignment, uint*paggsize, uint*paggalignsize, boolisunion);Place a field (mem) into an aggregate (agg), which can be a struct, union or class
Parameters
uint*nextoffsetlocation just past the end of the previous field in the aggregate. Updated to be just past the end of this field to be placed, i.e. the future
nextoffsetuintmemsizesize of field
uintmemalignsizenatural
alignmentof fieldstructalign_talignmentalignmentin effect for this fielduint*paggsizesize of aggregate (updated)
uint*paggalignsizealignmentof aggregate (updated)boolisunionthe aggregate is a union
Return Value
aligned offset to place field at
-
Declaration
final voidsetDeprecated();Flag this aggregate as deprecated
-
Declaration
final const boolisNested();Returns
trueif there's an extra member which is the 'this' pointer to the enclosing context (enclosing aggregate or function) -
Declaration
final DsymbolsearchCtor();Look for constructor declaration.
-
Declaration
void*sinit;initializer symbol
-