From 54e3ba5ace52bcdc0d20d69f715c202a31d8c525 Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Wed, 2 Apr 2014 23:17:29 +0000 Subject: CodeGen: Emit some functions as weak_odr under -fms-compatibility Summary: MSVC always emits inline functions marked with the extern storage class specifier. The result is something similar to the opposite of __attribute__((gnu_inline)). This extension is also available in C. This fixes PR19264. Reviewers: rnk, rsmith CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D3207 llvm-svn: 205485 --- clang/lib/CodeGen/CodeGenModule.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'clang/lib/CodeGen/CodeGenModule.cpp') diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index d997a79..c26f7691 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -589,7 +589,7 @@ CodeGenModule::getFunctionLinkage(GlobalDecl GD) { // explicit instantiations can occur in multiple translation units // and must all be equivalent. However, we are not allowed to // throw away these explicit instantiations. - if (Linkage == GVA_ExplicitTemplateInstantiation) + if (Linkage == GVA_StrongODR) return !Context.getLangOpts().AppleKext ? llvm::Function::WeakODRLinkage : llvm::Function::ExternalLinkage; @@ -1948,8 +1948,7 @@ CodeGenModule::GetLLVMLinkageVarDefinition(const VarDecl *D, bool isConstant) { return llvm::GlobalVariable::WeakODRLinkage; else return llvm::GlobalVariable::WeakAnyLinkage; - } else if (Linkage == GVA_TemplateInstantiation || - Linkage == GVA_ExplicitTemplateInstantiation) + } else if (Linkage == GVA_TemplateInstantiation || Linkage == GVA_StrongODR) return llvm::GlobalVariable::WeakODRLinkage; else if (!getLangOpts().CPlusPlus && ((!CodeGenOpts.NoCommon && !D->hasAttr()) || -- cgit v1.1