aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-04-14 06:32:05 +0000
committerChris Lattner <sabre@nondot.org>2009-04-14 06:32:05 +0000
commitd5ee6677c5f22409039a019accf41ec3937afe99 (patch)
tree01b66e11f86f38ad792c5ceeaa6a2dc65290b1da /lib/CodeGen/CodeGenModule.cpp
parentd9d049a93c55624908e81cf3927b7905efeba05f (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69031 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--lib/CodeGen/CodeGenModule.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp
index adf5ac2e41..5ef57ffdcc 100644
--- a/lib/CodeGen/CodeGenModule.cpp
+++ b/lib/CodeGen/CodeGenModule.cpp
@@ -325,7 +325,9 @@ void CodeGenModule::SetFunctionAttributes(const Decl *D,
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)