clang API Documentation
#include <DeclCXX.h>


Public Types | |
| typedef const CXXMethodDecl ** | method_iterator |
Public Member Functions | |
| bool | isStatic () const |
| bool | isInstance () 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. | |
| const CXXMethodDecl * | getCanonicalDecl () const |
| CXXMethodDecl * | getCanonicalDecl () |
| Retrieves the "canonical" declaration of the given 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 CXXRecordDecl * | getParent () const |
| CXXRecordDecl * | getParent () |
| QualType | getThisType (ASTContext &C) const |
| unsigned | getTypeQualifiers () const |
| RefQualifierKind | getRefQualifier () const |
| Retrieve the ref-qualifier associated with this method. | |
| bool | hasInlineBody () const |
Static Public Member Functions | |
| static CXXMethodDecl * | Create (ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, bool isStatic, StorageClass SCAsWritten, bool isInline, bool isConstexpr, SourceLocation EndLocation) |
| static CXXMethodDecl * | CreateDeserialized (ASTContext &C, unsigned ID) |
| static bool | classof (const Decl *D) |
| static bool | classof (const CXXMethodDecl *D) |
| static bool | classofKind (Kind K) |
Protected Member Functions | |
| CXXMethodDecl (Kind DK, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, bool isStatic, StorageClass SCAsWritten, bool isInline, bool isConstexpr, SourceLocation EndLocation) | |
CXXMethodDecl - Represents a static or instance method of a struct/union/class.
| typedef const CXXMethodDecl** clang::CXXMethodDecl::method_iterator |
| clang::CXXMethodDecl::CXXMethodDecl | ( | Kind | DK, |
| CXXRecordDecl * | RD, | ||
| SourceLocation | StartLoc, | ||
| const DeclarationNameInfo & | NameInfo, | ||
| QualType | T, | ||
| TypeSourceInfo * | TInfo, | ||
| bool | isStatic, | ||
| StorageClass | SCAsWritten, | ||
| bool | isInline, | ||
| bool | isConstexpr, | ||
| SourceLocation | EndLocation | ||
| ) | [inline, protected] |
Definition at line 1410 of file DeclCXX.h.
References clang::SourceLocation::isValid(), and clang::FunctionDecl::setRangeEnd().
Referenced by Create(), and CreateDeserialized().
| void CXXMethodDecl::addOverriddenMethod | ( | const CXXMethodDecl * | MD | ) |
Definition at line 1387 of file DeclCXX.cpp.
References clang::ASTContext::addOverriddenMethod(), clang::Decl::getASTContext(), getParent(), clang::Decl::isCanonicalDecl(), and clang::DeclContext::isDependentContext().
Referenced by clang::Sema::AddOverriddenMethods(), and clang::CXXConstructorDecl::setInheritedConstructor().
| CXXMethodDecl::method_iterator CXXMethodDecl::begin_overridden_methods | ( | ) | const |
Definition at line 1395 of file DeclCXX.cpp.
References clang::Decl::getASTContext(), and clang::ASTContext::overridden_methods_begin().
Referenced by clang::Sema::CheckConstexprFunctionDecl(), clang::Sema::CheckFunctionDeclaration(), clang::Sema::CheckOverrideControl(), clang::Sema::DiagnoseHiddenVirtualMethods(), clang::CXXConstructorDecl::getInheritedConstructor(), isVirtual(), MaybeAddOverrideCalls(), and clang::ASTDeclWriter::VisitCXXMethodDecl().
| 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 1521 of file DeclCXX.h.
References classofKind(), and clang::Decl::getKind().
| static bool clang::CXXMethodDecl::classof | ( | const CXXMethodDecl * | D | ) | [inline, static] |
| 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 1523 of file DeclCXX.h.
Referenced by classof().
| CXXMethodDecl * CXXMethodDecl::Create | ( | ASTContext & | C, |
| CXXRecordDecl * | RD, | ||
| SourceLocation | StartLoc, | ||
| const DeclarationNameInfo & | NameInfo, | ||
| QualType | T, | ||
| TypeSourceInfo * | TInfo, | ||
| bool | isStatic, | ||
| StorageClass | SCAsWritten, | ||
| bool | isInline, | ||
| bool | isConstexpr, | ||
| SourceLocation | EndLocation | ||
| ) | [static] |
Definition at line 1287 of file DeclCXX.cpp.
References CXXMethodDecl().
Referenced by clang::Sema::ActOnStartOfLambdaDefinition(), CreateNewFunctionDecl(), clang::Sema::DeclareImplicitCopyAssignment(), clang::Sema::DeclareImplicitMoveAssignment(), clang::TemplateDeclInstantiator::VisitCXXMethodDecl(), and clang::ASTNodeImporter::VisitFunctionDecl().
| CXXMethodDecl * CXXMethodDecl::CreateDeserialized | ( | ASTContext & | C, |
| unsigned | ID | ||
| ) | [static] |
Reimplemented from clang::FunctionDecl.
Reimplemented in clang::CXXConversionDecl, clang::CXXDestructorDecl, and clang::CXXConstructorDecl.
Definition at line 1298 of file DeclCXX.cpp.
References clang::Decl::AllocateDeserializedDecl(), CXXMethodDecl(), and clang::SC_None.
| CXXMethodDecl::method_iterator CXXMethodDecl::end_overridden_methods | ( | ) | const |
Definition at line 1399 of file DeclCXX.cpp.
References clang::Decl::getASTContext(), and clang::ASTContext::overridden_methods_end().
Referenced by clang::Sema::CheckOverrideControl(), clang::Sema::DiagnoseHiddenVirtualMethods(), clang::CXXConstructorDecl::getInheritedConstructor(), isVirtual(), MaybeAddOverrideCalls(), and clang::ASTDeclWriter::VisitCXXMethodDecl().
| const CXXMethodDecl* clang::CXXMethodDecl::getCanonicalDecl | ( | ) | const [inline, virtual] |
Reimplemented from clang::FunctionDecl.
Reimplemented in clang::CXXConstructorDecl.
Definition at line 1460 of file DeclCXX.h.
Referenced by clang::CodeGen::CodeGenFunction::BuildAppleKextVirtualCall(), clang::CodeGen::CodeGenFunction::BuildAppleKextVirtualDestructorCall(), clang::CodeGen::CodeGenFunction::BuildVirtualCall(), clang::Sema::CheckExplicitlyDefaultedCopyAssignment(), clang::Sema::CheckExplicitlyDefaultedDestructor(), clang::Sema::CheckExplicitlyDefaultedMoveAssignment(), clang::ASTContext::DeclMustBeEmitted(), clang::Sema::DiagnoseHiddenVirtualMethods(), getCanonicalDecl(), isUserProvided(), isVirtual(), and MaybeAddOverrideCalls().
| CXXMethodDecl* clang::CXXMethodDecl::getCanonicalDecl | ( | ) | [inline, virtual] |
Retrieves the "canonical" declaration of the given declaration.
Reimplemented from clang::FunctionDecl.
Reimplemented in clang::CXXConstructorDecl.
Definition at line 1463 of file DeclCXX.h.
References getCanonicalDecl().
| const CXXRecordDecl* clang::CXXMethodDecl::getParent | ( | ) | const [inline] |
getParent - Returns the parent of this method declaration, which is the class in which this method is defined.
Reimplemented from clang::DeclContext.
Definition at line 1484 of file DeclCXX.h.
Referenced by clang::Sema::ActOnFields(), addOverriddenMethod(), clang::Sema::BuildCallToMemberFunction(), clang::Sema::BuildCXXConstructExpr(), clang::Sema::BuildCXXNew(), BuildImplicitMemberInitializer(), clang::Sema::BuildMemInitializer(), canDevirtualizeMemberFunctionCall(), canDevirtualizeMemberFunctionCalls(), CanSkipVTablePointerInitialization(), clang::Sema::CheckConstructorAccess(), clang::Sema::CheckDestructor(), clang::Sema::CheckDestructorAccess(), clang::Sema::CheckExplicitlyDefaultedCopyAssignment(), clang::Sema::CheckExplicitlyDefaultedCopyConstructor(), clang::Sema::CheckExplicitlyDefaultedDefaultConstructor(), clang::Sema::CheckExplicitlyDefaultedDestructor(), clang::Sema::CheckExplicitlyDefaultedMoveAssignment(), clang::Sema::CheckExplicitlyDefaultedMoveConstructor(), clang::Sema::CheckOverridingFunctionExceptionSpec(), clang::Sema::CheckPureMethod(), clang::Sema::CodeCompleteConstructorInitializer(), clang::Sema::DefineImplicitCopyAssignment(), clang::Sema::DefineImplicitCopyConstructor(), clang::Sema::DefineImplicitDefaultConstructor(), clang::Sema::DefineImplicitDestructor(), clang::Sema::DefineImplicitMoveAssignment(), clang::Sema::DefineImplicitMoveConstructor(), clang::InitializationSequence::Diagnose(), DiagnoseBaseOrMemInitializerOrder(), clang::Sema::DiagnoseEmptyLookup(), clang::CodeGen::CodeGenFunction::EmitCtorPrologue(), clang::CodeGen::CodeGenFunction::EmitCXXAggrConstructorCall(), clang::CodeGen::CodeGenFunction::EmitCXXConstructorCall(), clang::CodeGen::CodeGenFunction::EmitCXXDestructorCall(), clang::CodeGen::CodeGenFunction::EmitDelegatingCXXConstructorCall(), clang::CodeGen::CodeGenFunction::EmitDestructorBody(), clang::CodeGen::CGCXXABI::EmitMemberPointer(), clang::CodeGen::CodeGenFunction::EnterDtorCleanups(), GetDiagForGotoScopeDecl(), clang::CodeGen::CodeGenTypes::getFunctionInfo(), getParent(), getThisType(), clang::VTableContext::getThunkInfo(), HandleConstructorCall(), clang::Sema::InstantiateMemInitializers(), IsConstructorDelegationValid(), isCopyAssignmentOperator(), clang::CXXConstructorDecl::isCopyOrMoveConstructor(), isMoveAssignmentOperator(), clang::Expr::isPotentialConstantExpr(), clang::CXXConstructorDecl::isSpecializationCopyingObject(), clang::IsStandardConversion(), MaybeAddImplicitObjectParameterType(), clang::Sema::MergeCXXFunctionDecl(), clang::CodeGen::CodeGenVTables::needsVTTParameter(), PerformConstructorInitialization(), clang::Sema::PerformMoveOrCopyInitialization(), clang::Sema::PerformObjectArgumentInitialization(), clang::Sema::SetCtorInitializers(), clang::Sema::SetDeclDefaulted(), clang::Sema::SetDelegatingInitializer(), clang::Sema::ShouldDeleteCopyAssignmentOperator(), clang::Sema::ShouldDeleteDestructor(), clang::Sema::ShouldDeleteMoveAssignmentOperator(), clang::Sema::ShouldDeleteSpecialMember(), TryStaticMemberPointerUpcast(), clang::ento::ExprEngine::VisitCXXConstructExpr(), and clang::ento::ExprEngine::VisitCXXDestructor().
| CXXRecordDecl* clang::CXXMethodDecl::getParent | ( | ) | [inline] |
getParent - Returns the parent of this method declaration, which is the class in which this method is defined.
Reimplemented from clang::DeclContext.
Definition at line 1490 of file DeclCXX.h.
References getParent().
| RefQualifierKind clang::CXXMethodDecl::getRefQualifier | ( | ) | const [inline] |
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 1514 of file DeclCXX.h.
References clang::ValueDecl::getType().
Referenced by clang::Sema::IsOverload(), and clang::TryObjectArgumentInitialization().
| QualType CXXMethodDecl::getThisType | ( | ASTContext & | C | ) | const |
getThisType - Returns the type of 'this' pointer. Should only be called for instance methods.
Definition at line 1407 of file DeclCXX.cpp.
References clang::Qualifiers::fromCVRMask(), getParent(), clang::ASTContext::getPointerType(), clang::ASTContext::getQualifiedType(), clang::ASTContext::getTypeDeclType(), getTypeQualifiers(), and isInstance().
Referenced by clang::CodeGen::CGCXXABI::BuildThisParam(), clang::CodeGen::CodeGenFunction::EmitCXXMemberCall(), clang::CodeGen::CGDebugInfo::EmitDeclareOfBlockLiteralArgVariable(), clang::CodeGen::CodeGenFunction::EmitSynthesizedCXXCopyCtorCall(), clang::CodeGen::CodeGenFunction::GenerateThunk(), clang::ento::ExprEngine::getCXXThisRegion(), isAtLeastAsSpecializedAs(), and clang::Sema::PerformObjectArgumentInitialization().
| unsigned clang::CXXMethodDecl::getTypeQualifiers | ( | ) | const [inline] |
Definition at line 1499 of file DeclCXX.h.
References clang::ValueDecl::getType().
Referenced by clang::Sema::ActOnStartOfLambdaDefinition(), clang::Sema::DefineImplicitCopyAssignment(), clang::Sema::DefineImplicitMoveAssignment(), getThisType(), clang::Sema::IsOverload(), MaybeAddImplicitObjectParameterType(), and clang::TryObjectArgumentInitialization().
| bool CXXMethodDecl::hasInlineBody | ( | ) | const |
Definition at line 1422 of file DeclCXX.cpp.
References clang::FunctionDecl::getTemplateInstantiationPattern(), clang::FunctionDecl::hasBody(), and clang::FunctionDecl::isOutOfLine().
| bool CXXMethodDecl::isCopyAssignmentOperator | ( | ) | const |
Determine whether this is a copy-assignment operator, regardless of whether it was declared implicitly or explicitly.
Definition at line 1347 of file DeclCXX.cpp.
References clang::Decl::getASTContext(), clang::ASTContext::getCanonicalType(), clang::FunctionDecl::getDescribedFunctionTemplate(), clang::FunctionDecl::getOverloadedOperator(), clang::FunctionDecl::getParamDecl(), getParent(), clang::FunctionDecl::getPrimaryTemplate(), clang::ValueDecl::getType(), clang::ASTContext::getTypeDeclType(), clang::ASTContext::hasSameUnqualifiedType(), and isStatic().
Referenced by BuildSingleCopyAssign(), clang::CodeGen::CodeGenFunction::EmitCXXOperatorMemberCallExpr(), EvaluateUnaryTypeTrait(), and clang::Sema::getSpecialMember().
| bool clang::CXXMethodDecl::isInstance | ( | ) | const [inline] |
Definition at line 1436 of file DeclCXX.h.
References isStatic().
Referenced by clang::Sema::DiagnoseEmptyLookup(), clang::CodeGen::CodeGenFunction::EmitCXXMemberCall(), clang::CodeGen::CodeGenFunction::EmitCXXOperatorMemberCallExpr(), clang::CodeGen::CodeGenFunction::EmitSynthesizedCXXCopyCtorCall(), clang::CodeGen::CodeGenTypes::getFunctionInfo(), getThisType(), and clang::Expr::isPotentialConstantExpr().
| bool CXXMethodDecl::isMoveAssignmentOperator | ( | ) | const |
Determine whether this is a move assignment operator.
Definition at line 1367 of file DeclCXX.cpp.
References clang::Decl::getASTContext(), clang::ASTContext::getCanonicalType(), clang::FunctionDecl::getDescribedFunctionTemplate(), clang::FunctionDecl::getOverloadedOperator(), clang::FunctionDecl::getParamDecl(), getParent(), clang::FunctionDecl::getPrimaryTemplate(), clang::ValueDecl::getType(), clang::ASTContext::getTypeDeclType(), clang::ASTContext::hasSameUnqualifiedType(), and isStatic().
Referenced by BuildSingleCopyAssign(), clang::CodeGen::CodeGenFunction::EmitCXXOperatorMemberCallExpr(), clang::Sema::getSpecialMember(), and clang::Sema::ShouldDeleteMoveAssignmentOperator().
| bool clang::CXXMethodDecl::isStatic | ( | ) | const [inline] |
Definition at line 1435 of file DeclCXX.h.
References clang::FunctionDecl::getStorageClass(), and clang::SC_Static.
Referenced by clang::Sema::AddMethodCandidate(), clang::Sema::BuildCallToMemberFunction(), clang::CXXRecordDecl::getCopyAssignmentOperator(), isAtLeastAsSpecializedAs(), isCopyAssignmentOperator(), isInstance(), isMoveAssignmentOperator(), clang::Sema::IsOverload(), clang::IsStandardConversion(), MaybeAddImplicitObjectParameterType(), clang::Sema::MergeFunctionDecl(), and clang::TemplateDeclInstantiator::VisitCXXMethodDecl().
| bool clang::CXXMethodDecl::isUserProvided | ( | ) | const [inline] |
isUserProvided - True if it is either an implicit constructor or if it was defaulted or deleted on first declaration.
Definition at line 1469 of file DeclCXX.h.
References getCanonicalDecl(), clang::FunctionDecl::isDefaulted(), and clang::FunctionDecl::isDeleted().
Referenced by clang::Sema::RequireLiteralType().
| bool CXXMethodDecl::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.
Definition at line 1306 of file DeclCXX.cpp.
References clang::Decl::getASTContext(), clang::Decl::getDeclContext(), clang::NamedDecl::getDeclName(), clang::FunctionDecl::getNumParams(), clang::FunctionDecl::getOverloadedOperator(), clang::FunctionDecl::getParamDecl(), clang::FunctionDecl::getPrimaryTemplate(), clang::ASTContext::getSizeType(), clang::ValueDecl::getType(), clang::ASTContext::hasSameUnqualifiedType(), and clang::DeclContext::lookup().
| bool clang::CXXMethodDecl::isVirtual | ( | ) | const [inline] |
Definition at line 1438 of file DeclCXX.h.
References begin_overridden_methods(), end_overridden_methods(), getCanonicalDecl(), and clang::FunctionDecl::isVirtualAsWritten().
Referenced by clang::Sema::ActOnCXXDelete(), clang::Sema::ActOnCXXMemberDeclarator(), clang::CodeGen::CodeGenFunction::BuildAppleKextVirtualDestructorCall(), clang::Sema::CheckCompletedCXXClass(), clang::Sema::CheckConstexprFunctionDecl(), clang::Sema::CheckDestructor(), clang::Sema::CheckOverrideControl(), clang::Sema::CheckPureMethod(), EmitObjectDelete(), clang::Sema::MarkVirtualMembersReferenced(), MaybeAddOverrideCalls(), clang::Sema::ShouldDeleteDestructor(), and UseVirtualCall().
| unsigned CXXMethodDecl::size_overridden_methods | ( | ) | const |
Definition at line 1403 of file DeclCXX.cpp.
References clang::Decl::getASTContext(), and clang::ASTContext::overridden_methods_size().
Referenced by clang::CXXConstructorDecl::setInheritedConstructor(), and clang::ASTDeclWriter::VisitCXXMethodDecl().