Removed some dead code.

Fixed assertion filenames for imported template instances. Fixes #152 .
This commit is contained in:
Tomas Lindquist Olsen 2009-02-04 02:10:23 +01:00
parent 6cd6ddd237
commit 7d2a0a84a7
6 changed files with 13 additions and 13 deletions

View file

@ -109,7 +109,7 @@ llvm::AllocaInst* DtoAlloca(const LLType* lltype, LLValue* arraysize, const std:
// ASSERT HELPER
////////////////////////////////////////////////////////////////////////////////////////*/
void DtoAssert(Loc* loc, DValue* msg)
void DtoAssert(Module* M, Loc* loc, DValue* msg)
{
std::vector<LLValue*> args;
@ -124,7 +124,12 @@ void DtoAssert(Loc* loc, DValue* msg)
}
// file param
args.push_back(DtoLoad(gIR->dmodule->ir.irModule->fileName));
// we might be generating for an imported template function
if (!M->ir.irModule)
M->ir.irModule = new IrModule(M, M->srcfile->toChars());
args.push_back(DtoLoad(M->ir.irModule->fileName));
// line param
LLConstant* c = DtoConstUint(loc->linnum);

View file

@ -16,7 +16,7 @@ llvm::AllocaInst* DtoAlloca(const LLType* lltype, const std::string& name = "");
llvm::AllocaInst* DtoAlloca(const LLType* lltype, LLValue* arraysize, const std::string& name = "");
// assertion generator
void DtoAssert(Loc* loc, DValue* msg);
void DtoAssert(Module* M, Loc* loc, DValue* msg);
// return the LabelStatement from the current function with the given identifier or NULL if not found
LabelStatement* DtoLabelStatement(Identifier* ident);

View file

@ -1768,7 +1768,7 @@ DValue* AssertExp::toElem(IRState* p)
// call assert runtime functions
p->scope() = IRScope(assertbb,endbb);
DtoAssert(&loc, msg ? msg->toElem(p) : NULL);
DtoAssert(p->func()->decl->getModule(), &loc, msg ? msg->toElem(p) : NULL);
// rewrite the scope
p->scope() = IRScope(endbb,oldend);
@ -1943,7 +1943,7 @@ DValue* HaltExp::toElem(IRState* p)
// FIXME: DMD inserts a trap here... we probably should as well !?!
#if 1
DtoAssert(&loc, NULL);
DtoAssert(p->func()->decl->getModule(), &loc, NULL);
#else
// call the new (?) trap intrinsic
p->ir->CreateCall(GET_INTRINSIC_DECL(trap),"");

View file

@ -99,8 +99,9 @@ void Module::genobjfile(int multiobj)
ir.module = new llvm::Module(mname);
// module ir state
// might already exist via import, just overwrite...
//FIXME: is there a good reason for overwriting?
// might already exist via import, just overwrite since
// the global created for the filename must belong to the right llvm module
// FIXME: but shouldn't this always get reset between modules? like other IrSymbols
this->ir.irModule = new IrModule(this, srcfile->toChars());
// set target stuff

View file

@ -33,9 +33,6 @@ IrFunction::IrFunction(FuncDeclaration* fd)
dwarfSubProg = NULL;
srcfileArg = NULL;
msgArg = NULL;
nextUnique.push(0);
}

View file

@ -30,9 +30,6 @@ struct IrFunction : IrBase
llvm::Constant* dwarfSubProg;
llvm::AllocaInst* srcfileArg;
llvm::AllocaInst* msgArg;
// pushes a unique label scope of the given name
void pushUniqueLabelScope(const char* name);
// pops a label scope