Mercurial > projects > ldc
comparison gen/arrays.cpp @ 293:ebfa488f4abc trunk
[svn r314] Get correct value type for newing of multidimensional dynamic arrays.
Fixes array_initialization_26_E.
author | ChristianK |
---|---|
date | Sun, 22 Jun 2008 15:21:34 +0200 |
parents | 068cb3c60afb |
children | 895e1b50cf2a |
comparison
equal
deleted
inserted
replaced
292:a92ec67eabe7 | 293:ebfa488f4abc |
---|---|
484 LOG_SCOPE; | 484 LOG_SCOPE; |
485 | 485 |
486 // typeinfo arg | 486 // typeinfo arg |
487 LLValue* arrayTypeInfo = DtoTypeInfoOf(arrayType); | 487 LLValue* arrayTypeInfo = DtoTypeInfoOf(arrayType); |
488 | 488 |
489 // get value type | |
490 Type* vtype = arrayType->toBasetype(); | |
491 for (size_t i=0; i<ndims; ++i) | |
492 vtype = vtype->nextOf(); | |
493 | |
489 // get runtime function | 494 // get runtime function |
490 bool zeroInit = arrayType->toBasetype()->nextOf()->isZeroInit(); | 495 bool zeroInit = vtype->isZeroInit(); |
491 LLFunction* fn = LLVM_D_GetRuntimeFunction(gIR->module, zeroInit ? "_d_newarraymT" : "_d_newarraymiT" ); | 496 LLFunction* fn = LLVM_D_GetRuntimeFunction(gIR->module, zeroInit ? "_d_newarraymT" : "_d_newarraymiT" ); |
492 | 497 |
493 // build dims | 498 // build dims |
494 LLValue* dimsArg = new llvm::AllocaInst(DtoSize_t(), DtoConstUint(ndims), ".newdims", gIR->topallocapoint()); | 499 LLValue* dimsArg = new llvm::AllocaInst(DtoSize_t(), DtoConstUint(ndims), ".newdims", gIR->topallocapoint()); |
495 LLValue* firstDim = NULL; | 500 LLValue* firstDim = NULL; |