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
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
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
NewDeclarationaggNew;allocator
-
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
DtorDeclarationsdtors;Array of destructors
-
Declaration
DtorDeclarationdtor;aggregate destructor calling dtors and member constructors
-
Declaration
DtorDeclarationprimaryDtor;non-deleting C++ destructor, same as dtor for D
-
Declaration
DtorDeclarationtidtor;aggregate destructor used in TypeInfo (must have extern(D) ABI)
-
Declaration
FuncDeclarationfieldDtor;aggregate destructor for just the fields
-
Declaration
ExpressiongetRTInfo;pointer to GC info generated by object.RTInfo(this)
-
Declaration
Visibilityvisibility; -
Declaration
boolnoDefaultCtor;no default construction
-
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 booldetermineFields();Find all instance fields, then push them into
fields.Discussion
Runs semantic() for all instance field variables, but also the field types can remain yet not resolved forward references, except direct recursive definitions. After the process sizeok is set to Sizeok.fwd.
Return Value
falseif any errors occur. -
Declaration
final size_tnonHiddenFields();Return Value
The total number of fields minus the number of hidden fields.
-
Declaration
final booldetermineSize(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(Locloc, Expressions*elements, boolctorinit);Fill out remainder of
elements[] with default initializers for fields[].Parameters
Locloclocation
Expressions*elementsexplicit 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, uintsize, 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 effectuintsizealignmentrequirement of fielduint*poffsetpointer to offset to be aligned
-
Declaration
static uintplaceField(uint*nextoffset, uintmemsize, uintmemalignsize, structalign_talignment, uint*paggsize, uint*paggalignsize, boolisunion);Place a member (mem) into an aggregate (agg), which can be a struct, union or class
Return Value
offset to place field at
nextoffset: next location in aggregatememsize: size of membermemalignsize: naturalalignmentof memberalignment:alignmentin effect for this memberpaggsize: size of aggregate (updated)paggalignsize:alignmentof aggregate (updated)isunion: the aggregate is a union -
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
Symbol*stag;tag symbol for debug data
-
Declaration
Symbol*sinit;initializer symbol
-