mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-02 08:01:11 +03:00
Lookup runtime function before constructing the call args
To retain the LoC information in case TypeInfo declarations are missing.
This commit is contained in:
parent
4c1154703e
commit
9ff736bf0f
3 changed files with 17 additions and 17 deletions
|
@ -674,13 +674,6 @@ DSliceValue *DtoNewDynArray(Loc &loc, Type *arrayType, DValue *dim,
|
|||
IF_LOG Logger::println("DtoNewDynArray : %s", arrayType->toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
// typeinfo arg
|
||||
LLValue *arrayTypeInfo = DtoTypeInfoOf(arrayType);
|
||||
|
||||
// dim arg
|
||||
assert(DtoType(dim->type) == DtoSize_t());
|
||||
LLValue *arrayLen = DtoRVal(dim);
|
||||
|
||||
// get runtime function
|
||||
Type *eltType = arrayType->toBasetype()->nextOf();
|
||||
bool zeroInit = eltType->isZeroInit();
|
||||
|
@ -690,6 +683,13 @@ DSliceValue *DtoNewDynArray(Loc &loc, Type *arrayType, DValue *dim,
|
|||
: "_d_newarrayU";
|
||||
LLFunction *fn = getRuntimeFunction(loc, gIR->module, fnname);
|
||||
|
||||
// typeinfo arg
|
||||
LLValue *arrayTypeInfo = DtoTypeInfoOf(arrayType);
|
||||
|
||||
// dim arg
|
||||
assert(DtoType(dim->type) == DtoSize_t());
|
||||
LLValue *arrayLen = DtoRVal(dim);
|
||||
|
||||
// call allocator
|
||||
LLValue *newArray =
|
||||
gIR->CreateCallOrInvoke(fn, arrayTypeInfo, arrayLen, ".gc_mem")
|
||||
|
@ -704,9 +704,6 @@ DSliceValue *DtoNewMulDimDynArray(Loc &loc, Type *arrayType, DValue **dims,
|
|||
IF_LOG Logger::println("DtoNewMulDimDynArray : %s", arrayType->toChars());
|
||||
LOG_SCOPE;
|
||||
|
||||
// typeinfo arg
|
||||
LLValue *arrayTypeInfo = DtoTypeInfoOf(arrayType);
|
||||
|
||||
// get value type
|
||||
Type *vtype = arrayType->toBasetype();
|
||||
for (size_t i = 0; i < ndims; ++i) {
|
||||
|
@ -718,6 +715,9 @@ DSliceValue *DtoNewMulDimDynArray(Loc &loc, Type *arrayType, DValue **dims,
|
|||
vtype->isZeroInit() ? "_d_newarraymTX" : "_d_newarraymiTX";
|
||||
LLFunction *fn = getRuntimeFunction(loc, gIR->module, fnname);
|
||||
|
||||
// typeinfo arg
|
||||
LLValue *arrayTypeInfo = DtoTypeInfoOf(arrayType);
|
||||
|
||||
// Check if constant
|
||||
bool allDimsConst = true;
|
||||
for (size_t i = 0; i < ndims; ++i) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue