From b0f2f146bb6574ec8eba5ead788d95f47a7cc3ba Mon Sep 17 00:00:00 2001 From: Hans Wennborg Date: Thu, 15 May 2014 22:07:49 +0000 Subject: Allow dllimport/dllexport on inline functions and adjust the linkage. This is a step towards handling these attributes on classes (PR11170). Differential Revision: http://reviews.llvm.org/D3772 llvm-svn: 208925 --- clang/lib/CodeGen/CodeGenModule.cpp | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'clang/lib/CodeGen/CodeGenModule.cpp') diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 25399cc1958..d9d2eb0fb56 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -1960,15 +1960,6 @@ llvm::GlobalValue::LinkageTypes CodeGenModule::getLLVMLinkageForDeclarator( if (Linkage == GVA_AvailableExternally) return llvm::Function::AvailableExternallyLinkage; - // LinkOnceODRLinkage is insufficient if the symbol is required to exist in - // the symbol table. Promote the linkage to WeakODRLinkage to preserve the - // semantics of LinkOnceODRLinkage while providing visibility in the symbol - // table. - llvm::GlobalValue::LinkageTypes OnceLinkage = - llvm::GlobalValue::LinkOnceODRLinkage; - if (D->hasAttr() || D->hasAttr()) - OnceLinkage = llvm::GlobalVariable::WeakODRLinkage; - // Note that Apple's kernel linker doesn't support symbol // coalescing, so we need to avoid linkonce and weak linkages there. // Normally, this means we just map to internal, but for explicit @@ -1981,7 +1972,7 @@ llvm::GlobalValue::LinkageTypes CodeGenModule::getLLVMLinkageForDeclarator( // merged with other definitions. c) C++ has the ODR, so we know the // definition is dependable. if (Linkage == GVA_DiscardableODR) - return !Context.getLangOpts().AppleKext ? OnceLinkage + return !Context.getLangOpts().AppleKext ? llvm::Function::LinkOnceODRLinkage : llvm::Function::InternalLinkage; // An explicit instantiation of a template has weak linkage, since @@ -1995,14 +1986,14 @@ llvm::GlobalValue::LinkageTypes CodeGenModule::getLLVMLinkageForDeclarator( // Destructor variants in the Microsoft C++ ABI are always linkonce_odr thunks // emitted on an as-needed basis. if (UseThunkForDtorVariant) - return OnceLinkage; + return llvm::GlobalValue::LinkOnceODRLinkage; // If required by the ABI, give definitions of static data members with inline // initializers at least linkonce_odr linkage. if (getCXXABI().isInlineInitializedStaticDataMemberLinkOnce() && isa(D) && isVarDeclInlineInitializedStaticDataMember(cast(D))) - return OnceLinkage; + return llvm::GlobalValue::LinkOnceODRLinkage; // C++ doesn't have tentative definitions and thus cannot have common // linkage. -- cgit v1.2.3