View source code
Display the source code in dmd/ctfeexpr.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.ctfeexpr

CTFE for expressions involving pointers, slices, array concatenation etc.

Documentation

https://dlang.org/phobos/dmd_ctfeexpr.html

Coverage

https://codecov.io/gh/dlang/dmd/src/master/src/dmd/ctfeexpr.d

Functions

NameDescription
assignInPlace(dest, src) Assignment helper functions
changeArrayLiteralLength(pue, loc, arrayType, oldval, oldlen, newlen) Given array literal oldval of type ArrayLiteralExp or StringExp, of length oldlen, change its length to newlen. If the newlen is longer than oldlen, all new elements will be set to the default initializer for the element type.
createBlockDuplicatedArrayLiteral(pue, loc, type, elem, dim) Helper for NewExp Create an array literal consisting of 'elem' duplicated 'dim' times.
createBlockDuplicatedStringLiteral(pue, loc, type, value, dim, sz) Helper for NewExp Create a string literal consisting of 'value' duplicated 'dim' times.
ctfeCmp(loc, op, e1, e2) Evaluate >,<=, etc. Resolves slices before comparing. Returns 0 or 1
ctfeEqual(loc, op, e1, e2) Evaluate ==, !=. Resolves slices before comparing. Returns 0 or 1
ctfeIdentity(loc, op, e1, e2) Evaluate is, !is. Resolves slices before comparing. Returns 0 or 1
findFieldIndexByName(sd, v) Same as getFieldIndex, but checks for a direct match with the VarDeclaration
intSignedCmp(op, n1, n2) Returns e1 OP e2; where OP is ==, !=, <, >=, etc. Result is 0 or 1
intUnsignedCmp(op, n1, n2) Returns e1 OP e2; where OP is ==, !=, <, >=, etc. Result is 0 or 1
isCtfeComparable(e) Constant folding, with support for CTFE Return true if non-pointer expression e can be compared with >,is, ==, etc, using ctfeCmp, ctfeEqual, ctfeIdentity
isCtfeValueValid(newval) CTFE Sanity Checks
isPointer(t) Pointer operations
isTypeInfo_Class(type) TypeInfo operations
needToCopyLiteral(expr) Aggregate literals (AA/string/array/struct)
pointToSameMemoryBlock(agg1, agg2) Return true if agg1 and agg2 are pointers to the same memory block
realCmp(op, r1, r2) Returns e1 OP e2; where OP is ==, !=, <, >=, etc. Result is 0 or 1
resolveSlice(e, pue) If e is a SliceExp, constant fold it.
specificCmp(op, rawCmp) Returns cmp OP 0; where OP is ==, !=, <, >=, etc. Result is 0 or 1
voidInitLiteral(t, var) Void initialization

Structs

NameDescription
UnionExp

Authors

Walter Bright

License

Boost License 1.0