Mercurial > projects > ldc
comparison gen/classes.cpp @ 147:0636f6269dfd trunk
[svn r152] Relates to ticket #34. Always emit class definition if it is a template instance. Linkage still needs to be fixed.
author | ChristianK |
---|---|
date | Thu, 13 Mar 2008 18:37:52 +0100 |
parents | a123dca8349b |
children | 4c577c2b7229 |
comparison
equal
deleted
inserted
replaced
146:ddfdae91281a | 147:0636f6269dfd |
---|---|
344 | 344 |
345 gIR->structs.push_back(irstruct); | 345 gIR->structs.push_back(irstruct); |
346 gIR->classes.push_back(cd); | 346 gIR->classes.push_back(cd); |
347 | 347 |
348 bool needs_definition = false; | 348 bool needs_definition = false; |
349 if (cd->getModule() == gIR->dmodule) { | 349 if (cd->getModule() == gIR->dmodule || DtoIsTemplateInstance(cd)) { |
350 needs_definition = true; | 350 needs_definition = true; |
351 } | 351 } |
352 | 352 |
353 llvm::GlobalValue::LinkageTypes _linkage = llvm::GlobalValue::ExternalLinkage; | 353 llvm::GlobalValue::LinkageTypes _linkage = llvm::GlobalValue::ExternalLinkage; |
354 | 354 |
706 | 706 |
707 // get the struct (class) type | 707 // get the struct (class) type |
708 assert(cd->type->ty == Tclass); | 708 assert(cd->type->ty == Tclass); |
709 TypeClass* ts = (TypeClass*)cd->type; | 709 TypeClass* ts = (TypeClass*)cd->type; |
710 | 710 |
711 if (cd->getModule() == gIR->dmodule) { | 711 if (cd->getModule() == gIR->dmodule || DtoIsTemplateInstance(cd)) { |
712 // interfaces don't have initializers | 712 // interfaces don't have initializers |
713 // neither do abstract classes | 713 // neither do abstract classes |
714 if (!cd->isInterfaceDeclaration() && !cd->isAbstract()) | 714 if (!cd->isInterfaceDeclaration() && !cd->isAbstract()) |
715 { | 715 { |
716 cd->irStruct->init->setInitializer(cd->irStruct->constInit); | 716 cd->irStruct->init->setInitializer(cd->irStruct->constInit); |