The __forceinline keyword's semantics are now recast as AlwaysInline and
the kw___forceinline token has its language mode set for KEYMS.
This preserves the semantics of the previous implementation but with
less duplication of code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202131
91177308-0d34-0410-b5e6-
96231b3b80d8
}
def AlwaysInline : InheritableAttr {
- let Spellings = [GCC<"always_inline">];
+ let Spellings = [GCC<"always_inline">, Keyword<"__forceinline">];
let Subjects = SubjectList<[Function]>;
let Documentation = [Undocumented];
}
let Documentation = [Undocumented];
}
-def ForceInline : InheritableAttr {
- let Spellings = [Keyword<"__forceinline">];
- let LangOpts = [MicrosoftExt];
- let Documentation = [Undocumented];
-}
-
def SelectAny : InheritableAttr {
let Spellings = [Declspec<"selectany">];
let LangOpts = [MicrosoftExt];
KEYWORD(__stdcall , KEYALL)
KEYWORD(__fastcall , KEYALL)
KEYWORD(__thiscall , KEYALL)
-KEYWORD(__forceinline , KEYALL)
+KEYWORD(__forceinline , KEYMS)
KEYWORD(__unaligned , KEYMS)
// OpenCL address space qualifiers
Fn->addFnAttr(llvm::Attribute::InlineHint);
break;
}
- } else if (!FD->hasAttr<AlwaysInlineAttr>() &&
- !FD->hasAttr<ForceInlineAttr>())
+ } else if (!FD->hasAttr<AlwaysInlineAttr>())
Fn->addFnAttr(llvm::Attribute::NoInline);
}
B.addAttribute(llvm::Attribute::NoDuplicate);
} else if (D->hasAttr<NoInlineAttr>()) {
B.addAttribute(llvm::Attribute::NoInline);
- } else if ((D->hasAttr<AlwaysInlineAttr>() ||
- D->hasAttr<ForceInlineAttr>()) &&
+ } else if (D->hasAttr<AlwaysInlineAttr>() &&
!F->getAttributes().hasAttribute(llvm::AttributeSet::FunctionIndex,
llvm::Attribute::NoInline)) {
// (noinline wins over always_inline, and we can't specify both in IR)
if (getFunctionLinkage(GD) != llvm::Function::AvailableExternallyLinkage)
return true;
const FunctionDecl *F = cast<FunctionDecl>(GD.getDecl());
- if (CodeGenOpts.OptimizationLevel == 0 &&
- !F->hasAttr<AlwaysInlineAttr>() && !F->hasAttr<ForceInlineAttr>())
+ if (CodeGenOpts.OptimizationLevel == 0 && !F->hasAttr<AlwaysInlineAttr>())
return false;
// PR9614. Avoid cases where the source code is lying to us. An available
// externally function should have an equivalent function somewhere else,
break;
case AttributeList::AT_MSInheritance:
handleMSInheritanceAttr(S, D, Attr); break;
- case AttributeList::AT_ForceInline:
- handleSimpleAttribute<ForceInlineAttr>(S, D, Attr); break;
case AttributeList::AT_SelectAny:
handleSimpleAttribute<SelectAnyAttr>(S, D, Attr); break;