Mercurial > projects > ldc
comparison gen/toobj.c @ 17:6c6cd097bcdf trunk
[svn r21] * Fixed local instances of imported templates
author | lindquist |
---|---|
date | Wed, 03 Oct 2007 06:14:41 +0200 |
parents | 37a4fdab33fc |
children | c05ef76f1c20 |
comparison
equal
deleted
inserted
replaced
16:860524276608 | 17:6c6cd097bcdf |
---|---|
628 TypeFunction* f = (TypeFunction*)type; | 628 TypeFunction* f = (TypeFunction*)type; |
629 assert(f->llvmType); | 629 assert(f->llvmType); |
630 const llvm::FunctionType* functype = llvm::cast<llvm::FunctionType>(llvmValue->getType()->getContainedType(0)); | 630 const llvm::FunctionType* functype = llvm::cast<llvm::FunctionType>(llvmValue->getType()->getContainedType(0)); |
631 | 631 |
632 // only members of the current module maybe be defined | 632 // only members of the current module maybe be defined |
633 if (getModule() == gIR->dmodule) | 633 if (getModule() == gIR->dmodule || parent->isTemplateInstance()) |
634 { | 634 { |
635 llvmDModule = gIR->dmodule; | 635 llvmDModule = gIR->dmodule; |
636 | 636 |
637 bool allow_fbody = true; | 637 bool allow_fbody = true; |
638 // handle static constructor / destructor | 638 // handle static constructor / destructor |
728 new llvm::UnreachableInst(lastbb); | 728 new llvm::UnreachableInst(lastbb); |
729 } | 729 } |
730 | 730 |
731 gIR->funcdecls.pop_back(); | 731 gIR->funcdecls.pop_back(); |
732 } | 732 } |
733 } | 733 |
734 } | 734 // template instances should have weak linkage |
735 if (parent->isTemplateInstance()) { | |
736 func->setLinkage(llvm::GlobalValue::WeakLinkage); | |
737 } | |
738 } | |
739 } |