clang 22.0.0git
|
Classes | |
class | AccessedEntity |
A declaration being accessed, together with information about how it was accessed. More... | |
class | AnalysisBasedWarnings |
struct | AssignedEntity |
Describes an entity that is being assigned. More... | |
class | BlockScopeInfo |
Retains information about a block that is currently being parsed. More... | |
class | Capture |
class | CapturedRegionScopeInfo |
Retains information about a captured region. More... | |
struct | CapturingEntity |
class | CapturingScopeInfo |
class | CompoundScopeInfo |
Contains information about the compound statement currently being parsed. More... | |
class | DelayedDiagnostic |
A diagnostic message which has been conditionally emitted pending the complete parsing of the current declaration. More... | |
class | DelayedDiagnosticPool |
A collection of diagnostics which were delayed. More... | |
class | FunctionScopeInfo |
Retains information about a function, method, or block that is currently being parsed. More... | |
class | LambdaScopeInfo |
class | PossiblyUnreachableDiag |
class | RISCVIntrinsicManager |
class | SemaPPCallbacks |
class | TemplateDeductionInfo |
Provides information about an attempted template argument deduction, whose success or failure was described by a TemplateDeductionResult value. More... |
Enumerations | |
enum class | FirstCoroutineStmtKind { CoReturn , CoAwait , CoYield } |
enum | PathLifetimeKind { Extend , NoExtend } |
Whether a path to an object supports lifetime extension. More... | |
enum | AnalysisResult { NotGSLPointer , Report , Abandon , Skip } |
Functions | |
static LifetimeResult | getEntityLifetime (const InitializedEntity *Entity, const InitializedEntity *InitField=nullptr) |
Determine the declaration which an initialized entity ultimately refers to, for the purpose of lifetime-extending a temporary bound to a reference in the initialization of Entity . | |
static bool | isVarOnPath (const IndirectLocalPath &Path, VarDecl *VD) |
static bool | pathContainsInit (const IndirectLocalPath &Path) |
static void | visitLocalsRetainedByInitializer (IndirectLocalPath &Path, Expr *Init, LocalVisitor Visit, bool RevisitSubinits) |
Visit the locals that would be reachable through an object initialized by the prvalue expression Init . | |
static void | visitLocalsRetainedByReferenceBinding (IndirectLocalPath &Path, Expr *Init, ReferenceKind RK, LocalVisitor Visit) |
Visit the locals that would be reachable through a reference bound to the glvalue expression Init . | |
template<typename T> | |
static bool | isRecordWithAttr (QualType Type) |
bool | isGLSPointerType (QualType QT) |
static bool | isPointerLikeType (QualType QT) |
static bool | isInStlNamespace (const Decl *D) |
static bool | isContainerOfPointer (const RecordDecl *Container) |
static bool | isContainerOfOwner (const RecordDecl *Container) |
static bool | isStdInitializerListOfPointer (const RecordDecl *RD) |
static bool | shouldTrackImplicitObjectArg (const CXXMethodDecl *Callee) |
static bool | shouldTrackFirstArgument (const FunctionDecl *FD) |
static bool | isCopyLikeConstructor (const CXXConstructorDecl *Ctor) |
static bool | shouldTrackFirstArgumentForConstructor (const CXXConstructExpr *Ctor) |
static bool | isNormalAssignmentOperator (const FunctionDecl *FD) |
static const FunctionDecl * | getDeclWithMergedLifetimeBoundAttrs (const FunctionDecl *FD) |
static const CXXMethodDecl * | getDeclWithMergedLifetimeBoundAttrs (const CXXMethodDecl *CMD) |
bool | implicitObjectParamIsLifetimeBound (const FunctionDecl *FD) |
static void | visitFunctionCallArguments (IndirectLocalPath &Path, Expr *Call, LocalVisitor Visit) |
static PathLifetimeKind | shouldLifetimeExtendThroughPath (const IndirectLocalPath &Path) |
Determine whether this is an indirect path to a temporary that we are supposed to lifetime-extend along. | |
static SourceRange | nextPathEntryRange (const IndirectLocalPath &Path, unsigned I, Expr *E) |
Find the range for the first interesting entry in the path at or after I. | |
static bool | pathOnlyHandlesGslPointer (const IndirectLocalPath &Path) |
static AnalysisResult | analyzePathForGSLPointer (const IndirectLocalPath &Path, Local L, LifetimeKind LK) |
static bool | isAssignmentOperatorLifetimeBound (const CXXMethodDecl *CMD) |
static bool | shouldRunGSLAssignmentAnalysis (const Sema &SemaRef, const AssignedEntity &Entity) |
static void | checkExprLifetimeImpl (Sema &SemaRef, const InitializedEntity *InitEntity, const InitializedEntity *ExtendingEntity, LifetimeKind LK, const AssignedEntity *AEntity, const CapturingEntity *CapEntity, Expr *Init) |
void | checkInitLifetime (Sema &SemaRef, const InitializedEntity &Entity, Expr *Init) |
Check that the lifetime of the given expr (and its subobjects) is sufficient for initializing the entity, and perform lifetime extension (when permitted) if not. | |
void | checkExprLifetimeMustTailArg (Sema &SemaRef, const InitializedEntity &Entity, Expr *Init) |
Check that the lifetime of the given expr (and its subobjects) is sufficient, assuming that it is passed as an argument to a musttail function. | |
void | checkAssignmentLifetime (Sema &SemaRef, const AssignedEntity &Entity, Expr *Init) |
Check that the lifetime of the given expr (and its subobjects) is sufficient for assigning to the entity. | |
void | checkCaptureByLifetime (Sema &SemaRef, const CapturingEntity &Entity, Expr *Init) |
Attr * | instantiateTemplateAttribute (const Attr *At, ASTContext &C, Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs) |
Attr * | instantiateTemplateAttributeForDecl (const Attr *At, ASTContext &C, Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs) |
Enumerator | |
---|---|
NotGSLPointer | |
Report | |
Abandon | |
Skip |
Definition at line 1177 of file CheckExprLifetime.cpp.
|
strong |
Enumerator | |
---|---|
CoReturn | |
CoAwait | |
CoYield |
Definition at line 100 of file ScopeInfo.h.
Whether a path to an object supports lifetime extension.
Enumerator | |
---|---|
Extend | Lifetime-extend along this path. |
NoExtend | Do not lifetime extend along this path. |
Definition at line 1099 of file CheckExprLifetime.cpp.
|
static |
Definition at line 1190 of file CheckExprLifetime.cpp.
References Abandon, clang::Type::getPointeeType(), clang::FunctionDecl::getReturnType(), clang::isa(), isGLSPointerType(), clang::Type::isPointerOrReferenceType(), isRecordWithAttr(), NotGSLPointer, pathContainsInit(), pathOnlyHandlesGslPointer(), Report, and Skip.
Referenced by checkExprLifetimeImpl().
void clang::sema::checkAssignmentLifetime | ( | Sema & | SemaRef, |
const AssignedEntity & | Entity, | ||
Expr * | Init ) |
Check that the lifetime of the given expr (and its subobjects) is sufficient for assigning to the entity.
Definition at line 1654 of file CheckExprLifetime.cpp.
References checkExprLifetimeImpl(), clang::Sema::getDiagnostics(), clang::Expr::getType(), clang::Init, clang::DiagnosticsEngine::isIgnored(), clang::sema::AssignedEntity::LHS, and shouldRunGSLAssignmentAnalysis().
Referenced by clang::Sema::CheckAssignmentOperands(), and clang::Sema::CreateOverloadedBinOp().
void clang::sema::checkCaptureByLifetime | ( | Sema & | SemaRef, |
const CapturingEntity & | Entity, | ||
Expr * | Init ) |
Definition at line 1670 of file CheckExprLifetime.cpp.
References checkExprLifetimeImpl(), clang::Sema::getDiagnostics(), clang::Init, and clang::DiagnosticsEngine::isIgnored().
Referenced by clang::Sema::checkLifetimeCaptureBy().
|
static |
Definition at line 1295 of file CheckExprLifetime.cpp.
References Abandon, clang::InitializedEntity::allocateManglingNumber(), analyzePathForGSLPointer(), clang::sema::AssignedEntity::AssignmentOperator, clang::cast(), clang::SemaBase::Diag(), clang::sema::CapturingEntity::Entity, Extend, clang::SourceRange::getBegin(), clang::InitializedEntity::getDecl(), clang::NamedDecl::getDeclName(), clang::Sema::getLangOpts(), clang::Decl::getLocation(), clang::InitializedEntity::getParent(), clang::Expr::getType(), clang::InitializedEntity::getType(), clang::ValueDecl::getType(), clang::Init, clang::isa(), isAssignmentOperatorLifetimeBound(), clang::VarDecl::isCXXForRangeImplicitVar(), clang::Decl::isImplicit(), clang::ValueDecl::isInitCapture(), isPointerLikeType(), clang::Type::isPointerType(), isRecordWithAttr(), clang::Type::isReferenceType(), clang::SourceLocation::isValid(), clang::LCK_ByRef, clang::sema::AssignedEntity::LHS, clang::Member, nextPathEntryRange(), NoExtend, NotGSLPointer, pathContainsInit(), Report, shouldLifetimeExtendThroughPath(), shouldRunGSLAssignmentAnalysis(), Skip, visitLocalsRetainedByInitializer(), and visitLocalsRetainedByReferenceBinding().
Referenced by checkAssignmentLifetime(), checkCaptureByLifetime(), checkExprLifetimeMustTailArg(), and checkInitLifetime().
void clang::sema::checkExprLifetimeMustTailArg | ( | Sema & | SemaRef, |
const InitializedEntity & | Entity, | ||
Expr * | Init ) |
Check that the lifetime of the given expr (and its subobjects) is sufficient, assuming that it is passed as an argument to a musttail function.
Definition at line 1648 of file CheckExprLifetime.cpp.
References checkExprLifetimeImpl(), and clang::Init.
void clang::sema::checkInitLifetime | ( | Sema & | SemaRef, |
const InitializedEntity & | Entity, | ||
Expr * | Init ) |
Check that the lifetime of the given expr (and its subobjects) is sufficient for initializing the entity, and perform lifetime extension (when permitted) if not.
Definition at line 1639 of file CheckExprLifetime.cpp.
References checkExprLifetimeImpl(), getEntityLifetime(), and clang::Init.
Referenced by clang::Sema::checkInitializerLifetime().
|
static |
Definition at line 535 of file CheckExprLifetime.cpp.
References getDeclWithMergedLifetimeBoundAttrs().
|
static |
Definition at line 530 of file CheckExprLifetime.cpp.
References clang::FunctionDecl::getMostRecentDecl().
Referenced by getDeclWithMergedLifetimeBoundAttrs(), implicitObjectParamIsLifetimeBound(), isAssignmentOperatorLifetimeBound(), and visitFunctionCallArguments().
|
static |
Determine the declaration which an initialized entity ultimately refers to, for the purpose of lifetime-extending a temporary bound to a reference in the initialization of Entity
.
Definition at line 66 of file CheckExprLifetime.cpp.
References clang::InitializedEntity::EK_ArrayElement, clang::InitializedEntity::EK_Base, clang::InitializedEntity::EK_Binding, clang::InitializedEntity::EK_BlockElement, clang::InitializedEntity::EK_ComplexElement, clang::InitializedEntity::EK_CompoundLiteralInit, clang::InitializedEntity::EK_Delegating, clang::InitializedEntity::EK_Exception, clang::InitializedEntity::EK_LambdaCapture, clang::InitializedEntity::EK_LambdaToBlockConversionBlockElement, clang::InitializedEntity::EK_Member, clang::InitializedEntity::EK_New, clang::InitializedEntity::EK_Parameter, clang::InitializedEntity::EK_Parameter_CF_Audited, clang::InitializedEntity::EK_ParenAggInitMember, clang::InitializedEntity::EK_RelatedResult, clang::InitializedEntity::EK_Result, clang::InitializedEntity::EK_StmtExprResult, clang::InitializedEntity::EK_TemplateParameter, clang::InitializedEntity::EK_Temporary, clang::InitializedEntity::EK_Variable, clang::InitializedEntity::EK_VectorElement, getEntityLifetime(), clang::InitializedEntity::getKind(), clang::InitializedEntity::getParent(), and clang::InitializedEntity::isDefaultMemberInitializer().
Referenced by checkInitLifetime(), and getEntityLifetime().
bool clang::sema::implicitObjectParamIsLifetimeBound | ( | const FunctionDecl * | FD | ) |
Definition at line 541 of file CheckExprLifetime.cpp.
References clang::TypeLoc::getAsAdjusted(), clang::AttributedTypeLoc::getAttrAs(), getDeclWithMergedLifetimeBoundAttrs(), clang::AttributedTypeLoc::getModifiedLoc(), clang::TypeSourceInfo::getTypeLoc(), clang::DeclaratorDecl::getTypeSourceInfo(), and isNormalAssignmentOperator().
Referenced by ProcessAPINotes(), and visitFunctionCallArguments().
Attr * clang::sema::instantiateTemplateAttribute | ( | const Attr * | At, |
ASTContext & | C, | ||
Sema & | S, | ||
const MultiLevelTemplateArgumentList & | TemplateArgs ) |
References clang::C.
Referenced by clang::Sema::InstantiateAttrs(), and clang::Sema::InstantiateClass().
Attr * clang::sema::instantiateTemplateAttributeForDecl | ( | const Attr * | At, |
ASTContext & | C, | ||
Sema & | S, | ||
const MultiLevelTemplateArgumentList & | TemplateArgs ) |
References clang::C.
Referenced by clang::Sema::InstantiateAttrsForDecl().
|
static |
Definition at line 1279 of file CheckExprLifetime.cpp.
References getDeclWithMergedLifetimeBoundAttrs(), clang::FunctionDecl::getParamDecl(), clang::Decl::hasAttr(), isNormalAssignmentOperator(), and clang::FunctionDecl::param_size().
Referenced by checkExprLifetimeImpl(), and shouldRunGSLAssignmentAnalysis().
|
static |
Definition at line 323 of file CheckExprLifetime.cpp.
References isRecordWithAttr(), and clang::TemplateArgument::Type.
Referenced by shouldTrackFirstArgumentForConstructor().
|
static |
Definition at line 312 of file CheckExprLifetime.cpp.
References isPointerLikeType(), and clang::TemplateArgument::Type.
Referenced by shouldTrackFirstArgumentForConstructor().
|
static |
Definition at line 411 of file CheckExprLifetime.cpp.
References clang::Type::getAs(), clang::FunctionDecl::getParamDecl(), clang::ValueDecl::getType(), clang::Type::hasAttr(), and clang::FunctionDecl::param_size().
Referenced by shouldTrackFirstArgumentForConstructor().
Definition at line 286 of file CheckExprLifetime.cpp.
References isRecordWithAttr().
Referenced by analyzePathForGSLPointer(), clang::Sema::inferLifetimeCaptureByAttribute(), and isPointerLikeType().
Definition at line 295 of file CheckExprLifetime.cpp.
References clang::Decl::getDeclContext(), clang::DeclContext::isStdNamespace(), and clang::isUppercase().
Referenced by isStdInitializerListOfPointer(), and shouldTrackImplicitObjectArg().
|
static |
Definition at line 510 of file CheckExprLifetime.cpp.
References clang::Decl::getASTContext(), clang::DeclarationName::getCXXOverloadedOperator(), clang::NamedDecl::getDeclName(), clang::ASTContext::getLValueReferenceType(), clang::FunctionDecl::getParamDecl(), clang::FunctionDecl::getReturnType(), clang::ValueDecl::getType(), clang::ASTContext::hasSameType(), clang::isCompoundAssignmentOperator(), and clang::Type::isLValueReferenceType().
Referenced by implicitObjectParamIsLifetimeBound(), and isAssignmentOperatorLifetimeBound().
Definition at line 288 of file CheckExprLifetime.cpp.
References isGLSPointerType(), clang::Type::isNullPtrType(), and clang::Type::isPointerType().
Referenced by checkExprLifetimeImpl(), isContainerOfPointer(), isStdInitializerListOfPointer(), and shouldTrackImplicitObjectArg().
Definition at line 258 of file CheckExprLifetime.cpp.
References clang::Type::getAsCXXRecordDecl(), clang::Result, and clang::T.
Referenced by analyzePathForGSLPointer(), checkExprLifetimeImpl(), isContainerOfOwner(), isGLSPointerType(), shouldRunGSLAssignmentAnalysis(), shouldTrackFirstArgument(), shouldTrackFirstArgumentForConstructor(), shouldTrackImplicitObjectArg(), and visitFunctionCallArguments().
|
static |
Definition at line 336 of file CheckExprLifetime.cpp.
References clang::NamedDecl::getIdentifier(), clang::NamedDecl::getName(), isInStlNamespace(), isPointerLikeType(), and clang::TemplateArgument::Type.
Referenced by shouldTrackFirstArgumentForConstructor().
Definition at line 236 of file CheckExprLifetime.cpp.
Referenced by visitLocalsRetainedByInitializer(), and visitLocalsRetainedByReferenceBinding().
|
static |
Find the range for the first interesting entry in the path at or after I.
Definition at line 1122 of file CheckExprLifetime.cpp.
References clang::cast(), and clang::Stmt::getSourceRange().
Referenced by checkExprLifetimeImpl().
|
static |
Definition at line 243 of file CheckExprLifetime.cpp.
Referenced by analyzePathForGSLPointer(), and checkExprLifetimeImpl().
|
static |
Definition at line 1158 of file CheckExprLifetime.cpp.
Referenced by analyzePathForGSLPointer().
|
static |
Determine whether this is an indirect path to a temporary that we are supposed to lifetime-extend along.
Definition at line 1109 of file CheckExprLifetime.cpp.
References Extend, and NoExtend.
Referenced by checkExprLifetimeImpl().
|
static |
Definition at line 1285 of file CheckExprLifetime.cpp.
References clang::sema::AssignedEntity::AssignmentOperator, clang::Sema::getDiagnostics(), clang::Expr::getType(), isAssignmentOperatorLifetimeBound(), clang::DiagnosticsEngine::isIgnored(), isRecordWithAttr(), and clang::sema::AssignedEntity::LHS.
Referenced by checkAssignmentLifetime(), and checkExprLifetimeImpl().
|
static |
Definition at line 385 of file CheckExprLifetime.cpp.
References clang::NamedDecl::getIdentifier(), clang::NamedDecl::getName(), clang::FunctionDecl::getNumParams(), clang::FunctionDecl::getParamDecl(), clang::Type::getPointeeCXXRecordDecl(), clang::FunctionDecl::getReturnType(), clang::ValueDecl::getType(), clang::Decl::isInStdNamespace(), clang::Type::isPointerType(), isRecordWithAttr(), and clang::Type::isReferenceType().
Referenced by visitFunctionCallArguments().
|
static |
Definition at line 432 of file CheckExprLifetime.cpp.
References clang::CXXConstructExpr::getArg(), clang::Type::getAsRecordDecl(), clang::CXXConstructExpr::getConstructor(), clang::CXXMethodDecl::getParent(), clang::FunctionDecl::getPrimaryTemplate(), clang::Expr::getType(), isContainerOfOwner(), isContainerOfPointer(), isCopyLikeConstructor(), isRecordWithAttr(), isStdInitializerListOfPointer(), and clang::FunctionDecl::param_empty().
Referenced by visitFunctionCallArguments().
|
static |
Definition at line 348 of file CheckExprLifetime.cpp.
References isInStlNamespace(), isPointerLikeType(), and isRecordWithAttr().
Referenced by visitFunctionCallArguments().
|
static |
Definition at line 561 of file CheckExprLifetime.cpp.
References clang::Call, clang::Sema::CanBeGetReturnObject(), clang::cast(), clang::Decl::getAttr(), getDeclWithMergedLifetimeBoundAttrs(), clang::FunctionDecl::getNumParams(), clang::FunctionDecl::getParamDecl(), clang::Decl::hasAttr(), clang::Expr::IgnoreImplicit(), implicitObjectParamIsLifetimeBound(), clang::isa(), isRecordWithAttr(), shouldTrackFirstArgument(), shouldTrackFirstArgumentForConstructor(), shouldTrackImplicitObjectArg(), visitLocalsRetainedByInitializer(), and visitLocalsRetainedByReferenceBinding().
Referenced by visitLocalsRetainedByInitializer(), and visitLocalsRetainedByReferenceBinding().
|
static |
Visit the locals that would be reachable through an object initialized by the prvalue expression Init
.
Definition at line 833 of file CheckExprLifetime.cpp.
References clang::C, clang::LambdaCapture::capturesVariable(), clang::cast(), clang::Init, clang::isa(), isVarOnPath(), visitFunctionCallArguments(), visitLocalsRetainedByInitializer(), and visitLocalsRetainedByReferenceBinding().
Referenced by checkExprLifetimeImpl(), visitFunctionCallArguments(), visitLocalsRetainedByInitializer(), and visitLocalsRetainedByReferenceBinding().
|
static |
Visit the locals that would be reachable through a reference bound to the glvalue expression Init
.
Definition at line 698 of file CheckExprLifetime.cpp.
References clang::C, clang::cast(), clang::Init, clang::isa(), isVarOnPath(), visitFunctionCallArguments(), visitLocalsRetainedByInitializer(), and visitLocalsRetainedByReferenceBinding().
Referenced by checkExprLifetimeImpl(), visitFunctionCallArguments(), visitLocalsRetainedByInitializer(), and visitLocalsRetainedByReferenceBinding().