class FunctionDecl

Declaration

class FunctionDecl : public DeclaratorDecl,
                     public DeclContext,
                     public Redeclarable { /* full declaration omitted */ };

Description

Represents a function declaration or definition. Since a given function can be declared several times in a program, there may be several FunctionDecls that correspond to that function. Only one of those FunctionDecls will be found when traversing the list of declarations in the context of the FunctionDecl (e.g., the translation unit); this FunctionDecl contains all of the information known about the function. Other, previous declarations of the function are available via the getPreviousDecl() chain.

Declared at: clang/include/clang/AST/Decl.h:1872

Inherits from: DeclaratorDecl, DeclContext, Redeclarable

Member Variables

private clang::ParmVarDecl** ParamInfo = nullptr
A new[]'d array of pointers to VarDecls for the formal parameters of this function. This is null if a prototype or if there are no formals.
private anonymous struct / union
private unsigned int ODRHash
private clang::SourceLocation EndRangeLoc
We could compute the full range in getSourceRange(). However, when we're dealing with a function definition deserialized from a PCH/AST file, we can only compute the full range once the function body has been de-serialized, so it's far better to have the (sometimes-redundant) EndRangeLoc.
private llvm::PointerUnion< NamedDecl*, MemberSpecializationInfo*, FunctionTemplateSpecializationInfo*, DependentFunctionTemplateSpecializationInfo*> TemplateOrSpecialization
For non-templates this value will be NULL, unless this declaration was declared directly inside of a function template, in which case it will have a pointer to a FunctionDecl, stored in the NamedDecl. For function declarations that describe a function template, this will be a pointer to a FunctionTemplateDecl, stored in the NamedDecl. For member functions of class template specializations, this will be a MemberSpecializationInfo pointer containing information about the specialization. For function template specializations, this will be a FunctionTemplateSpecializationInfo, which contains information about the template being specialized and the template arguments involved in that specialization.
private clang::DeclarationNameLoc DNLoc
Provides source/type location info for the declaration name embedded in the DeclaratorDecl base class.

Inherited from DeclContext:

protected
protected FirstDecl = nullptr
protected LastDecl = nullptr

Inherited from Decl:

protected NextInContextAndBits
protected Access
protected FromASTFile
protected IdentifierNamespace
protected CacheValidAndLinkage

Method Overview

Inherited from DeclContext:

Inherited from DeclaratorDecl:

Inherited from ValueDecl:

Inherited from NamedDecl:

Inherited from Decl:

Methods

static clang::FunctionDecl* Create(
    clang::ASTContext& C,
    clang::DeclContext* DC,
    clang::SourceLocation StartLoc,
    const clang::DeclarationNameInfo& NameInfo,
    clang::QualType T,
    clang::TypeSourceInfo* TInfo,
    clang::StorageClass SC,
    bool UsesFPIntrin,
    bool isInlineSpecified,
    bool hasWrittenPrototype,
    clang::ConstexprSpecKind ConstexprKind,
    clang::Expr* TrailingRequiresClause)

Declared at: clang/include/clang/AST/Decl.h:2062

Parameters

clang::ASTContext& C
clang::DeclContext* DC
clang::SourceLocation StartLoc
const clang::DeclarationNameInfo& NameInfo
clang::QualType T
clang::TypeSourceInfo* TInfo
clang::StorageClass SC
bool UsesFPIntrin
bool isInlineSpecified
bool hasWrittenPrototype
clang::ConstexprSpecKind ConstexprKind
clang::Expr* TrailingRequiresClause

static clang::FunctionDecl* Create(
    clang::ASTContext& C,
    clang::DeclContext* DC,
    clang::SourceLocation StartLoc,
    clang::SourceLocation NLoc,
    clang::DeclarationName N,
    clang::QualType T,
    clang::TypeSourceInfo* TInfo,
    clang::StorageClass SC,
    bool UsesFPIntrin = false,
    bool isInlineSpecified = false,
    bool hasWrittenPrototype = true,
    clang::ConstexprSpecKind ConstexprKind =
        ConstexprSpecKind::Unspecified,
    clang::Expr* TrailingRequiresClause = nullptr)

Declared at: clang/include/clang/AST/Decl.h:2048

Parameters

clang::ASTContext& C
clang::DeclContext* DC
clang::SourceLocation StartLoc
clang::SourceLocation NLoc
clang::DeclarationName N
clang::QualType T
clang::TypeSourceInfo* TInfo
clang::StorageClass SC
bool UsesFPIntrin = false
bool isInlineSpecified = false
bool hasWrittenPrototype = true
clang::ConstexprSpecKind ConstexprKind = ConstexprSpecKind::Unspecified
clang::Expr* TrailingRequiresClause = nullptr

static clang::FunctionDecl* CreateDeserialized(
    clang::ASTContext& C,
    unsigned int ID)

Declared at: clang/include/clang/AST/Decl.h:2068

Parameters

clang::ASTContext& C
unsigned int ID

FunctionDecl(
    clang::Decl::Kind DK,
    clang::ASTContext& C,
    clang::DeclContext* DC,
    clang::SourceLocation StartLoc,
    const clang::DeclarationNameInfo& NameInfo,
    clang::QualType T,
    clang::TypeSourceInfo* TInfo,
    clang::StorageClass S,
    bool UsesFPIntrin,
    bool isInlineSpecified,
    clang::ConstexprSpecKind ConstexprKind,
    clang::Expr* TrailingRequiresClause = nullptr)

Declared at: clang/include/clang/AST/Decl.h:2013

Parameters

clang::Decl::Kind DK
clang::ASTContext& C
clang::DeclContext* DC
clang::SourceLocation StartLoc
const clang::DeclarationNameInfo& NameInfo
clang::QualType T
clang::TypeSourceInfo* TInfo
clang::StorageClass S
bool UsesFPIntrin
bool isInlineSpecified
clang::ConstexprSpecKind ConstexprKind
clang::Expr* TrailingRequiresClause = nullptr

bool UsesFPIntrin() const

Description

Determine whether the function was declared in source context that requires constrained FP intrinsics

Declared at: clang/include/clang/AST/Decl.h:2632

static clang::FunctionDecl* castFromDeclContext(
    const clang::DeclContext* DC)

Declared at: clang/include/clang/AST/Decl.h:2867

Parameters

const clang::DeclContext* DC

static clang::DeclContext* castToDeclContext(
    const clang::FunctionDecl* D)

Declared at: clang/include/clang/AST/Decl.h:2864

Parameters

const clang::FunctionDecl* D

static bool classof(const clang::Decl* D)

Declared at: clang/include/clang/AST/Decl.h:2860

Parameters

const clang::Decl* D

static bool classofKind(clang::Decl::Kind K)

Declared at: clang/include/clang/AST/Decl.h:2861

Parameters

clang::Decl::Kind K

bool doesDeclarationForceExternallyVisibleDefinition()
    const

Declared at: clang/include/clang/AST/Decl.h:2650

bool doesThisDeclarationHaveABody() const

Description

Returns whether this specific declaration of the function has a body.

Declared at: clang/include/clang/AST/Decl.h:2183

void getAssociatedConstraints(
    SmallVectorImpl<const clang::Expr*>& AC) const

Description

Get the associated-constraints of this function declaration. Currently, this will either be a vector of size 1 containing the trailing-requires-clause or an empty vector.

Use this instead of getTrailingRequiresClause for concepts APIs that accept an ArrayRef of constraint expressions.

Declared at: clang/include/clang/AST/Decl.h:2499

Parameters

SmallVectorImpl<const clang::Expr*>& AC

clang::Stmt* getBody() const

Description

getBody - If this Decl represents a declaration for a body of code, such as a function or method definition, this method returns the top-level Stmt* of that body. Otherwise this method returns null.

Declared at: clang/include/clang/AST/Decl.h:2157

clang::Stmt* getBody(
    const clang::FunctionDecl*& Definition) const

Description

Retrieve the body (definition) of the function. The function body might be in any of the (re-)declarations of this function. The variant that accepts a FunctionDecl pointer will set that function declaration to the actual declaration containing the body (if there is one). NOTE: For checking if there is a body, use hasBody() instead, to avoid unnecessary AST de-serialization of the body.

Declared at: clang/include/clang/AST/Decl.h:2155

Parameters

const clang::FunctionDecl*& Definition

unsigned int getBuiltinID(
    bool ConsiderWrapperFunctions = false) const

Declared at: clang/include/clang/AST/Decl.h:2511

Parameters

bool ConsiderWrapperFunctions = false

clang::QualType getCallResultType() const

Description

Determine the type of an expression that calls this function.

Declared at: clang/include/clang/AST/Decl.h:2604

clang::FunctionDecl* getCanonicalDecl()

Description

Retrieves the "canonical" declaration of the given declaration.

Declared at: clang/include/clang/AST/Decl.h:2506

const clang::FunctionDecl* getCanonicalDecl()
    const

Declared at: clang/include/clang/AST/Decl.h:2507

clang::ConstexprSpecKind getConstexprKind() const

Declared at: clang/include/clang/AST/Decl.h:2316

clang::QualType getDeclaredReturnType() const

Description

Get the declared return type, which may differ from the actual return type if the return type is deduced.

Declared at: clang/include/clang/AST/Decl.h:2585

clang::FunctionDecl::DefaultedFunctionInfo*
getDefaultedFunctionInfo() const

Declared at: clang/include/clang/AST/Decl.h:2195

clang::FunctionDecl* getDefinition()

Description

Get the definition for this declaration.

Declared at: clang/include/clang/AST/Decl.h:2139

const clang::FunctionDecl* getDefinition() const

Declared at: clang/include/clang/AST/Decl.h:2145

clang::
    DependentFunctionTemplateSpecializationInfo*
    getDependentSpecializationInfo() const

Declared at: clang/include/clang/AST/Decl.h:2817

clang::FunctionTemplateDecl*
getDescribedFunctionTemplate() const

Description

Retrieves the function template that is described by this function declaration. Every function template is represented as a FunctionTemplateDecl and a FunctionDecl (or something derived from FunctionDecl). The former contains template properties (such as the template parameter lists) while the latter contains the actual description of the template's contents. FunctionTemplateDecl::getTemplatedDecl() retrieves the FunctionDecl that describes the function template, getDescribedFunctionTemplate() retrieves the FunctionTemplateDecl from a FunctionDecl.

Declared at: clang/include/clang/AST/Decl.h:2721

clang::SourceLocation getEllipsisLoc() const

Description

Returns the location of the ellipsis of a variadic function.

Declared at: clang/include/clang/AST/Decl.h:2080

clang::SourceRange getExceptionSpecSourceRange()
    const

Description

Attempt to compute an informative source range covering the function exception specification, if any.

Declared at: clang/include/clang/AST/Decl.h:2601

clang::ExceptionSpecificationType
getExceptionSpecType() const

Description

Gets the ExceptionSpecificationType as declared.

Declared at: clang/include/clang/AST/Decl.h:2592

clang::FunctionTypeLoc getFunctionTypeLoc() const

Description

Find the source location information for how the type of this function was written. May be absent (for example if the function was declared via a typedef) and may contain a different type from that of the function (for example if the function type was adjusted by an attribute).

Declared at: clang/include/clang/AST/Decl.h:2566

clang::FunctionDecl* getInstantiatedFromDecl()
    const

Declared at: clang/include/clang/AST/Decl.h:2707

clang::FunctionDecl*
getInstantiatedFromMemberFunction() const

Description

If this function is an instantiation of a member function of a class template specialization, retrieves the function from which it was instantiated. This routine will return non-NULL for (non-templated) member functions of class templates and for instantiations of function templates. For example, given: The declaration for X <int >::f is a (non-templated) FunctionDecl whose parent is the class template specialization X <int >. For this declaration, getInstantiatedFromFunction() will return the FunctionDecl X <T >::A. When a complete definition of X <int >::A is required, it will be instantiated from the declaration returned by getInstantiatedFromMemberFunction().

Declared at: clang/include/clang/AST/Decl.h:2685

clang::LanguageLinkage getLanguageLinkage() const

Description

Compute the language linkage.

Declared at: clang/include/clang/AST/Decl.h:2430

const clang::IdentifierInfo*
getLiteralIdentifier() const

Declared at: clang/include/clang/AST/Decl.h:2662

clang::MemberSpecializationInfo*
getMemberSpecializationInfo() const

Description

If this function is an instantiation of a member function of a class template specialization, retrieves the member specialization information.

Declared at: clang/include/clang/AST/Decl.h:2693

unsigned int getMemoryFunctionKind() const

Description

Identify a memory copying or setting function. If the given function is a memory copy or setting function, returns the corresponding Builtin ID. If the function is not a memory function, returns 0.

Declared at: clang/include/clang/AST/Decl.h:2849

unsigned int getMinRequiredArguments() const

Description

Returns the minimum number of arguments needed to call this function. This may be fewer than the number of function parameters, if some of the parameters have default arguments (in C++).

Declared at: clang/include/clang/AST/Decl.h:2552

clang::FunctionDecl* getMostRecentDeclImpl()

Description

Implementation of getMostRecentDecl(), to be overridden by any subclass that has a redeclaration chain.

Declared at: clang/include/clang/AST/Decl.h:2029

clang::MultiVersionKind getMultiVersionKind()
    const

Description

Gets the kind of multiversioning attribute this declaration has. Note that this can return a value even if the function is not multiversion, such as the case of 'target'.

Declared at: clang/include/clang/AST/Decl.h:2475

void getNameForDiagnostic(
    llvm::raw_ostream& OS,
    const clang::PrintingPolicy& Policy,
    bool Qualified) const

Description

Appends a human-readable name for this declaration into the given stream. This is the method invoked by Sema when displaying a NamedDecl in a diagnostic. It does not necessarily produce the same result as printName(); for example, class template specializations are printed with their template arguments.

Declared at: clang/include/clang/AST/Decl.h:2074

Parameters

llvm::raw_ostream& OS
const clang::PrintingPolicy& Policy
bool Qualified

clang::DeclarationNameInfo getNameInfo() const

Declared at: clang/include/clang/AST/Decl.h:2070

clang::FunctionDecl* getNextRedeclarationImpl()

Description

Returns the next redeclaration or itself if this is the only decl. Decl subclasses that can be redeclared should override this method so that Decl::redecl_iterator can iterate over them.

Declared at: clang/include/clang/AST/Decl.h:2021

unsigned int getNumParams() const

Description

Return the number of parameters this function must have based on its FunctionType. This is the length of the ParamInfo array after it has been created.

Declared at: clang/include/clang/AST/Decl.h:2535

unsigned int getODRHash()

Description

Returns ODRHash of the function. This value is calculated and stored on first call, then the stored value returned on the other calls.

Declared at: clang/include/clang/AST/Decl.h:2853

unsigned int getODRHash() const

Description

Returns cached ODRHash of the function. This must have been previously computed and stored.

Declared at: clang/include/clang/AST/Decl.h:2857

clang::OverloadedOperatorKind
getOverloadedOperator() const

Declared at: clang/include/clang/AST/Decl.h:2660

const clang::ParmVarDecl* getParamDecl(
    unsigned int i) const

Declared at: clang/include/clang/AST/Decl.h:2537

Parameters

unsigned int i

clang::ParmVarDecl* getParamDecl(unsigned int i)

Declared at: clang/include/clang/AST/Decl.h:2541

Parameters

unsigned int i

clang::SourceRange getParametersSourceRange()
    const

Description

Attempt to compute an informative source range covering the function parameters, including the ellipsis of a variadic function. The source range excludes the parentheses, and is invalid if there are no parameters and no ellipsis.

Declared at: clang/include/clang/AST/Decl.h:2581

clang::SourceLocation getPointOfInstantiation()
    const

Description

Retrieve the (first) point of instantiation of a function template specialization or a member of a class template specialization.

Declared at: clang/include/clang/AST/Decl.h:2839

Returns

the first point of instantiation, if this function was instantiated from a template; otherwise, returns an invalid source location.

clang::FunctionDecl* getPreviousDeclImpl()

Description

Implementation of getPreviousDecl(), to be overridden by any subclass that has a redeclaration chain.

Declared at: clang/include/clang/AST/Decl.h:2025

clang::FunctionTemplateDecl* getPrimaryTemplate()
    const

Description

Retrieve the primary template that this function template specialization either specializes or was instantiated from. If this function declaration is not a function template specialization, returns NULL.

Declared at: clang/include/clang/AST/Decl.h:2761

clang::QualType getReturnType() const

Declared at: clang/include/clang/AST/Decl.h:2568

clang::SourceRange getReturnTypeSourceRange()
    const

Description

Attempt to compute an informative source range covering the function return type. This may omit qualifiers and other information with limited representation in the AST.

Declared at: clang/include/clang/AST/Decl.h:2575

clang::SourceRange getSourceRange() const

Description

Source range that this declaration covers.

Declared at: clang/include/clang/AST/Decl.h:2087

clang::StorageClass getStorageClass() const

Description

Returns the storage class as written in the source. For the computed linkage of symbol, see getLinkage.

Declared at: clang/include/clang/AST/Decl.h:2611

clang::FunctionDecl*
getTemplateInstantiationPattern(
    bool ForDefinition = true) const

Description

Retrieve the function declaration from which this function could be instantiated, if it is an instantiation (rather than a non-template or a specialization, for example). If \p ForDefinition is \c false, explicit specializations will be treated as if they were implicit instantiations. This will then find the pattern corresponding to non-definition portions of the declaration, such as default arguments and the exception specification.

Declared at: clang/include/clang/AST/Decl.h:2754

Parameters

bool ForDefinition = true

const clang::TemplateArgumentList*
getTemplateSpecializationArgs() const

Description

Retrieve the template arguments used to produce this function template specialization from the primary template. If this function declaration is not a function template specialization, returns NULL.

Declared at: clang/include/clang/AST/Decl.h:2768

const clang::ASTTemplateArgumentListInfo*
getTemplateSpecializationArgsAsWritten() const

Description

Retrieve the template argument list as written in the sources, if any. If this function declaration is not a function template specialization or if it had no explicit template argument list, returns NULL. Note that it an explicit template argument list may be written empty, e.g., template < > void foo < >(char* s);

Declared at: clang/include/clang/AST/Decl.h:2778

clang::FunctionTemplateSpecializationInfo*
getTemplateSpecializationInfo() const

Description

If this function is actually a function template specialization, retrieve information about this function template specialization. Otherwise, returns NULL.

Declared at: clang/include/clang/AST/Decl.h:2734

clang::TemplateSpecializationKind
getTemplateSpecializationKind() const

Description

Determine what kind of template instantiation this function represents.

Declared at: clang/include/clang/AST/Decl.h:2821

clang::TemplateSpecializationKind
getTemplateSpecializationKindForInstantiation()
    const

Description

Determine the kind of template specialization this function represents for the purpose of template instantiation.

Declared at: clang/include/clang/AST/Decl.h:2826

clang::FunctionDecl::TemplatedKind
getTemplatedKind() const

Description

What kind of templated function this is.

Declared at: clang/include/clang/AST/Decl.h:2688

bool hasBody(
    const clang::FunctionDecl*& Definition) const

Description

Returns true if the function has a body. The function body might be in any of the (re-)declarations of this function. The variant that accepts a FunctionDecl pointer will set that function declaration to the actual declaration containing the body (if there is one).

Declared at: clang/include/clang/AST/Decl.h:2108

Parameters

const clang::FunctionDecl*& Definition

bool hasBody() const

Description

Returns true if this \c Decl represents a declaration for a body of code, such as a function or method definition. Note that \c hasBody can also return true if any redeclaration of this\c Decl represents a declaration for a body of code.

Declared at: clang/include/clang/AST/Decl.h:2110

bool hasImplicitReturnZero() const

Description

Whether falling off this function implicitly returns null/zero. If a more specific implicit return value is required, front-ends should synthesize the appropriate return statements.

Declared at: clang/include/clang/AST/Decl.h:2268

bool hasInheritedPrototype() const

Description

Whether this function inherited its prototype from a previous declaration.

Declared at: clang/include/clang/AST/Decl.h:2299

bool hasODRHash() const

Description

Whether an ODRHash has been stored.

Declared at: clang/include/clang/AST/Decl.h:2007

bool hasOneParamOrDefaultArgs() const

Description

Determine whether this function has a single parameter, or multiple parameters where all but the first have default arguments. This notion is used in the definition of copy/move constructors and initializer list constructors. Note that, unlike getMinRequiredArguments, parameter packs are not treated specially here.

Declared at: clang/include/clang/AST/Decl.h:2560

bool hasPrototype() const

Description

Whether this function has a prototype, either because one was explicitly written or because it was "inherited" by merging a declaration without a prototype with a declaration that has a prototype.

Declared at: clang/include/clang/AST/Decl.h:2283

bool hasSkippedBody() const

Description

True if the function was a definition but its body was skipped.

Declared at: clang/include/clang/AST/Decl.h:2452

bool hasTrivialBody() const

Description

Returns whether the function has a trivial body that does not require any specific codegen.

Declared at: clang/include/clang/AST/Decl.h:2117

bool hasWrittenPrototype() const

Description

Whether this function has a written prototype.

Declared at: clang/include/clang/AST/Decl.h:2288

bool instantiationIsPending() const

Description

Whether the instantiation of this function is pending. This bit is set when the decision to instantiate this function is made and unset if and when the function body is created. That leaves out cases where instantiation did not happen because the template definition was not seen in this TU. This bit remains set in those cases, under the assumption that the instantiation will happen in some other TU.

Declared at: clang/include/clang/AST/Decl.h:2332

bool isCPUDispatchMultiVersion() const

Description

True if this function is a multiversioned dispatch function as a part of the cpu_specific/cpu_dispatch functionality.

Declared at: clang/include/clang/AST/Decl.h:2480

bool isCPUSpecificMultiVersion() const

Description

True if this function is a multiversioned processor specific function as a part of the cpu_specific/cpu_dispatch functionality.

Declared at: clang/include/clang/AST/Decl.h:2483

bool isConsteval() const

Declared at: clang/include/clang/AST/Decl.h:2322

bool isConstexpr() const

Description

Whether this is a (C++11) constexpr function or constexpr constructor.

Declared at: clang/include/clang/AST/Decl.h:2310

bool isConstexprSpecified() const

Declared at: clang/include/clang/AST/Decl.h:2319

bool isDefaulted() const

Description

Whether this function is defaulted. Valid for e.g. special member functions, defaulted comparisions (not methods!).

Declared at: clang/include/clang/AST/Decl.h:2235

bool isDefined() const

Declared at: clang/include/clang/AST/Decl.h:2133

bool isDefined(
    const clang::FunctionDecl*& Definition,
    bool CheckForPendingFriendDefinition =
        false) const

Description

Returns true if the function has a definition that does not need to be instantiated. The variant that accepts a FunctionDecl pointer will set that function declaration to the declaration that is a definition (if there is one).

Declared at: clang/include/clang/AST/Decl.h:2130

Parameters

const clang::FunctionDecl*& Definition
bool CheckForPendingFriendDefinition = false
If \c true, also check for friend declarations that were instantiataed from function definitions. Such a declaration behaves as if it is a definition for the purpose of redefinition checking, but isn't actually a "real" definition until its body is instantiated.

bool isDeleted() const

Description

Whether this function has been deleted. A function that is "deleted" (via the C++0x "= delete" syntax) acts like a normal function, except that it cannot actually be called or have its address taken. Deleted functions are typically used in C++ overload resolution to attract arguments whose type or lvalue/rvalue-ness would permit the use of a different overload that would behave incorrectly. For example, one might use deleted functions to ban implicit conversion from a floating-point number to an Integer type:

Declared at: clang/include/clang/AST/Decl.h:2365

bool isDeletedAsWritten() const

Declared at: clang/include/clang/AST/Decl.h:2369

bool isDeletedBit() const

Declared at: clang/include/clang/AST/Decl.h:2004

bool isDestroyingOperatorDelete() const

Description

Determine whether this is a destroying operator delete.

Declared at: clang/include/clang/AST/Decl.h:2427

bool isExplicitlyDefaulted() const

Description

Whether this function is explicitly defaulted.

Declared at: clang/include/clang/AST/Decl.h:2239

bool isExternC() const

Description

Determines whether this function is a function with external, C linkage.

Declared at: clang/include/clang/AST/Decl.h:2434

bool isFunctionTemplateSpecialization() const

Description

Determine whether this function is a function template specialization.

Declared at: clang/include/clang/AST/Decl.h:2727

bool isGlobal() const

Description

Determines whether this is a global function.

Declared at: clang/include/clang/AST/Decl.h:2445

bool isImplicitlyInstantiable() const

Description

Determines whether this function is a function template specialization or a member of a class template specialization that can be implicitly instantiated.

Declared at: clang/include/clang/AST/Decl.h:2739

bool isInExternCContext() const

Description

Determines whether this function's context is, or is nested within, a C++ extern "C" linkage spec.

Declared at: clang/include/clang/AST/Decl.h:2438

bool isInExternCXXContext() const

Description

Determines whether this function's context is, or is nested within, a C++ extern "C++" linkage spec.

Declared at: clang/include/clang/AST/Decl.h:2442

bool isIneligibleOrNotSelected() const

Declared at: clang/include/clang/AST/Decl.h:2258

bool isInlineBuiltinDeclaration() const

Description

Determine if this function provides an inline implementation of a builtin.

Declared at: clang/include/clang/AST/Decl.h:2424

bool isInlineDefinitionExternallyVisible() const

Declared at: clang/include/clang/AST/Decl.h:2646

bool isInlineSpecified() const

Description

Determine whether the "inline" keyword was specified for this function.

Declared at: clang/include/clang/AST/Decl.h:2622

bool isInlined() const

Description

Determine whether this function should be inlined, because it is either marked "inline" or "constexpr" or is a member function of a class that was defined in the class body.

Declared at: clang/include/clang/AST/Decl.h:2644

bool isLateTemplateParsed() const

Description

Whether this templated function will be late parsed.

Declared at: clang/include/clang/AST/Decl.h:2214

bool isMSExternInline() const

Declared at: clang/include/clang/AST/Decl.h:2648

bool isMSVCRTEntryPoint() const

Description

Determines whether this function is a MSVCRT user defined entry point.

Declared at: clang/include/clang/AST/Decl.h:2381

bool isMain() const

Description

Determines whether this function is "main", which is the entry point into an executable program.

Declared at: clang/include/clang/AST/Decl.h:2377

bool isMultiVersion() const

Description

True if this function is considered a multiversioned function.

Declared at: clang/include/clang/AST/Decl.h:2462

bool isNoReturn() const

Description

Determines whether this function is known to be 'noreturn', through an attribute on its declaration or its type.

Declared at: clang/include/clang/AST/Decl.h:2449

bool isOutOfLine() const

Description

Determine whether this is or was instantiated from an out-of-line definition of a member function.

Declared at: clang/include/clang/AST/Decl.h:2843

bool isOverloadedOperator() const

Description

Whether this function declaration represents an C++ overloaded operator, e.g., "operator+".

Declared at: clang/include/clang/AST/Decl.h:2656

bool isPure() const

Description

Whether this virtual function is pure, i.e. makes the containing class abstract.

Declared at: clang/include/clang/AST/Decl.h:2210

bool isReplaceableGlobalAllocationFunction(
    Optional<unsigned int>* AlignmentParam =
        nullptr,
    bool* IsNothrow = nullptr) const

Description

Determines whether this function is one of the replaceable global allocation functions: void *operator new(size_t); void *operator new(size_t, const std::nothrow_t & ) noexcept; void *operator new[](size_t); void *operator new[](size_t, const std::nothrow_t & ) noexcept; void operator delete(void *) noexcept; void operator delete(void *, std::size_t) noexcept; [C++1y] void operator delete(void *, const std::nothrow_t & ) noexcept; void operator delete[](void *) noexcept; void operator delete[](void *, std::size_t) noexcept; [C++1y] void operator delete[](void *, const std::nothrow_t & ) noexcept; These functions have special behavior under C++1y [expr.new]: An implementation is allowed to omit a call to a replaceable global allocation function. [...] If this function is an aligned allocation/deallocation function, return the parameter number of the requested alignment through AlignmentParam. If this function is an allocation/deallocation function that takes the `std::nothrow_t` tag, return true through IsNothrow,

Declared at: clang/include/clang/AST/Decl.h:2419

Parameters

Optional<unsigned int>* AlignmentParam = nullptr
bool* IsNothrow = nullptr

bool isReservedGlobalPlacementOperator() const

Description

Determines whether this operator new or delete is one of the reserved global placement operators: void *operator new(size_t, void *); void *operator new[](size_t, void *); void operator delete(void *, void *); void operator delete[](void *, void *); These functions have special behavior under [new.delete.placement]: These functions are reserved, a C++ program may not define functions that displace the versions in the Standard C++ library. The provisions of [basic.stc.dynamic] do not apply to these reserved placement forms of operator new and operator delete. This function must be an allocation or deallocation function.

Declared at: clang/include/clang/AST/Decl.h:2396

bool isStatic() const

Declared at: clang/include/clang/AST/Decl.h:2652

bool isTargetClonesMultiVersion() const

Description

True if this function is a multiversioned dispatch function as a part of the target-clones functionality.

Declared at: clang/include/clang/AST/Decl.h:2491

bool isTargetMultiVersion() const

Description

True if this function is a multiversioned dispatch function as a part of the target functionality.

Declared at: clang/include/clang/AST/Decl.h:2487

bool isTemplateInstantiation() const

Description

Determines if the given function was instantiated from a function template.

Declared at: clang/include/clang/AST/Decl.h:2743

bool isThisDeclarationADefinition() const

Description

Returns whether this specific declaration of the function is also a definition that does not contain uninstantiated body. This does not determine whether the function has been defined (e.g., in a previous definition); for that information, use isDefined. Note: the function declaration does not become a definition until the parser reaches the definition, if called before, this function will return `false`.

Declared at: clang/include/clang/AST/Decl.h:2171

bool isThisDeclarationInstantiatedFromAFriendDefinition()
    const

Description

Determine whether this specific declaration of the function is a friend declaration that was instantiated from a function definition. Such declarations behave like definitions in some contexts.

Declared at: clang/include/clang/AST/Decl.h:2180

bool isTrivial() const

Description

Whether this function is "trivial" in some specialized C++ senses. Can only be true for default constructors, copy constructors, copy assignment operators, and destructors. Not meaningful until the class has been fully built by Sema.

Declared at: clang/include/clang/AST/Decl.h:2227

bool isTrivialForCall() const

Declared at: clang/include/clang/AST/Decl.h:2230

bool isUserProvided() const

Description

True if this method is user-declared and was not deleted or defaulted on its first declaration.

Declared at: clang/include/clang/AST/Decl.h:2250

bool isVariadic() const

Description

Whether this function is variadic.

Declared at: clang/include/clang/AST/Decl.h:2198

bool isVirtualAsWritten() const

Description

Whether this function is marked as virtual explicitly.

Declared at: clang/include/clang/AST/Decl.h:2201

clang::FunctionDecl::param_iterator param_begin()

Declared at: clang/include/clang/AST/Decl.h:2526

clang::FunctionDecl::param_const_iterator
param_begin() const

Declared at: clang/include/clang/AST/Decl.h:2528

bool param_empty() const

Declared at: clang/include/clang/AST/Decl.h:2525

clang::FunctionDecl::param_iterator param_end()

Declared at: clang/include/clang/AST/Decl.h:2527

clang::FunctionDecl::param_const_iterator
param_end() const

Declared at: clang/include/clang/AST/Decl.h:2529

size_t param_size() const

Declared at: clang/include/clang/AST/Decl.h:2530

ArrayRef<clang::ParmVarDecl*> parameters() const

Declared at: clang/include/clang/AST/Decl.h:2514

MutableArrayRef<clang::ParmVarDecl*> parameters()

Declared at: clang/include/clang/AST/Decl.h:2517

void setBody(clang::Stmt* B)

Declared at: clang/include/clang/AST/Decl.h:2188

Parameters

clang::Stmt* B

void setConstexprKind(
    clang::ConstexprSpecKind CSK)

Declared at: clang/include/clang/AST/Decl.h:2313

Parameters

clang::ConstexprSpecKind CSK

void setDefaulted(bool D = true)

Declared at: clang/include/clang/AST/Decl.h:2236

Parameters

bool D = true

void setDefaultedFunctionInfo(
    clang::FunctionDecl::DefaultedFunctionInfo*
        Info)

Declared at: clang/include/clang/AST/Decl.h:2194

Parameters

clang::FunctionDecl::DefaultedFunctionInfo* Info

void setDeletedAsWritten(bool D = true)

Declared at: clang/include/clang/AST/Decl.h:2373

Parameters

bool D = true

void setDependentTemplateSpecialization(
    clang::ASTContext& Context,
    const clang::UnresolvedSetImpl& Templates,
    const clang::TemplateArgumentListInfo&
        TemplateArgs)

Description

Specifies that this function declaration is actually a dependent function template specialization.

Declared at: clang/include/clang/AST/Decl.h:2812

Parameters

clang::ASTContext& Context
const clang::UnresolvedSetImpl& Templates
const clang::TemplateArgumentListInfo& TemplateArgs

void setDescribedFunctionTemplate(
    clang::FunctionTemplateDecl* Template)

Declared at: clang/include/clang/AST/Decl.h:2723

Parameters

clang::FunctionTemplateDecl* Template

void setExplicitlyDefaulted(bool ED = true)

Description

State that this function is explicitly defaulted.

Declared at: clang/include/clang/AST/Decl.h:2244

Parameters

bool ED = true

void setFunctionTemplateSpecialization(
    clang::ASTContext& C,
    clang::FunctionTemplateDecl* Template,
    const clang::TemplateArgumentList*
        TemplateArgs,
    void* InsertPos,
    clang::TemplateSpecializationKind TSK,
    const clang::TemplateArgumentListInfo*
        TemplateArgsAsWritten,
    clang::SourceLocation PointOfInstantiation)

Description

Specify that this function declaration is actually a function template specialization.

Declared at: clang/include/clang/AST/Decl.h:1986

Parameters

clang::ASTContext& C
the ASTContext.
clang::FunctionTemplateDecl* Template
the function template that this function template specialization specializes.
const clang::TemplateArgumentList* TemplateArgs
the template arguments that produced this function template specialization from the template.
void* InsertPos
If non-NULL, the position in the function template specialization set where the function template specialization data will be inserted.
clang::TemplateSpecializationKind TSK
the kind of template specialization this is.
const clang::TemplateArgumentListInfo* TemplateArgsAsWritten
location info of template arguments.
clang::SourceLocation PointOfInstantiation
point at which the function template specialization was first instantiated.

void setFunctionTemplateSpecialization(
    clang::FunctionTemplateDecl* Template,
    const clang::TemplateArgumentList*
        TemplateArgs,
    void* InsertPos,
    clang::TemplateSpecializationKind TSK =
        TSK_ImplicitInstantiation,
    const clang::TemplateArgumentListInfo*
        TemplateArgsAsWritten = nullptr,
    clang::SourceLocation PointOfInstantiation =
        clang::SourceLocation())

Description

Specify that this function declaration is actually a function template specialization.

Declared at: clang/include/clang/AST/Decl.h:2799

Parameters

clang::FunctionTemplateDecl* Template
the function template that this function template specialization specializes.
const clang::TemplateArgumentList* TemplateArgs
the template arguments that produced this function template specialization from the template.
void* InsertPos
If non-NULL, the position in the function template specialization set where the function template specialization data will be inserted.
clang::TemplateSpecializationKind TSK = TSK_ImplicitInstantiation
the kind of template specialization this is.
const clang::TemplateArgumentListInfo* TemplateArgsAsWritten = nullptr
location info of template arguments.
clang::SourceLocation PointOfInstantiation = clang::SourceLocation()
point at which the function template specialization was first instantiated.

void setHasImplicitReturnZero(bool IRZ)

Description

State that falling off this function implicitly returns null/zero. If a more specific implicit return value is required, front-ends should synthesize the appropriate return statements.

Declared at: clang/include/clang/AST/Decl.h:2275

Parameters

bool IRZ

void setHasInheritedPrototype(bool P = true)

Description

State that this function inherited its prototype from a previous declaration.

Declared at: clang/include/clang/AST/Decl.h:2305

Parameters

bool P = true

void setHasODRHash(bool B = true)

Description

State that an ODRHash has been stored.

Declared at: clang/include/clang/AST/Decl.h:2010

Parameters

bool B = true

void setHasSkippedBody(bool Skipped = true)

Declared at: clang/include/clang/AST/Decl.h:2453

Parameters

bool Skipped = true

void setHasWrittenPrototype(bool P = true)

Description

State that this function has a written prototype.

Declared at: clang/include/clang/AST/Decl.h:2293

Parameters

bool P = true

void setImplicitlyInline(bool I = true)

Description

Flag that this function is implicitly inline.

Declared at: clang/include/clang/AST/Decl.h:2639

Parameters

bool I = true

void setIneligibleOrNotSelected(bool II)

Declared at: clang/include/clang/AST/Decl.h:2261

Parameters

bool II

void setInlineSpecified(bool I)

Description

Set whether the "inline" keyword was specified for this function.

Declared at: clang/include/clang/AST/Decl.h:2625

Parameters

bool I

void setInstantiatedFromDecl(
    clang::FunctionDecl* FD)

Description

Specify that this function declaration was instantiated from a FunctionDecl FD. This is only used if this is a function declaration declared locally inside of a function template.

Declared at: clang/include/clang/AST/Decl.h:2705

Parameters

clang::FunctionDecl* FD

void setInstantiationIsPending(bool IC)

Description

State that the instantiation of this function is pending. (see instantiationIsPending)

Declared at: clang/include/clang/AST/Decl.h:2338

Parameters

bool IC

void setInstantiationOfMemberFunction(
    clang::ASTContext& C,
    clang::FunctionDecl* FD,
    clang::TemplateSpecializationKind TSK)

Description

Specify that this record is an instantiation of the member function FD.

Declared at: clang/include/clang/AST/Decl.h:1996

Parameters

clang::ASTContext& C
clang::FunctionDecl* FD
clang::TemplateSpecializationKind TSK

void setInstantiationOfMemberFunction(
    clang::FunctionDecl* FD,
    clang::TemplateSpecializationKind TSK)

Description

Specify that this record is an instantiation of the member function FD.

Declared at: clang/include/clang/AST/Decl.h:2697

Parameters

clang::FunctionDecl* FD
clang::TemplateSpecializationKind TSK

void setIsMultiVersion(bool V = true)

Description

Sets the multiversion state for this declaration and all of its redeclarations.

Declared at: clang/include/clang/AST/Decl.h:2468

Parameters

bool V = true

void setLateTemplateParsed(bool ILT = true)

Description

State that this templated function will be late parsed.

Declared at: clang/include/clang/AST/Decl.h:2219

Parameters

bool ILT = true

void setLazyBody(uint64_t Offset)

Declared at: clang/include/clang/AST/Decl.h:2189

Parameters

uint64_t Offset

void setParams(
    clang::ASTContext& C,
    ArrayRef<clang::ParmVarDecl*> NewParamInfo)

Declared at: clang/include/clang/AST/Decl.h:1999

Parameters

clang::ASTContext& C
ArrayRef<clang::ParmVarDecl*> NewParamInfo

void setParams(
    ArrayRef<clang::ParmVarDecl*> NewParamInfo)

Declared at: clang/include/clang/AST/Decl.h:2545

Parameters

ArrayRef<clang::ParmVarDecl*> NewParamInfo

void setPreviousDeclaration(
    clang::FunctionDecl* PrevDecl)

Declared at: clang/include/clang/AST/Decl.h:2504

Parameters

clang::FunctionDecl* PrevDecl

void setPure(bool P = true)

Declared at: clang/include/clang/AST/Decl.h:2211

Parameters

bool P = true

void setRangeEnd(clang::SourceLocation E)

Declared at: clang/include/clang/AST/Decl.h:2077

Parameters

clang::SourceLocation E

void setStorageClass(clang::StorageClass SClass)

Description

Sets the storage class as written in the source.

Declared at: clang/include/clang/AST/Decl.h:2616

Parameters

clang::StorageClass SClass

void setTemplateSpecializationKind(
    clang::TemplateSpecializationKind TSK,
    clang::SourceLocation PointOfInstantiation =
        clang::SourceLocation())

Description

Determine what kind of template instantiation this function represents.

Declared at: clang/include/clang/AST/Decl.h:2830

Parameters

clang::TemplateSpecializationKind TSK
clang::SourceLocation PointOfInstantiation = clang::SourceLocation()

void setTrivial(bool IT)

Declared at: clang/include/clang/AST/Decl.h:2228

Parameters

bool IT

void setTrivialForCall(bool IT)

Declared at: clang/include/clang/AST/Decl.h:2231

Parameters

bool IT

void setUsesFPIntrin(bool I)

Description

Set whether the function was declared in source context that requires constrained FP intrinsics

Declared at: clang/include/clang/AST/Decl.h:2636

Parameters

bool I

void setUsesSEHTry(bool UST)

Declared at: clang/include/clang/AST/Decl.h:2344

Parameters

bool UST

void setVirtualAsWritten(bool V)

Description

State that this function is marked as virtual explicitly.

Declared at: clang/include/clang/AST/Decl.h:2206

Parameters

bool V

void setWillHaveBody(bool V = true)

Declared at: clang/include/clang/AST/Decl.h:2459

Parameters

bool V = true

bool usesSEHTry() const

Description

Indicates the function uses __try.

Declared at: clang/include/clang/AST/Decl.h:2343

bool willHaveBody() const

Description

True if this function will eventually have a body, once it's fully parsed.

Declared at: clang/include/clang/AST/Decl.h:2458