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:
Alexey Prokhin 2014-08-21 16:04:47 +04:00
parent 000663e27e
commit 76f3fd02bd
5 changed files with 33 additions and 27 deletions

View file

@ -188,18 +188,7 @@ void DtoAssert(Module* M, Loc& loc, DValue* msg)
}
// file param
// we might be generating for an imported template function
const char* cur_file = M->srcfile->name->toChars();
if (loc.filename && strcmp(loc.filename, cur_file) != 0)
{
args.push_back(DtoConstString(loc.filename));
}
else
{
IrModule* irmod = getIrModule(M);
args.push_back(DtoLoad(irmod->fileName));
}
args.push_back(DtoModuleFileName(M, loc));
// line param
args.push_back(DtoConstUint(loc.linnum));
@ -214,6 +203,25 @@ void DtoAssert(Module* M, Loc& loc, DValue* msg)
gIR->ir->CreateUnreachable();
}
/****************************************************************************************/
/*////////////////////////////////////////////////////////////////////////////////////////
// Module file name
////////////////////////////////////////////////////////////////////////////////////////*/
LLValue *DtoModuleFileName(Module* M, const Loc& loc)
{
// we might be generating for an imported template function
const char* cur_file = M->srcfile->name->toChars();
if (loc.filename && strcmp(loc.filename, cur_file) != 0)
{
return DtoConstString(loc.filename);
}
else
{
IrModule* irmod = getIrModule(M);
return DtoLoad(irmod->fileName);
}
}
/****************************************************************************************/
/*////////////////////////////////////////////////////////////////////////////////////////