forked from OSchip/llvm-project
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
This commit is contained in:
parent
256c9507c8
commit
169a5c963f
|
@ -325,7 +325,9 @@ void CodeGenModule::SetFunctionAttributes(const Decl *D,
|
||||||
static CodeGenModule::GVALinkage
|
static CodeGenModule::GVALinkage
|
||||||
GetLinkageForFunctionOrMethodDecl(const Decl *D) {
|
GetLinkageForFunctionOrMethodDecl(const Decl *D) {
|
||||||
if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(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;
|
return CodeGenModule::GVA_Internal;
|
||||||
if (FD->isInline()) {
|
if (FD->isInline()) {
|
||||||
if (FD->getStorageClass() == FunctionDecl::Extern)
|
if (FD->getStorageClass() == FunctionDecl::Extern)
|
||||||
|
|
Loading…
Reference in New Issue