diff options
author | Hans Wennborg <hans@hanshq.net> | 2014-05-15 22:07:49 +0000 |
---|---|---|
committer | Hans Wennborg <hans@hanshq.net> | 2014-05-15 22:07:49 +0000 |
commit | b0f2f146bb6574ec8eba5ead788d95f47a7cc3ba (patch) | |
tree | 4c1326f49266952e3130fcc5f3c723f7343d588b /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | 03efd41bc04c44afc5e3fb5789288f3a327b0cbc (diff) | |
download | bcm5719-llvm-b0f2f146bb6574ec8eba5ead788d95f47a7cc3ba.tar.gz bcm5719-llvm-b0f2f146bb6574ec8eba5ead788d95f47a7cc3ba.zip |
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
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 15 |
1 files changed, 3 insertions, 12 deletions
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<DLLExportAttr>() || D->hasAttr<DLLImportAttr>()) - 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<VarDecl>(D) && isVarDeclInlineInitializedStaticDataMember(cast<VarDecl>(D))) - return OnceLinkage; + return llvm::GlobalValue::LinkOnceODRLinkage; // C++ doesn't have tentative definitions and thus cannot have common // linkage. |