StorageClass getStorageClass() const { return StorageClass(SClass); }
void setStorageClass(StorageClass SC) { SClass = SC; }
- bool isInline() const { return IsInline; }
- void setInline(bool I) { IsInline = I; }
+ /// \brief Determine whether the "inline" keyword was specified for this
+ /// function.
+ bool isInlineSpecified() const { return IsInline; }
+
+ /// Set whether the "inline" keyword was specified for this function.
+ void setInlineSpecified(bool I) { IsInline = I; }
bool isInlineDefinitionExternallyVisible() const;
ENUM_XML(FunctionDecl::Static, "static")
ENUM_XML(FunctionDecl::PrivateExtern, "__private_extern__")
END_ENUM_XML
- ATTRIBUTE_OPT_XML(isInline(), "inline")
+ ATTRIBUTE_OPT_XML(isInlineSpecified(), "inline")
//ATTRIBUTE_OPT_XML(isVariadic(), "variadic") // in the type reference
ATTRIBUTE_XML(getNumParams(), "num_args")
SUB_NODE_SEQUENCE_XML(ParmVarDecl)
ATTRIBUTE_XML(getNameAsString(), "name")
TYPE_ATTRIBUTE_XML(getType()->getAs<FunctionType>()->getResultType())
ATTRIBUTE_XML(getType()->getAs<FunctionType>(), "function_type")
- ATTRIBUTE_OPT_XML(isInline(), "inline")
+ ATTRIBUTE_OPT_XML(isInlineSpecified(), "inline")
ATTRIBUTE_OPT_XML(isStatic(), "static")
ATTRIBUTE_OPT_XML(isVirtual(), "virtual")
ATTRIBUTE_XML(getNumParams(), "num_args")
/// externally visible symbol.
bool FunctionDecl::isInlineDefinitionExternallyVisible() const {
assert(isThisDeclarationADefinition() && "Must have the function definition");
- assert(isInline() && "Function must be inline");
+ assert(isInlineSpecified() && "Function must be inline");
if (!getASTContext().getLangOptions().C99 || hasAttr<GNUInlineAttr>()) {
// GNU inline semantics. Based on a number of examples, we came up with the
for (redecl_iterator Redecl = redecls_begin(), RedeclEnd = redecls_end();
Redecl != RedeclEnd;
++Redecl) {
- if (Redecl->isInline() && Redecl->getStorageClass() != Extern)
+ if (Redecl->isInlineSpecified() && Redecl->getStorageClass() != Extern)
return true;
}
if (!Redecl->getLexicalDeclContext()->isTranslationUnit())
continue;
- if (!Redecl->isInline() || Redecl->getStorageClass() == Extern)
+ if (!Redecl->isInlineSpecified() || Redecl->getStorageClass() == Extern)
return true; // Not an inline definition
}
if (!Pattern || !PatternDecl)
return true;
- return PatternDecl->isInline() ||
+ return PatternDecl->isInlineSpecified() ||
(isa<CXXMethodDecl>(PatternDecl) && !PatternDecl->isOutOfLine());
}
case FunctionDecl::PrivateExtern: Out << "__private_extern__ "; break;
}
- if (D->isInline()) Out << "inline ";
+ if (D->isInlineSpecified()) Out << "inline ";
if (D->isVirtualAsWritten()) Out << "virtual ";
}
if (const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(FD)) {
// C++ member functions defined inside the class are always inline.
- if (MD->isInline() || !MD->isOutOfLine())
+ if (MD->isInlineSpecified() || !MD->isOutOfLine())
return CodeGenModule::GVA_CXXInline;
return External;
if (FD->getStorageClass() == FunctionDecl::Static)
return CodeGenModule::GVA_Internal;
- if (!FD->isInline())
+ if (!FD->isInlineSpecified())
return External;
if (!Features.CPlusPlus || FD->hasAttr<GNUInlineAttr>()) {
FD->setPreviousDeclaration(
cast_or_null<FunctionDecl>(Reader.GetDecl(Record[Idx++])));
FD->setStorageClass((FunctionDecl::StorageClass)Record[Idx++]);
- FD->setInline(Record[Idx++]);
+ FD->setInlineSpecified(Record[Idx++]);
FD->setVirtualAsWritten(Record[Idx++]);
FD->setPure(Record[Idx++]);
FD->setHasInheritedPrototype(Record[Idx++]);
Writer.AddStmt(D->getBody());
Writer.AddDeclRef(D->getPreviousDeclaration(), Record);
Record.push_back(D->getStorageClass()); // FIXME: stable encoding
- Record.push_back(D->isInline());
+ Record.push_back(D->isInlineSpecified());
Record.push_back(D->isVirtualAsWritten());
Record.push_back(D->isPure());
Record.push_back(D->hasInheritedPrototype());
// C99 6.7.4p4: In a hosted environment, the inline function specifier
// shall not appear in a declaration of main.
// static main is not an error under C99, but we should warn about it.
- bool isInline = FD->isInline();
+ bool isInline = FD->isInlineSpecified();
bool isStatic = FD->getStorageClass() == FunctionDecl::Static;
if (isInline || isStatic) {
unsigned diagID = diag::warn_unusual_main_decl;
// Currently, the dllimport attribute is ignored for inlined functions.
// Warning is emitted.
- if (FD->isInline()) {
+ if (FD->isInlineSpecified()) {
S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << "dllimport";
return;
}
// Currently, the dllexport attribute is ignored for inlined functions, unless
// the -fkeep-inline-functions flag has been used. Warning is emitted;
- if (FD->isInline()) {
+ if (FD->isInlineSpecified()) {
// FIXME: ... unless the -fkeep-inline-functions flag has been used.
S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << "dllexport";
return;
return;
}
- if (!Fn->isInline()) {
+ if (!Fn->isInlineSpecified()) {
S.Diag(Attr.getLoc(), diag::warn_gnu_inline_attribute_requires_inline);
return;
}
FunctionDecl::Create(SemaRef.Context, DC, D->getLocation(),
D->getDeclName(), T, D->getDeclaratorInfo(),
D->getStorageClass(),
- D->isInline(), D->hasWrittenPrototype());
+ D->isInlineSpecified(), D->hasWrittenPrototype());
Function->setLexicalDeclContext(Owner);
// Attach the parameters
Name, T,
Constructor->getDeclaratorInfo(),
Constructor->isExplicit(),
- Constructor->isInline(), false);
+ Constructor->isInlineSpecified(), false);
} else if (CXXDestructorDecl *Destructor = dyn_cast<CXXDestructorDecl>(D)) {
QualType ClassTy = SemaRef.Context.getTypeDeclType(Record);
Name = SemaRef.Context.DeclarationNames.getCXXDestructorName(
SemaRef.Context.getCanonicalType(ClassTy));
Method = CXXDestructorDecl::Create(SemaRef.Context, Record,
Destructor->getLocation(), Name,
- T, Destructor->isInline(), false);
+ T, Destructor->isInlineSpecified(), false);
} else if (CXXConversionDecl *Conversion = dyn_cast<CXXConversionDecl>(D)) {
CanQualType ConvTy
= SemaRef.Context.getCanonicalType(
Method = CXXConversionDecl::Create(SemaRef.Context, Record,
Conversion->getLocation(), Name,
T, Conversion->getDeclaratorInfo(),
- Conversion->isInline(),
+ Conversion->isInlineSpecified(),
Conversion->isExplicit());
} else {
Method = CXXMethodDecl::Create(SemaRef.Context, Record, D->getLocation(),
D->getDeclName(), T, D->getDeclaratorInfo(),
- D->isStatic(), D->isInline());
+ D->isStatic(), D->isInlineSpecified());
}
if (TemplateParams) {
// to which they refer.
if (Function->getTemplateSpecializationKind()
== TSK_ExplicitInstantiationDeclaration &&
- PatternDecl->isOutOfLine() && !PatternDecl->isInline())
+ PatternDecl->isOutOfLine() && !PatternDecl->isInlineSpecified())
return;
InstantiatingTemplate Inst(*this, PointOfInstantiation, Function);