clang 20.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... | |
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 , ShouldExtend , NoExtend } |
Whether a path to an object supports lifetime extension. More... | |
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 (IndirectLocalPath &Path, VarDecl *VD) |
static bool | pathContainsInit (IndirectLocalPath &Path) |
static void | visitLocalsRetainedByInitializer (IndirectLocalPath &Path, Expr *Init, LocalVisitor Visit, bool RevisitSubinits, bool EnableLifetimeWarnings) |
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, bool EnableLifetimeWarnings) |
Visit the locals that would be reachable through a reference bound to the glvalue expression Init . | |
template<typename T > | |
static bool | isRecordWithAttr (QualType Type) |
static bool | isInStlNamespace (const Decl *D) |
static bool | shouldTrackImplicitObjectArg (const CXXMethodDecl *Callee) |
static bool | shouldTrackFirstArgument (const FunctionDecl *FD) |
static void | handleGslAnnotatedTypes (IndirectLocalPath &Path, Expr *Call, LocalVisitor Visit) |
static bool | implicitObjectParamIsLifetimeBound (const FunctionDecl *FD) |
static void | visitLifetimeBoundArguments (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 (IndirectLocalPath &Path) |
static void | checkExprLifetimeImpl (Sema &SemaRef, const InitializedEntity *InitEntity, const InitializedEntity *ExtendingEntity, LifetimeKind LK, const AssignedEntity *AEntity, Expr *Init, bool EnableLifetimeWarnings) |
void | checkExprLifetime (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 | checkExprLifetime (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. | |
Attr * | instantiateTemplateAttribute (const Attr *At, ASTContext &C, Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs) |
Attr * | instantiateTemplateAttributeForDecl (const Attr *At, ASTContext &C, Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs) |
|
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. |
ShouldExtend | We should lifetime-extend, but we don't because (due to technical limitations) we can't. This happens for default member initializers, which we don't clone for every use, so we don't have a unique MaterializeTemporaryExpr to update. |
NoExtend | Do not lifetime extend along this path. |
Definition at line 912 of file CheckExprLifetime.cpp.
void clang::sema::checkExprLifetime | ( | 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 1313 of file CheckExprLifetime.cpp.
References checkExprLifetime(), checkExprLifetimeImpl(), clang::Sema::getDiagnostics(), clang::Expr::getType(), clang::DiagnosticsEngine::isIgnored(), clang::Type::isPointerType(), and clang::sema::AssignedEntity::LHS.
void clang::sema::checkExprLifetime | ( | 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 1302 of file CheckExprLifetime.cpp.
References checkExprLifetime(), checkExprLifetimeImpl(), clang::Sema::getDiagnostics(), getEntityLifetime(), and clang::DiagnosticsEngine::isIgnored().
Referenced by clang::Sema::CheckAssignmentOperands(), checkExprLifetime(), clang::Sema::checkInitializerLifetime(), and clang::Sema::CreateOverloadedBinOp().
|
static |
Definition at line 988 of file CheckExprLifetime.cpp.
References clang::InitializedEntity::allocateManglingNumber(), clang::SemaBase::Diag(), Extend, clang::SourceRange::getBegin(), clang::InitializedEntity::getDecl(), clang::NamedDecl::getDeclName(), clang::Sema::getLangOpts(), clang::Decl::getLocation(), clang::InitializedEntity::getParent(), clang::ValueDecl::getType(), clang::Expr::getType(), clang::InitializedEntity::getType(), clang::Init, clang::Decl::isImplicit(), clang::ValueDecl::isInitCapture(), clang::Type::isReferenceType(), clang::SourceLocation::isValid(), clang::LCK_ByRef, clang::sema::AssignedEntity::LHS, clang::Member, nextPathEntryRange(), NoExtend, Path, pathContainsInit(), pathOnlyHandlesGslPointer(), ShouldExtend, and shouldLifetimeExtendThroughPath().
Referenced by checkExprLifetime().
|
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 57 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 checkExprLifetime(), and getEntityLifetime().
|
static |
Definition at line 329 of file CheckExprLifetime.cpp.
References clang::Call, D, clang::DeclContext::getParent(), clang::Decl::hasAttr(), Path, shouldTrackFirstArgument(), shouldTrackImplicitObjectArg(), visitLocalsRetainedByInitializer(), and visitLocalsRetainedByReferenceBinding().
Referenced by visitLocalsRetainedByInitializer(), and visitLocalsRetainedByReferenceBinding().
|
static |
Definition at line 389 of file CheckExprLifetime.cpp.
References clang::TypeLoc::getAsAdjusted(), clang::Decl::getASTContext(), clang::AttributedTypeLoc::getAttrAs(), clang::DeclarationName::getCXXOverloadedOperator(), clang::NamedDecl::getDeclName(), clang::ASTContext::getLValueReferenceType(), clang::AttributedTypeLoc::getModifiedLoc(), clang::FunctionDecl::getReturnType(), clang::TypeSourceInfo::getTypeLoc(), clang::DeclaratorDecl::getTypeSourceInfo(), clang::ASTContext::hasSameType(), clang::isCompoundAssignmentOperator(), and clang::Type::isLValueReferenceType().
Referenced by visitLifetimeBoundArguments().
Attr * clang::sema::instantiateTemplateAttribute | ( | const Attr * | At, |
ASTContext & | C, | ||
Sema & | S, | ||
const MultiLevelTemplateArgumentList & | TemplateArgs | ||
) |
Referenced by clang::Sema::InstantiateAttrs(), and clang::Sema::InstantiateClass().
Attr * clang::sema::instantiateTemplateAttributeForDecl | ( | const Attr * | At, |
ASTContext & | C, | ||
Sema & | S, | ||
const MultiLevelTemplateArgumentList & | TemplateArgs | ||
) |
Referenced by clang::Sema::InstantiateAttrsForDecl().
Definition at line 257 of file CheckExprLifetime.cpp.
References D, clang::DeclContext::isStdNamespace(), and clang::isUppercase().
Referenced by shouldTrackImplicitObjectArg().
Definition at line 248 of file CheckExprLifetime.cpp.
References clang::Type::getAsCXXRecordDecl(), and clang::T.
Definition at line 224 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 939 of file CheckExprLifetime.cpp.
References D, E, Kind, and Path.
Referenced by checkExprLifetimeImpl().
|
static |
Definition at line 231 of file CheckExprLifetime.cpp.
Referenced by checkExprLifetimeImpl().
|
static |
Definition at line 970 of file CheckExprLifetime.cpp.
References Path.
Referenced by checkExprLifetimeImpl().
|
static |
Determine whether this is an indirect path to a temporary that we are supposed to lifetime-extend along.
Definition at line 927 of file CheckExprLifetime.cpp.
References Extend, Kind, NoExtend, Path, and ShouldExtend.
Referenced by checkExprLifetimeImpl().
|
static |
Definition at line 306 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(), and clang::Type::isReferenceType().
Referenced by handleGslAnnotatedTypes().
|
static |
Definition at line 272 of file CheckExprLifetime.cpp.
References isInStlNamespace().
Referenced by handleGslAnnotatedTypes().
|
static |
Definition at line 426 of file CheckExprLifetime.cpp.
References clang::Call, clang::Sema::CanBeGetReturnObject(), D, clang::Expr::IgnoreImplicit(), implicitObjectParamIsLifetimeBound(), Path, 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 637 of file CheckExprLifetime.cpp.
References clang::C, clang::LambdaCapture::capturesVariable(), E, handleGslAnnotatedTypes(), clang::Init, isVarOnPath(), Path, visitLifetimeBoundArguments(), visitLocalsRetainedByInitializer(), and visitLocalsRetainedByReferenceBinding().
Referenced by handleGslAnnotatedTypes(), visitLifetimeBoundArguments(), visitLocalsRetainedByInitializer(), and visitLocalsRetainedByReferenceBinding().
|
static |
Visit the locals that would be reachable through a reference bound to the glvalue expression Init
.
Definition at line 493 of file CheckExprLifetime.cpp.
References clang::C, handleGslAnnotatedTypes(), clang::Init, isVarOnPath(), Path, visitLifetimeBoundArguments(), visitLocalsRetainedByInitializer(), and visitLocalsRetainedByReferenceBinding().
Referenced by handleGslAnnotatedTypes(), visitLifetimeBoundArguments(), visitLocalsRetainedByInitializer(), and visitLocalsRetainedByReferenceBinding().