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
enum
ClassKind
: ubyte;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.-
Declaration
d
the aggregate is a
d
(efault) class -
Declaration
cpp
the aggregate is a C++ struct/class/interface
-
Declaration
objc
the aggregate is an Objective-C class/interface
-
-
Declaration
struct
MangleOverride
;If an aggregate has a pargma(mangle, ...) this holds the information to mangle.
-
Declaration
abstract class
AggregateDeclaration
: dmd.dsymbol.ScopeDsymbol;Abstract aggregate as a common ancestor for Class- and StructDeclaration.
-
Declaration
Type
type
; -
Declaration
StorageClass
storage_class
; -
Declaration
uint
structsize
;size of struct
-
Declaration
uint
alignsize
;size of struct for alignment purposes
-
Declaration
VarDeclarations
fields
;VarDeclaration
fields
-
Declaration
Dsymbol
deferred
;any
deferred
semantic2() or semantic3() symbol -
Declaration
ClassKind
classKind
;specifies whether this is a D, C++, Objective-C or anonymous struct/class/interface
-
Declaration
CPPMANGLE
cppmangle
;Specify whether to mangle the aggregate as a
class
or astruct
This information is used by the MSVC mangler Only valid for class and struct. TODO: Merge with ClassKind ? -
Declaration
MangleOverride*
mangleOverride
;overridden symbol with pragma(mangle, "...") if not
null
-
Declaration
Dsymbol
enclosing
;!=
null
if is nested pointing to the dsymbol that directlyenclosing
it.- The function that
enclosing
it (nested struct and class) - The class that
enclosing
it (nested class only) - If
enclosing
aggregate is template, itsenclosing
dsymbol.
Discussion
See AggregateDeclaraton::makeNested for the details.
- The function that
-
Declaration
VarDeclaration
vthis
;'this' parameter if this aggregate is nested
-
Declaration
VarDeclaration
vthis2
;'this' parameter if this aggregate is a template and is nested
-
Declaration
FuncDeclarations
invs
;Array of invariants
-
Declaration
FuncDeclaration
inv
;Merged invariant calling all members of invs
-
Declaration
NewDeclaration
aggNew
;allocator
-
Declaration
Dsymbol
ctor
;CtorDeclaration or TemplateDeclaration
-
Declaration
CtorDeclaration
defaultCtor
;default constructor - should have no arguments, because it would be stored in TypeInfo_Class.defaultConstructor
-
Declaration
AliasThis
aliasthis
;forward unresolved lookups to
aliasthis
-
Declaration
DtorDeclarations
dtors
;Array of destructors
-
Declaration
DtorDeclaration
dtor
;aggregate destructor calling dtors and member constructors
-
Declaration
DtorDeclaration
primaryDtor
;non-deleting C++ destructor, same as dtor for D
-
Declaration
DtorDeclaration
tidtor
;aggregate destructor used in TypeInfo (must have extern(D) ABI)
-
Declaration
FuncDeclaration
fieldDtor
;aggregate destructor for just the fields
-
Declaration
Expression
getRTInfo
;pointer to GC info generated by object.RTInfo(this)
-
Declaration
Visibility
visibility
; -
Declaration
bool
noDefaultCtor
;no default construction
-
Declaration
Sizeok
sizeok
;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 bool
determineFields
();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
false
if any errors occur. -
Declaration
final size_t
nonHiddenFields
();Return Value
The total number of fields minus the number of hidden fields.
-
Declaration
final bool
determineSize
(Locloc
);Collect all instance fields, then determine instance size.
Return Value
false
if failed to determine the size. -
Declaration
final bool
checkOverlappedFields
();Calculate field[i].overlapped and overlapUnsafe, and check that all of explicit field initializers have unique memory space on instance.
Return Value
true
if any errors happen. -
Declaration
final bool
fill
(Locloc
, Expressions*elements
, boolctorinit
);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 theelements
will be used for default initialization.Return Value
false
if any errors occur. Otherwise, returnstrue
and the missing arguments will be pushed inelements
[]. -
Declaration
static pure nothrow @safe void
alignmember
(structalign_talignment
, uintsize
, 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 effectuint
size
alignment
requirement of fielduint*
poffset
pointer to offset to be aligned
-
Declaration
static uint
placeField
(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
: naturalalignment
of memberalignment
:alignment
in effect for this memberpaggsize
: size of aggregate (updated)paggalignsize
:alignment
of aggregate (updated)isunion
: the aggregate is a union -
Declaration
final void
setDeprecated
();Flag this aggregate as deprecated
-
Declaration
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) -
Declaration
final Dsymbol
searchCtor
();Look for constructor declaration.
-
Declaration
Symbol*
stag
;tag symbol for debug data
-
Declaration
Symbol*
sinit
;initializer symbol
-