Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using a local clone.

dmd.aggregate

Compiler implementation of the D programming language.
Authors:

Source aggregate.d

enum ClassKind: int;
The ClassKind enum 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.
d
the aggregate is a d(efault) class
cpp
the aggregate is a C++ struct/class/interface
objc
the aggregate is an Objective-C class/interface
abstract class AggregateDeclaration: dmd.dsymbol.ScopeDsymbol;
ClassKind classKind;
specifies whether this is a D, C++, Objective-C or anonymous struct/class/interface
Scope* newScope(Scope* sc);
Create a new scope from sc. semantic, semantic2 and semantic3 will use this for aggregate members.
final bool determineFields();
Find all instance fields, then push them into fields.
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.
Returns:
false if any errors occur.
final size_t nonHiddenFields();
Returns:
The total number of fields minus the number of hidden fields.
final bool determineSize(Loc loc);
Collect all instance fields, then determine instance size.
Returns:
false if failed to determine the size.
final bool checkOverlappedFields();
Calculate field[i].overlapped and overlapUnsafe, and check that all of explicit field initializers have unique memory space on instance.
Returns:
true if any errors happen.
final bool fill(Loc loc, Expressions* elements, bool ctorinit);
Fill out remainder of elements[] with default initializers for fields[].
Parameters:
Loc loc location
Expressions* elements explicit arguments which given to construct object.
bool ctorinit true if the elements will be used for default initialization.
Returns:
false if any errors occur. Otherwise, returns true and the missing arguments will be pushed in elements[].
static pure nothrow @safe void alignmember(structalign_t alignment, uint size, uint* poffset);
Do byte or word alignment as necessary. Align sizes of 0, as we may not know array sizes yet.
Parameters:
structalign_t alignment struct alignment that is in effect
uint size alignment requirement of field
uint* poffset pointer to offset to be aligned
static uint placeField(uint* nextoffset, uint memsize, uint memalignsize, structalign_t alignment, uint* paggsize, uint* paggalignsize, bool isunion);
Place a member (mem) into an aggregate (agg), which can be a struct, union or class
Returns:
offset to place field at
nextoffset: next location in aggregate memsize: size of member memalignsize: natural alignment of member alignment: alignment in effect for this member paggsize: size of aggregate (updated) paggalignsize: alignment of aggregate (updated) isunion: the aggregate is a union
final void setDeprecated();
Flag this aggregate as deprecated
final const bool isNested();
Returns true if there's an extra member which is the 'this' pointer to the enclosing context (enclosing aggregate or function)
final Dsymbol searchCtor();
Look for constructor declaration.