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 | 61e1f5cc721b67ea42d962024ebd0d323f7a7f93 (patch) | |
| tree | 24086ba26bc292700e9d89764608fd18f8056cbb /lib/CodeGen/CodeGenModule.cpp | |
| parent | b4415008e09aab84dd503ff0312589ee569522c3 (diff) | |
| download | clang-61e1f5cc721b67ea42d962024ebd0d323f7a7f93.tar.gz clang-61e1f5cc721b67ea42d962024ebd0d323f7a7f93.tar.bz2 clang-61e1f5cc721b67ea42d962024ebd0d323f7a7f93.tar.xz | |
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
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208925 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenModule.cpp')
| -rw-r--r-- | lib/CodeGen/CodeGenModule.cpp | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp index 25399cc195..d9d2eb0fb5 100644 --- a/lib/CodeGen/CodeGenModule.cpp +++ b/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. |
