give always_inline functions internal linkage. If they cannot be
inlined for some reason, then we don't want a strong or even weak
definition.
llvm-svn: 69031
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index adf5ac2..5ef57ff 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -325,7 +325,9 @@
static CodeGenModule::GVALinkage
GetLinkageForFunctionOrMethodDecl(const Decl *D) {
if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
- if (FD->getStorageClass() == FunctionDecl::Static)
+ // "static" and attr(always_inline) functions get internal linkage.
+ if (FD->getStorageClass() == FunctionDecl::Static ||
+ FD->hasAttr<AlwaysInlineAttr>())
return CodeGenModule::GVA_Internal;
if (FD->isInline()) {
if (FD->getStorageClass() == FunctionDecl::Extern)