Mercurial > projects > ldc
diff gen/tollvm.c @ 85:f869c636a113 trunk
[svn r89] Fixed a bunch of problems with template instance across multiple modules.
Fixed initialization of function local static variables, with a non const initializer (now happens on first call using a global to make sure it only happens once.)
author | lindquist |
---|---|
date | Fri, 02 Nov 2007 06:32:32 +0100 |
parents | 339422268de1 |
children |
line wrap: on
line diff
--- a/gen/tollvm.c Fri Nov 02 02:27:41 2007 +0100 +++ b/gen/tollvm.c Fri Nov 02 06:32:32 2007 +0100 @@ -890,17 +890,22 @@ ////////////////////////////////////////////////////////////////////////////////////////// -void DtoInitializer(Initializer* init) +elem* DtoInitializer(Initializer* init) { if (ExpInitializer* ex = init->isExpInitializer()) { Logger::println("expression initializer"); - elem* e = ex->exp->toElem(gIR); - delete e; + return ex->exp->toElem(gIR); + } + else if (init->isVoidInitializer()) + { + // do nothing } else { Logger::println("unsupported initializer: %s", init->toChars()); + assert(0); } + return 0; } ////////////////////////////////////////////////////////////////////////////////////////// @@ -1460,3 +1465,15 @@ ptr = gIR->ir->CreateBitCast(ptr, llt, "tmp"); return new llvm::GetElementPtrInst(ptr, DtoConstUint(os / llt_sz), "tmp", gIR->scopebb()); } + +////////////////////////////////////////////////////////////////////////////////////////// + +bool DtoIsTemplateInstance(Dsymbol* s) +{ + assert(s); + if (s->isTemplateInstance() && !s->isTemplateMixin()) + return true; + else if (s->parent) + return DtoIsTemplateInstance(s->parent); + return false; +}