Mercurial > projects > ldc
changeset 522:cd4eeb6cc5f6
Fix TypeInfo_Tuple array initialization.
Fixes:
mini/emptytuple.d
author | Christian Kamm <kamm incasoftware de> |
---|---|
date | Sat, 16 Aug 2008 19:29:56 +0200 |
parents | 99e95dae90d5 |
children | c9a606d6e641 |
files | gen/typinf.cpp |
diffstat | 1 files changed, 10 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/gen/typinf.cpp Sat Aug 16 14:01:23 2008 +0200 +++ b/gen/typinf.cpp Sat Aug 16 19:29:56 2008 +0200 @@ -1146,8 +1146,17 @@ const LLArrayType* arrTy = LLArrayType::get(tiTy, dim); LLConstant* arrC = llvm::ConstantArray::get(arrTy, arrInits); + // need the pointer to the first element of arrC, so create a global for it + llvm::GlobalValue::LinkageTypes _linkage = llvm::GlobalValue::InternalLinkage;//WeakLinkage; + llvm::GlobalVariable* gvar = new llvm::GlobalVariable(arrTy,true,_linkage,arrC,".tupleelements",gIR->module); + + // get pointer to first element + llvm::ConstantInt* zero = DtoConstSize_t(0); + LLConstant* idxs[2] = { zero, zero }; + LLConstant* arrptr = llvm::ConstantExpr::getGetElementPtr(gvar, idxs, 2); + // build the slice - LLConstant* slice = DtoConstSlice(DtoConstSize_t(dim), arrC); + LLConstant* slice = DtoConstSlice(DtoConstSize_t(dim), arrptr); sinits.push_back(slice); // create the symbol