Mercurial > projects > ldc
diff gen/arrays.cpp @ 1271:0686701178d3
Moved special casing of 'assert(this, "null this");' generated statements from !ThisExp into !AssertExp.
Fixed filenames for array bounds errors and probably others, fixes #271 .
author | Tomas Lindquist Olsen <tomas.l.olsen gmail com> |
---|---|
date | Mon, 27 Apr 2009 13:30:48 +0200 |
parents | e45984519be7 |
children | ad41053c336e |
line wrap: on
line diff
--- a/gen/arrays.cpp Mon Apr 27 03:40:40 2009 +0200 +++ b/gen/arrays.cpp Mon Apr 27 13:30:48 2009 +0200 @@ -978,7 +978,8 @@ void DtoArrayBoundsCheck(Loc& loc, DValue* arr, DValue* index, bool isslice) { Type* arrty = arr->getType()->toBasetype(); - assert((arrty->ty == Tsarray || arrty->ty == Tarray) && "Can only array bounds check for static or dynamic arrays"); + assert((arrty->ty == Tsarray || arrty->ty == Tarray) && + "Can only array bounds check for static or dynamic arrays"); // static arrays could get static checks for static indices // but shouldn't since it might be generic code that's never executed @@ -1000,7 +1001,10 @@ std::vector<LLValue*> args; // file param - args.push_back(DtoLoad(gIR->dmodule->ir.irModule->fileName)); + // get the filename from the function symbol instead of the current module + // it's wrong for instantiations of imported templates. Fixes LDC bug #271 + Module* funcmodule = gIR->func()->decl->getModule(); + args.push_back(DtoLoad(getIrModule(NULL)->fileName)); // line param LLConstant* c = DtoConstUint(loc.linnum);