Mercurial > projects > ldc
diff gen/toobj.cpp @ 149:4c577c2b7229 trunk
[svn r155] Fixed a bunch of linkage problems (especially with templates)
author | lindquist |
---|---|
date | Mon, 24 Mar 2008 19:43:02 +0100 |
parents | 0ab29b838084 |
children | 7f92f477ff53 |
line wrap: on
line diff
--- a/gen/toobj.cpp Sat Mar 22 12:20:32 2008 +0100 +++ b/gen/toobj.cpp Mon Mar 24 19:43:02 2008 +0100 @@ -519,27 +519,21 @@ Logger::println("parent: %s (%s)", parent->toChars(), parent->kind()); - bool _isconst = isConst(); - if (parent && parent->isFuncDeclaration() && init && init->isExpInitializer()) - _isconst = false; - - llvm::GlobalValue::LinkageTypes _linkage; - bool istempl = false; + // handle static local variables bool static_local = false; - if ((storage_class & STCcomdat) || (parent && DtoIsTemplateInstance(parent))) { - _linkage = llvm::GlobalValue::WeakLinkage; - istempl = true; + bool _isconst = isConst(); + if (parent && parent->isFuncDeclaration()) + { + static_local = true; + if (init && init->isExpInitializer()) { + _isconst = false; + } } - else if (parent && parent->isFuncDeclaration()) { - _linkage = llvm::GlobalValue::InternalLinkage; - static_local = true; - } - else - _linkage = DtoLinkage(protection, storage_class); + + Logger::println("Creating global variable"); const llvm::Type* _type = irGlobal->type.get(); - - Logger::println("Creating global variable"); + llvm::GlobalValue::LinkageTypes _linkage = DtoLinkage(this); std::string _name(mangle()); llvm::GlobalVariable* gvar = new llvm::GlobalVariable(_type,_isconst,_linkage,NULL,_name,gIR->module);