Mercurial > projects > ldc
diff gen/llvmhelpers.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 | 9014d7f0433f |
children | 8fb39f7f1a7c |
line wrap: on
line diff
--- a/gen/llvmhelpers.cpp Mon Apr 27 03:40:40 2009 +0200 +++ b/gen/llvmhelpers.cpp Mon Apr 27 13:30:48 2009 +0200 @@ -128,10 +128,9 @@ // file param // we might be generating for an imported template function - if (!M->ir.irModule) - M->ir.irModule = new IrModule(M, M->srcfile->toChars()); + IrModule* irmod = getIrModule(M); - args.push_back(DtoLoad(M->ir.irModule->fileName)); + args.push_back(DtoLoad(irmod->fileName)); // line param LLConstant* c = DtoConstUint(loc.linnum); @@ -1399,3 +1398,17 @@ ts->unaligned = 1; return false; } + +////////////////////////////////////////////////////////////////////////////////////////// + +IrModule * getIrModule(Module * M) +{ + if (M == NULL) + M = gIR->func()->decl->getModule(); + assert(M && "null module"); + if (!M->ir.irModule) + M->ir.irModule = new IrModule(M, M->srcfile->toChars()); + return M->ir.irModule; +} + +//////////////////////////////////////////////////////////////////////////////////////////