diff options
author | Chris Lattner <sabre@nondot.org> | 2009-04-14 06:32:05 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-04-14 06:32:05 +0000 |
commit | 169a5c963f5f20c407c67966812b7ee1957e9242 (patch) | |
tree | a5bbcca358a2257be0f71d7451e51eb7fbb6c7dc /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | 256c9507c897843e2b6854ed61c9280b1f821170 (diff) | |
download | bcm5719-llvm-169a5c963f5f20c407c67966812b7ee1957e9242.tar.gz bcm5719-llvm-169a5c963f5f20c407c67966812b7ee1957e9242.zip |
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
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index adf5ac2e414..5ef57ffdcc2 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/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) |