View source code
Display the source code in dmd/clone.d from which this
page was generated on github.
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
local clone.
Module dmd.clone
Builds struct member functions if needed and not defined by the user.
Includes opEquals
, opAssign
, post blit, copy constructor and destructor.
Documentation
https://dlang.org/phobos/dmd_clone.html
Coverage
https://codecov.io/gh/dlang/dmd/src/master/src/dmd/clone.d
Functions
Name | Description |
---|---|
buildCopyCtor(sd, sc)
|
Generates a copy constructor if needCopyCtor() returns true. The generated copy constructor will be of the form: this(ref return scope inout(S) rhs) inout { this.field1 = rhs.field1; this.field2 = rhs.field2; ... } |
buildDtors(ad, sc)
|
Create aggregate destructor for struct/class by aggregating all the destructors in userDtors[] with the destructors for all the members. Sets ad's fieldDtor, aggrDtor, dtor and tidtor fields. |
buildInv(ad, sc)
|
Create inclusive invariant for struct/class by aggregating all the invariants in invs[]. |
buildOpAssign(sd, sc)
|
Build opAssign for a struct .
|
buildOpEquals(sd, sc)
|
Build opEquals for struct. const bool opEquals(const S s) { ... } |
buildPostBlit(sd, sc)
|
Create inclusive postblit for struct by aggregating all the postblits in postblits[] with the postblits for all the members. Note the close similarity with AggregateDeclaration::buildDtor(), and the ordering changes (runs forward instead of backwards). |
buildXopCmp(sd, sc)
|
Build _xopCmp for TypeInfo_Struct int _xopCmp(ref const S p) const { return this.opCmp(p); } |
buildXopEquals(sd, sc)
|
Build _xopEquals for TypeInfo_Struct bool _xopEquals(ref const S p) const { return this == p; } |
buildXtoHash(sd, sc)
|
Build _xtoHash for non-bitwise hashing static hash_t xtoHash(ref const S p) nothrow @trusted; |
hasIdentityOpAssign(ad, sc)
|
Check given aggregate actually has an identity opAssign or not. |
mergeFuncAttrs(s1, f)
|
Merge function attributes pure, nothrow, @safe, @nogc, and @disable from f into s1. |
needOpEquals(sd)
|
We need an opEquals for the struct if any fields has an opEquals. Generate one if a user-specified one does not exist. |
Authors
License
Copyright © 1999-2024 by the D Language Foundation | Page generated by ddox.