class CXXMethodDecl

Declaration

class CXXMethodDecl : public FunctionDecl { /* full declaration omitted */ };

Description

Represents a static or instance method of a struct/union/class. In the terminology of the C++ Standard, these are the (static and non-static) member functions, whether virtual or not.

Declared at: clang/include/clang/AST/DeclCXX.h:1981

Inherits from: FunctionDecl

Member Variables

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 FunctionDecl:

Inherited from DeclContext:

Inherited from DeclaratorDecl:

Inherited from ValueDecl:

Inherited from NamedDecl:

Inherited from Decl:

Methods

CXXMethodDecl(
    clang::Decl::Kind DK,
    clang::ASTContext& C,
    clang::CXXRecordDecl* RD,
    clang::SourceLocation StartLoc,
    const clang::DeclarationNameInfo& NameInfo,
    clang::QualType T,
    clang::TypeSourceInfo* TInfo,
    clang::StorageClass SC,
    bool UsesFPIntrin,
    bool isInline,
    clang::ConstexprSpecKind ConstexprKind,
    clang::SourceLocation EndLocation,
    clang::Expr* TrailingRequiresClause = nullptr)

Declared at: clang/include/clang/AST/DeclCXX.h:1985

Parameters

clang::Decl::Kind DK
clang::ASTContext& C
clang::CXXRecordDecl* RD
clang::SourceLocation StartLoc
const clang::DeclarationNameInfo& NameInfo
clang::QualType T
clang::TypeSourceInfo* TInfo
clang::StorageClass SC
bool UsesFPIntrin
bool isInline
clang::ConstexprSpecKind ConstexprKind
clang::SourceLocation EndLocation
clang::Expr* TrailingRequiresClause = nullptr

static clang::CXXMethodDecl* Create(
    clang::ASTContext& C,
    clang::CXXRecordDecl* RD,
    clang::SourceLocation StartLoc,
    const clang::DeclarationNameInfo& NameInfo,
    clang::QualType T,
    clang::TypeSourceInfo* TInfo,
    clang::StorageClass SC,
    bool UsesFPIntrin,
    bool isInline,
    clang::ConstexprSpecKind ConstexprKind,
    clang::SourceLocation EndLocation,
    clang::Expr* TrailingRequiresClause = nullptr)

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

Parameters

clang::ASTContext& C
clang::CXXRecordDecl* RD
clang::SourceLocation StartLoc
const clang::DeclarationNameInfo& NameInfo
clang::QualType T
clang::TypeSourceInfo* TInfo
clang::StorageClass SC
bool UsesFPIntrin
bool isInline
clang::ConstexprSpecKind ConstexprKind
clang::SourceLocation EndLocation
clang::Expr* TrailingRequiresClause = nullptr

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

Declared at: clang/include/clang/AST/DeclCXX.h:2005

Parameters

clang::ASTContext& C
unsigned int ID

void addOverriddenMethod(
    const clang::CXXMethodDecl* MD)

Declared at: clang/include/clang/AST/DeclCXX.h:2081

Parameters

const clang::CXXMethodDecl* MD

void anchor()

Declared at: clang/include/clang/AST/DeclCXX.h:1982

clang::CXXMethodDecl::method_iterator
begin_overridden_methods() const

Declared at: clang/include/clang/AST/DeclCXX.h:2085

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

Declared at: clang/include/clang/AST/DeclCXX.h:2184

Parameters

const clang::Decl* D

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

Declared at: clang/include/clang/AST/DeclCXX.h:2185

Parameters

clang::Decl::Kind K

clang::CXXMethodDecl::method_iterator
end_overridden_methods() const

Declared at: clang/include/clang/AST/DeclCXX.h:2086

clang::CXXMethodDecl* getCanonicalDecl()

Description

Retrieves the "canonical" declaration of the given declaration.

Declared at: clang/include/clang/AST/DeclCXX.h:2066

const clang::CXXMethodDecl* getCanonicalDecl()
    const

Declared at: clang/include/clang/AST/DeclCXX.h:2069

const clang::CXXMethodDecl*
getCorrespondingMethodDeclaredInClass(
    const clang::CXXRecordDecl* RD,
    bool MayBeBase = false) const

Declared at: clang/include/clang/AST/DeclCXX.h:2177

Parameters

const clang::CXXRecordDecl* RD
bool MayBeBase = false

clang::CXXMethodDecl*
getCorrespondingMethodDeclaredInClass(
    const clang::CXXRecordDecl* RD,
    bool MayBeBase = false)

Description

Find if \p RD declares a function that overrides this function, and if so, return it. Does not search base classes.

Declared at: clang/include/clang/AST/DeclCXX.h:2174

Parameters

const clang::CXXRecordDecl* RD
bool MayBeBase = false

const clang::CXXMethodDecl*
getCorrespondingMethodInClass(
    const clang::CXXRecordDecl* RD,
    bool MayBeBase = false) const

Declared at: clang/include/clang/AST/DeclCXX.h:2166

Parameters

const clang::CXXRecordDecl* RD
bool MayBeBase = false

clang::CXXMethodDecl*
getCorrespondingMethodInClass(
    const clang::CXXRecordDecl* RD,
    bool MayBeBase = false)

Description

Find the method in \p RD that corresponds to this one. Find if \p RD or one of the classes it inherits from override this method. If so, return it. \p RD is assumed to be a subclass of the class defining this method (or be the class itself), unless \p MayBeBase is set to true.

Declared at: clang/include/clang/AST/DeclCXX.h:2162

Parameters

const clang::CXXRecordDecl* RD
bool MayBeBase = false

clang::CXXMethodDecl* getDevirtualizedMethod(
    const clang::Expr* Base,
    bool IsAppleKext)

Declared at: clang/include/clang/AST/DeclCXX.h:2041

Parameters

const clang::Expr* Base
The object on which this virtual function is called.
bool IsAppleKext
True if we are compiling for Apple kext.

const clang::CXXMethodDecl*
getDevirtualizedMethod(const clang::Expr* Base,
                       bool IsAppleKext) const

Declared at: clang/include/clang/AST/DeclCXX.h:2043

Parameters

const clang::Expr* Base
bool IsAppleKext

clang::Qualifiers getMethodQualifiers() const

Declared at: clang/include/clang/AST/DeclCXX.h:2126

clang::CXXMethodDecl* getMostRecentDecl()

Declared at: clang/include/clang/AST/DeclCXX.h:2073

const clang::CXXMethodDecl* getMostRecentDecl()
    const

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

const clang::CXXRecordDecl* getParent() const

Description

Return the parent of this method declaration, which is the class in which this method is defined.

Declared at: clang/include/clang/AST/DeclCXX.h:2096

clang::CXXRecordDecl* getParent()

Description

Return the parent of this method declaration, which is the class in which this method is defined.

Declared at: clang/include/clang/AST/DeclCXX.h:2102

clang::RefQualifierKind getRefQualifier() const

Description

Retrieve the ref-qualifier associated with this method. In the following example, \c f() has an lvalue ref-qualifier, \c g() has an rvalue ref-qualifier, and \c h() has no ref-qualifier.

Declared at: clang/include/clang/AST/DeclCXX.h:2141

static clang::QualType getThisObjectType(
    const clang::FunctionProtoType* FPT,
    const clang::CXXRecordDecl* Decl)

Declared at: clang/include/clang/AST/DeclCXX.h:2123

Parameters

const clang::FunctionProtoType* FPT
const clang::CXXRecordDecl* Decl

clang::QualType getThisObjectType() const

Description

Return the type of the object pointed by \c this. See getThisType() for usage restriction.

Declared at: clang/include/clang/AST/DeclCXX.h:2118

clang::QualType getThisType() const

Description

Return the type of the \c this pointer. Should only be called for instance (i.e., non-static) methods. Note that for the call operator of a lambda closure type, this returns the desugared 'this' type (a pointer to the closure type), not the captured 'this' type.

Declared at: clang/include/clang/AST/DeclCXX.h:2113

static clang::QualType getThisType(
    const clang::FunctionProtoType* FPT,
    const clang::CXXRecordDecl* Decl)

Declared at: clang/include/clang/AST/DeclCXX.h:2120

Parameters

const clang::FunctionProtoType* FPT
const clang::CXXRecordDecl* Decl

bool hasInlineBody() const

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

bool isConst() const

Declared at: clang/include/clang/AST/DeclCXX.h:2022

bool isCopyAssignmentOperator() const

Description

Determine whether this is a copy-assignment operator, regardless of whether it was declared implicitly or explicitly.

Declared at: clang/include/clang/AST/DeclCXX.h:2061

bool isInstance() const

Declared at: clang/include/clang/AST/DeclCXX.h:2008

bool isLambdaStaticInvoker() const

Description

Determine whether this is a lambda closure type's static member function that is used for the result of the lambda's conversion to function pointer (for a lambda with no captures). The function itself, if used, will have a placeholder body that will be supplied by IR generation to either forward to the function call operator or clone the function call operator.

Declared at: clang/include/clang/AST/DeclCXX.h:2154

bool isMoveAssignmentOperator() const

Description

Determine whether this is a move assignment operator.

Declared at: clang/include/clang/AST/DeclCXX.h:2064

bool isStatic() const

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

static bool isStaticOverloadedOperator(
    clang::OverloadedOperatorKind OOK)

Description

Returns true if the given operator is implicitly static in a record context.

Declared at: clang/include/clang/AST/DeclCXX.h:2012

Parameters

clang::OverloadedOperatorKind OOK

bool isUsualDeallocationFunction(
    SmallVectorImpl<const clang::FunctionDecl*>&
        PreventedBy) const

Description

Determine whether this is a usual deallocation function (C++ [basic.stc.dynamic.deallocation]p2), which is an overloaded delete or delete[] operator with a particular signature. Populates \p PreventedBy with the declarations of the functions of the same kind if they were the reason for this function returning false. This is used by Sema::isUsualDeallocationFunction to reconsider the answer based on the context.

Declared at: clang/include/clang/AST/DeclCXX.h:2056

Parameters

SmallVectorImpl<const clang::FunctionDecl*>& PreventedBy

bool isVirtual() const

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

bool isVolatile() const

Declared at: clang/include/clang/AST/DeclCXX.h:2023

clang::CXXMethodDecl::overridden_method_range
overridden_methods() const

Declared at: clang/include/clang/AST/DeclCXX.h:2092

unsigned int size_overridden_methods() const

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