clang API Documentation

Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions
clang::CXXMethodDecl Class Reference

Represents a static or instance method of a struct/union/class. More...

#include <DeclCXX.h>

Inheritance diagram for clang::CXXMethodDecl:
Inheritance graph
[legend]
Collaboration diagram for clang::CXXMethodDecl:
Collaboration graph
[legend]

List of all members.

Public Types

typedef const CXXMethodDecl
*const * 
method_iterator

Public Member Functions

bool isStatic () const
bool isInstance () const
bool isConst () const
bool isVolatile () const
bool isVirtual () const
bool isUsualDeallocationFunction () const
 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.
bool isCopyAssignmentOperator () const
 Determine whether this is a copy-assignment operator, regardless of whether it was declared implicitly or explicitly.
bool isMoveAssignmentOperator () const
 Determine whether this is a move assignment operator.
CXXMethodDeclgetCanonicalDecl () override
 Retrieves the "canonical" declaration of the given declaration.
const CXXMethodDeclgetCanonicalDecl () const override
CXXMethodDeclgetMostRecentDecl ()
 Returns the most recent (re)declaration of this declaration.
const CXXMethodDeclgetMostRecentDecl () const
 Returns the most recent (re)declaration of this declaration.
bool isUserProvided () const
void addOverriddenMethod (const CXXMethodDecl *MD)
method_iterator begin_overridden_methods () const
method_iterator end_overridden_methods () const
unsigned size_overridden_methods () const
const CXXRecordDeclgetParent () const
CXXRecordDeclgetParent ()
QualType getThisType (ASTContext &C) const
 Returns the type of the this pointer.
unsigned getTypeQualifiers () const
RefQualifierKind getRefQualifier () const
 Retrieve the ref-qualifier associated with this method.
bool hasInlineBody () const
bool isLambdaStaticInvoker () const
 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).
CXXMethodDeclgetCorrespondingMethodInClass (const CXXRecordDecl *RD, bool MayBeBase=false)
 Find the method in RD that corresponds to this one.
const CXXMethodDeclgetCorrespondingMethodInClass (const CXXRecordDecl *RD, bool MayBeBase=false) const

Static Public Member Functions

static CXXMethodDeclCreate (ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, StorageClass SC, bool isInline, bool isConstexpr, SourceLocation EndLocation)
static CXXMethodDeclCreateDeserialized (ASTContext &C, unsigned ID)
static bool isStaticOverloadedOperator (OverloadedOperatorKind OOK)
static bool classof (const Decl *D)
static bool classofKind (Kind K)

Protected Member Functions

 CXXMethodDecl (Kind DK, ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, StorageClass SC, bool isInline, bool isConstexpr, SourceLocation EndLocation)

Detailed 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.

Definition at line 1710 of file DeclCXX.h.


Member Typedef Documentation

Definition at line 1802 of file DeclCXX.h.


Constructor & Destructor Documentation

clang::CXXMethodDecl::CXXMethodDecl ( Kind  DK,
ASTContext C,
CXXRecordDecl RD,
SourceLocation  StartLoc,
const DeclarationNameInfo NameInfo,
QualType  T,
TypeSourceInfo TInfo,
StorageClass  SC,
bool  isInline,
bool  isConstexpr,
SourceLocation  EndLocation 
) [inline, protected]

Definition at line 1713 of file DeclCXX.h.

References clang::SourceLocation::isValid(), and clang::FunctionDecl::setRangeEnd().

Referenced by Create(), and CreateDeserialized().


Member Function Documentation

static bool clang::CXXMethodDecl::classof ( const Decl D) [inline, static]

Reimplemented from clang::FunctionDecl.

Reimplemented in clang::CXXConversionDecl, clang::CXXDestructorDecl, and clang::CXXConstructorDecl.

Definition at line 1873 of file DeclCXX.h.

References classofKind(), and clang::Decl::getKind().

static bool clang::CXXMethodDecl::classofKind ( Kind  K) [inline, static]

Reimplemented from clang::FunctionDecl.

Reimplemented in clang::CXXConversionDecl, clang::CXXDestructorDecl, and clang::CXXConstructorDecl.

Definition at line 1874 of file DeclCXX.h.

Referenced by classof().

CXXMethodDecl * CXXMethodDecl::Create ( ASTContext C,
CXXRecordDecl RD,
SourceLocation  StartLoc,
const DeclarationNameInfo NameInfo,
QualType  T,
TypeSourceInfo TInfo,
StorageClass  SC,
bool  isInline,
bool  isConstexpr,
SourceLocation  EndLocation 
) [static]
CXXMethodDecl* clang::CXXMethodDecl::getCanonicalDecl ( ) [inline, override, virtual]
const CXXMethodDecl* clang::CXXMethodDecl::getCanonicalDecl ( ) const [inline, override, virtual]

Reimplemented from clang::FunctionDecl.

Reimplemented in clang::CXXConstructorDecl.

Definition at line 1781 of file DeclCXX.h.

References getCanonicalDecl().

Find the method in RD that corresponds to this one.

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

Definition at line 1404 of file DeclCXX.cpp.

References clang::CXXRecordDecl::bases(), clang::Type::getAs(), clang::CXXRecordDecl::getCanonicalDecl(), getCanonicalDecl(), clang::RecordType::getDecl(), clang::NamedDecl::getDeclName(), clang::CXXRecordDecl::getDestructor(), getParent(), clang::DeclContext::lookup(), and recursivelyOverrides().

Referenced by clang::CodeGen::CodeGenFunction::EmitCXXMemberCallExpr(), getCorrespondingMethodInClass(), clang::CXXInstanceCall::getRuntimeDefinition(), and MarkExprReferenced().

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

Definition at line 1866 of file DeclCXX.h.

References getCorrespondingMethodInClass().

Returns the most recent (re)declaration of this declaration.

Reimplemented from clang::Redeclarable< FunctionDecl >.

Definition at line 1785 of file DeclCXX.h.

Referenced by getMostRecentDecl(), and clang::ASTDeclWriter::VisitCXXMethodDecl().

Returns the most recent (re)declaration of this declaration.

Reimplemented from clang::Redeclarable< FunctionDecl >.

Definition at line 1789 of file DeclCXX.h.

References getMostRecentDecl().

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

Reimplemented from clang::DeclContext.

Definition at line 1810 of file DeclCXX.h.

Referenced by clang::Sema::ActOnFunctionDeclarator(), AddImplicitObjectParameterType(), clang::Sema::AddOverloadCandidate(), addOverriddenMethod(), clang::CodeGen::CodeGenTypes::arrangeCXXStructorDeclaration(), clang::CodeGen::CodeGenTypes::arrangeMSMemberPointerThunk(), clang::Sema::BuildBlockForLambdaConversion(), clang::Sema::BuildCallToMemberFunction(), clang::Sema::BuildCXXConstructExpr(), clang::Sema::BuildCXXMemberCallExpr(), BuildImplicitBaseInitializer(), BuildImplicitMemberInitializer(), clang::Sema::buildLambdaScope(), clang::Sema::BuildMemInitializer(), clang::CodeGen::CodeGenFunction::CanDevirtualizeMemberFunctionCall(), CanSkipVTablePointerInitialization(), clang::Sema::CheckConstexprFunctionDecl(), clang::Sema::CheckConstructorAccess(), clang::Sema::CheckDelayedMemberExceptionSpecs(), clang::Sema::CheckDestructor(), clang::Sema::CheckDestructorAccess(), clang::Sema::CheckExplicitlyDefaultedSpecialMember(), clang::Sema::CheckOverrideControl(), clang::Sema::CheckOverridingFunctionExceptionSpec(), clang::Sema::CheckPureMethod(), clang::Sema::CodeCompleteConstructorInitializer(), commonEmitCXXMemberOrOperatorCall(), compareConversionFunctions(), clang::Sema::ComputeDefaultedCopyAssignmentExceptionSpec(), clang::Sema::ComputeDefaultedCopyCtorExceptionSpec(), clang::Sema::ComputeDefaultedDefaultCtorExceptionSpec(), clang::Sema::ComputeDefaultedDtorExceptionSpec(), clang::Sema::ComputeDefaultedMoveAssignmentExceptionSpec(), clang::Sema::ComputeDefaultedMoveCtorExceptionSpec(), clang::Sema::ComputeInheritingCtorExceptionSpec(), clang::Sema::CreateOverloadedBinOp(), clang::Sema::DefineImplicitCopyAssignment(), clang::Sema::DefineImplicitCopyConstructor(), clang::Sema::DefineImplicitDefaultConstructor(), clang::Sema::DefineImplicitDestructor(), clang::Sema::DefineImplicitLambdaToBlockPointerConversion(), clang::Sema::DefineImplicitLambdaToFunctionPointerConversion(), clang::Sema::DefineImplicitMoveAssignment(), clang::Sema::DefineImplicitMoveConstructor(), clang::Sema::DefineInheritingConstructor(), clang::InitializationSequence::Diagnose(), DiagnoseBadTarget(), DiagnoseBaseOrMemInitializerOrder(), diagnoseDeprecatedCopyOperation(), clang::Sema::DiagnoseEmptyLookup(), diagnoseInstanceReference(), clang::CodeGen::CodeGenFunction::EmitCtorPrologue(), clang::CodeGen::CodeGenFunction::EmitCXXAggrConstructorCall(), clang::CodeGen::CodeGenFunction::EmitCXXConstructorCall(), emitCXXDestructor(), clang::CodeGen::CodeGenFunction::EmitCXXMemberCallExpr(), clang::CodeGen::CodeGenFunction::EmitCXXOperatorMemberCallExpr(), clang::CodeGen::CodeGenFunction::EmitDelegatingCXXConstructorCall(), clang::CodeGen::CodeGenFunction::EmitDestructorBody(), clang::CodeGen::CodeGenFunction::EmitLambdaDelegatingInvokeBody(), clang::CodeGen::CGCXXABI::EmitMemberPointer(), clang::CodeGen::CodeGenFunction::EmitNewArrayInitializer(), clang::CodeGen::CodeGenFunction::EnterDtorCleanups(), clang::Sema::FindHiddenVirtualMethods(), getCodegenToUse(), getCorrespondingMethodInClass(), GetDiagForGotoScopeDecl(), clang::ento::LikelyFalsePositiveSuppressionBRVisitor::getEndPath(), clang::CXXInstanceCall::getInitialStackFrameContents(), getNonClosureContext(), getParent(), clang::CXXInstanceCall::getRuntimeDefinition(), clang::CodeGen::CGCXXABI::getThisArgumentTypeForMethod(), getThisType(), clang::VTableContextBase::getThunkInfo(), HandleConstructorCall(), clang::Sema::InstantiateMemInitializers(), clang::Expr::isConstantInitializer(), IsConstructorDelegationValid(), isCopyAssignmentOperator(), clang::CXXConstructorDecl::isCopyOrMoveConstructor(), isCXXSharedPtrDtor(), clang::isGenericLambdaCallOperatorSpecialization(), clang::isLambdaCallOperator(), clang::isLambdaConversionOperator(), isLambdaStaticInvoker(), clang::CXXConversionDecl::isLambdaToBlockPointerConversion(), isMoveAssignmentOperator(), clang::CXXConstructorDecl::isSpecializationCopyingObject(), clang::Sema::isSpecialMemberAccessibleForDeletion(), IsStandardConversion(), mayInlineCallKind(), clang::Sema::MergeCXXFunctionDecl(), PerformConstructorInitialization(), clang::Sema::PerformMoveOrCopyInitialization(), clang::Sema::PerformObjectArgumentInitialization(), RebuildLambdaScopeInfo(), recordFixedType(), clang::Sema::SetCtorInitializers(), clang::Sema::SetDeclDefaulted(), clang::Sema::SetDelegatingInitializer(), clang::ASTContext::setNonKeyFunction(), clang::Sema::ShouldDeleteSpecialMember(), SpecializeCorrespondingLambdaCallOperatorAndInvoker(), clang::Sema::SpecialMemberIsTrivial(), clang::CodeGen::CodeGenFunction::StartFunction(), clang::CodeGen::CodeGenModule::TryEmitBaseDestructorAsAlias(), TryStaticMemberPointerUpcast(), clang::FunctionCallFilterCCC::ValidateCandidate(), and InitialOverriddenDefinitionCollector::visit().

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

Reimplemented from clang::DeclContext.

Definition at line 1816 of file DeclCXX.h.

References getParent().

Retrieve the ref-qualifier associated with this method.

In the following example, f() has an lvalue ref-qualifier, g() has an rvalue ref-qualifier, and h() has no ref-qualifier.

 struct X {
   void f() &;
   void g() &&;
   void h();
 };

Definition at line 1841 of file DeclCXX.h.

References clang::Type::getAs(), and clang::ValueDecl::getType().

Referenced by AddImplicitObjectParameterType(), clang::Sema::IsOverload(), and TryObjectArgumentInitialization().

bool clang::CXXMethodDecl::isConst ( ) const [inline]

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.

Definition at line 1597 of file DeclCXX.cpp.

References clang::CXXRecordDecl::getLambdaStaticInvoker(), getParent(), clang::FunctionDecl::getPrimaryTemplate(), clang::FunctionTemplateDecl::getTemplatedDecl(), clang::FunctionDecl::isFunctionTemplateSpecialization(), clang::CXXRecordDecl::isGenericLambda(), clang::CXXRecordDecl::isLambda(), and P.

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

Definition at line 1741 of file DeclCXX.h.

Referenced by isStatic(), and clang::Declarator::isStaticMember().

Definition at line 1752 of file DeclCXX.h.

References clang::Type::castAs(), clang::ValueDecl::getType(), and isVolatile().

Referenced by isVolatile().


The documentation for this class was generated from the following files: