dmd.ctfeexpr

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

Members

Classes

CTFEExp
class CTFEExp

This type is only used by the interpreter.

ClassReferenceExp
class ClassReferenceExp

A reference to a class, or an interface. We need this when we point to a base class (we must record what the type is).

ThrownExceptionExp
class ThrownExceptionExp

Fake class which holds the thrown exception. Used for implementing exception handling.

Functions

assignAssocArrayElement
Expression assignAssocArrayElement(Loc loc, AssocArrayLiteralExp aae, Expression index, Expression newval)
Undocumented in source. Be warned that the author may not have intended to support it.
assignInPlace
void assignInPlace(Expression dest, Expression src)

Assignment helper functions **************************

changeArrayLiteralLength
UnionExp changeArrayLiteralLength(Loc loc, TypeArray arrayType, Expression oldval, size_t oldlen, size_t 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.

comparePointers
int comparePointers(TOK op, Expression agg1, dinteger_t ofs1, Expression agg2, dinteger_t ofs2)
Undocumented in source. Be warned that the author may not have intended to support it.
copyLiteral
UnionExp copyLiteral(Expression e)
Undocumented in source. Be warned that the author may not have intended to support it.
createBlockDuplicatedArrayLiteral
ArrayLiteralExp createBlockDuplicatedArrayLiteral(UnionExp* pue, Loc loc, Type type, Expression elem, size_t dim)

Helper for NewExp Create an array literal consisting of 'elem' duplicated 'dim' times.

createBlockDuplicatedStringLiteral
StringExp createBlockDuplicatedStringLiteral(UnionExp* pue, Loc loc, Type type, dchar value, size_t dim, ubyte sz)

Helper for NewExp Create a string literal consisting of 'value' duplicated 'dim' times.

ctfeCast
Expression ctfeCast(UnionExp* pue, Loc loc, Type type, Type to, Expression e)
Undocumented in source. Be warned that the author may not have intended to support it.
ctfeCat
UnionExp ctfeCat(Loc loc, Type type, Expression e1, Expression e2)
Undocumented in source. Be warned that the author may not have intended to support it.
ctfeCmp
bool ctfeCmp(Loc loc, TOK op, Expression e1, Expression e2)

Evaluate >,<=, etc. Resolves slices before comparing. Returns 0 or 1

ctfeEqual
bool ctfeEqual(Loc loc, TOK op, Expression e1, Expression e2)

Evaluate ==, !=. Resolves slices before comparing. Returns 0 or 1

ctfeIdentity
bool ctfeIdentity(Loc loc, TOK op, Expression e1, Expression e2)

Evaluate is, !is. Resolves slices before comparing. Returns 0 or 1

ctfeIndex
Expression ctfeIndex(UnionExp* pue, Loc loc, Type type, Expression e1, uinteger_t indx)
Undocumented in source. Be warned that the author may not have intended to support it.
exceptionOrCantInterpret
bool exceptionOrCantInterpret(Expression e)
Undocumented in source. Be warned that the author may not have intended to support it.
findFieldIndexByName
int findFieldIndexByName(StructDeclaration sd, VarDeclaration v)

Same as getFieldIndex, but checks for a direct match with the VarDeclaration

findKeyInAA
Expression findKeyInAA(Loc loc, AssocArrayLiteralExp ae, Expression e2)
Undocumented in source. Be warned that the author may not have intended to support it.
getAggregateFromPointer
Expression getAggregateFromPointer(Expression e, dinteger_t* ofs)
Undocumented in source. Be warned that the author may not have intended to support it.
intSignedCmp
bool intSignedCmp(TOK op, sinteger_t n1, sinteger_t n2)

Returns e1 OP e2; where OP is ==, !=, <, >=, etc. Result is 0 or 1

intUnsignedCmp
bool intUnsignedCmp(TOK op, dinteger_t n1, dinteger_t n2)

Returns e1 OP e2; where OP is ==, !=, <, >=, etc. Result is 0 or 1

isAssocArray
bool isAssocArray(Type t)
Undocumented in source. Be warned that the author may not have intended to support it.
isCtfeComparable
bool isCtfeComparable(Expression e)

Constant folding, with support for CTFE ************************** Return true if non-pointer expression e can be compared with >,is, ==, etc, using ctfeCmp, ctfeEqual, ctfeIdentity

isCtfeReferenceValid
bool isCtfeReferenceValid(Expression newval)
Undocumented in source. Be warned that the author may not have intended to support it.
isCtfeValueValid
bool isCtfeValueValid(Expression newval)

CTFE Sanity Checks **************************

isFloatIntPaint
bool isFloatIntPaint(Type to, Type from)
Undocumented in source. Be warned that the author may not have intended to support it.
isPointer
bool isPointer(Type t)

Pointer operations ***********************************

isSafePointerCast
bool isSafePointerCast(Type srcPointee, Type destPointee)
Undocumented in source. Be warned that the author may not have intended to support it.
isTrueBool
bool isTrueBool(Expression e)
Undocumented in source. Be warned that the author may not have intended to support it.
isTypeInfo_Class
bool isTypeInfo_Class(Type type)

TypeInfo operations ***********************************

needToCopyLiteral
bool needToCopyLiteral(Expression expr)

Aggregate literals (AA/string/array/struct) *****************

paintFloatInt
Expression paintFloatInt(UnionExp* pue, Expression fromVal, Type to)
Undocumented in source. Be warned that the author may not have intended to support it.
paintTypeOntoLiteral
Expression paintTypeOntoLiteral(Type type, Expression lit)
Undocumented in source. Be warned that the author may not have intended to support it.
paintTypeOntoLiteral
Expression paintTypeOntoLiteral(UnionExp* pue, Type type, Expression lit)
Undocumented in source. Be warned that the author may not have intended to support it.
pointToSameMemoryBlock
bool pointToSameMemoryBlock(Expression agg1, Expression agg2)

Return true if agg1 and agg2 are pointers to the same memory block

pointerArithmetic
UnionExp pointerArithmetic(Loc loc, TOK op, Type type, Expression eptr, Expression e2)
Undocumented in source. Be warned that the author may not have intended to support it.
pointerDifference
UnionExp pointerDifference(Loc loc, Type type, Expression e1, Expression e2)
Undocumented in source. Be warned that the author may not have intended to support it.
realCmp
bool realCmp(TOK op, real_t r1, real_t r2)

Returns e1 OP e2; where OP is ==, !=, <, >=, etc. Result is 0 or 1

resolveArrayLength
uinteger_t resolveArrayLength(Expression e)
Undocumented in source. Be warned that the author may not have intended to support it.
resolveSlice
Expression resolveSlice(Expression e, UnionExp* pue)

If e is a SliceExp, constant fold it.

showCtfeExpr
void showCtfeExpr(Expression e, int level)
Undocumented in source. Be warned that the author may not have intended to support it.
specificCmp
bool specificCmp(TOK op, int rawCmp)

Returns cmp OP 0; where OP is ==, !=, <, >=, etc. Result is 0 or 1

toBuiltinAAType
TypeAArray toBuiltinAAType(Type t)
Undocumented in source. Be warned that the author may not have intended to support it.
voidInitLiteral
UnionExp voidInitLiteral(Type t, VarDeclaration var)

Void initialization **************************

Meta