/// Set whether the "inline" keyword was specified for this function.
void setInlineSpecified(bool I) { IsInline = I; }
+ /// \brief Determine whether this function should be inlined, because it is
+ /// either marked "inline" or is a member function of a C++ class that
+ /// was defined in the class body.
+ bool isInlined() const;
+
bool isInlineDefinitionExternallyVisible() const;
/// isOverloadedOperator - Whether this function declaration
return NumRequiredArgs;
}
+bool FunctionDecl::isInlined() const {
+ return isInlineSpecified() || (isa<CXXMethodDecl>(this) && !isOutOfLine());
+}
+
/// \brief For an inline function definition in C, determine whether the
/// definition will be externally visible.
///
/// externally visible symbol.
bool FunctionDecl::isInlineDefinitionExternallyVisible() const {
assert(isThisDeclarationADefinition() && "Must have the function definition");
- assert(isInlineSpecified() && "Function must be inline");
+ assert(isInlined() && "Function must be inline");
if (!getASTContext().getLangOptions().C99 || hasAttr<GNUInlineAttr>()) {
// GNU inline semantics. Based on a number of examples, we came up with the
if (!Pattern || !PatternDecl)
return true;
- return PatternDecl->isInlineSpecified() ||
- (isa<CXXMethodDecl>(PatternDecl) && !PatternDecl->isOutOfLine());
+ return PatternDecl->isInlined();
}
FunctionDecl *FunctionDecl::getTemplateInstantiationPattern() const {
if (const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(FD)) {
// C++ member functions defined inside the class are always inline.
- if (MD->isInlineSpecified() || !MD->isOutOfLine())
+ if (MD->isInlined())
return CodeGenModule::GVA_CXXInline;
return External;
if (FD->getStorageClass() == FunctionDecl::Static)
return CodeGenModule::GVA_Internal;
- if (!FD->isInlineSpecified())
+ if (!FD->isInlined())
return External;
if (!Features.CPlusPlus || FD->hasAttr<GNUInlineAttr>()) {
// to which they refer.
if (Function->getTemplateSpecializationKind()
== TSK_ExplicitInstantiationDeclaration &&
- PatternDecl->isOutOfLine() && !PatternDecl->isInlineSpecified())
+ !PatternDecl->isInlined())
return;
InstantiatingTemplate Inst(*this, PointOfInstantiation, Function);