mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-01 23:50:43 +03:00
Call _d_arraybounds for bounds checking instead of _d_array_bounds.
It expects file name as a first argument instead of pointer to Module.
This commit is contained in:
parent
000663e27e
commit
76f3fd02bd
5 changed files with 33 additions and 27 deletions
|
@ -1167,18 +1167,16 @@ void DtoArrayBoundsCheck(Loc& loc, DValue* arr, DValue* index, DValue* lowerBoun
|
|||
|
||||
std::vector<LLValue*> args;
|
||||
|
||||
// file param
|
||||
Module* funcmodule = gIR->func()->decl->getModule();
|
||||
// module param
|
||||
LLValue *moduleInfoSymbol = funcmodule->moduleInfoSymbol();
|
||||
LLType *moduleInfoType = DtoType(Module::moduleinfo->type);
|
||||
args.push_back(DtoBitCast(moduleInfoSymbol, getPtrToType(moduleInfoType)));
|
||||
args.push_back(DtoModuleFileName(funcmodule, loc));
|
||||
|
||||
// line param
|
||||
LLConstant* c = DtoConstUint(loc.linnum);
|
||||
args.push_back(c);
|
||||
|
||||
// call
|
||||
llvm::Function* errorfn = LLVM_D_GetRuntimeFunction(loc, gIR->module, "_d_array_bounds");
|
||||
llvm::Function* errorfn = LLVM_D_GetRuntimeFunction(loc, gIR->module, "_d_arraybounds");
|
||||
gIR->CreateCallOrInvoke(errorfn, args);
|
||||
|
||||
// the function does not return
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue