clang 22.0.0git
clang::sema Namespace Reference

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 FunctionDeclgetDeclWithMergedLifetimeBoundAttrs (const FunctionDecl *FD)
static const CXXMethodDeclgetDeclWithMergedLifetimeBoundAttrs (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)
AttrinstantiateTemplateAttribute (const Attr *At, ASTContext &C, Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs)
AttrinstantiateTemplateAttributeForDecl (const Attr *At, ASTContext &C, Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs)

Enumeration Type Documentation

◆ AnalysisResult

Enumerator
NotGSLPointer 
Report 
Abandon 
Skip 

Definition at line 1177 of file CheckExprLifetime.cpp.

◆ FirstCoroutineStmtKind

Enumerator
CoReturn 
CoAwait 
CoYield 

Definition at line 100 of file ScopeInfo.h.

◆ PathLifetimeKind

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.

Function Documentation

◆ analyzePathForGSLPointer()

AnalysisResult clang::sema::analyzePathForGSLPointer ( const IndirectLocalPath & Path,
Local L,
LifetimeKind LK )
static

◆ checkAssignmentLifetime()

void clang::sema::checkAssignmentLifetime ( Sema & SemaRef,
const AssignedEntity & Entity,
Expr * Init )

◆ checkCaptureByLifetime()

void clang::sema::checkCaptureByLifetime ( Sema & SemaRef,
const CapturingEntity & Entity,
Expr * Init )

◆ checkExprLifetimeImpl()

void clang::sema::checkExprLifetimeImpl ( Sema & SemaRef,
const InitializedEntity * InitEntity,
const InitializedEntity * ExtendingEntity,
LifetimeKind LK,
const AssignedEntity * AEntity,
const CapturingEntity * CapEntity,
Expr * Init )
static

◆ checkExprLifetimeMustTailArg()

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.

◆ checkInitLifetime()

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().

◆ getDeclWithMergedLifetimeBoundAttrs() [1/2]

const CXXMethodDecl * clang::sema::getDeclWithMergedLifetimeBoundAttrs ( const CXXMethodDecl * CMD)
static

Definition at line 535 of file CheckExprLifetime.cpp.

References getDeclWithMergedLifetimeBoundAttrs().

◆ getDeclWithMergedLifetimeBoundAttrs() [2/2]

const FunctionDecl * clang::sema::getDeclWithMergedLifetimeBoundAttrs ( const FunctionDecl * FD)
static

◆ getEntityLifetime()

LifetimeResult clang::sema::getEntityLifetime ( const InitializedEntity * Entity,
const InitializedEntity * InitField = nullptr )
static

◆ implicitObjectParamIsLifetimeBound()

◆ instantiateTemplateAttribute()

Attr * clang::sema::instantiateTemplateAttribute ( const Attr * At,
ASTContext & C,
Sema & S,
const MultiLevelTemplateArgumentList & TemplateArgs )

◆ instantiateTemplateAttributeForDecl()

Attr * clang::sema::instantiateTemplateAttributeForDecl ( const Attr * At,
ASTContext & C,
Sema & S,
const MultiLevelTemplateArgumentList & TemplateArgs )

◆ isAssignmentOperatorLifetimeBound()

◆ isContainerOfOwner()

bool clang::sema::isContainerOfOwner ( const RecordDecl * Container)
static

◆ isContainerOfPointer()

bool clang::sema::isContainerOfPointer ( const RecordDecl * Container)
static

◆ isCopyLikeConstructor()

◆ isGLSPointerType()

bool clang::sema::isGLSPointerType ( QualType QT)

◆ isInStlNamespace()

bool clang::sema::isInStlNamespace ( const Decl * D)
static

◆ isNormalAssignmentOperator()

◆ isPointerLikeType()

◆ isRecordWithAttr()

◆ isStdInitializerListOfPointer()

bool clang::sema::isStdInitializerListOfPointer ( const RecordDecl * RD)
static

◆ isVarOnPath()

bool clang::sema::isVarOnPath ( const IndirectLocalPath & Path,
VarDecl * VD )
static

◆ nextPathEntryRange()

SourceRange clang::sema::nextPathEntryRange ( const IndirectLocalPath & Path,
unsigned I,
Expr * E )
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().

◆ pathContainsInit()

bool clang::sema::pathContainsInit ( const IndirectLocalPath & Path)
static

Definition at line 243 of file CheckExprLifetime.cpp.

Referenced by analyzePathForGSLPointer(), and checkExprLifetimeImpl().

◆ pathOnlyHandlesGslPointer()

bool clang::sema::pathOnlyHandlesGslPointer ( const IndirectLocalPath & Path)
static

Definition at line 1158 of file CheckExprLifetime.cpp.

Referenced by analyzePathForGSLPointer().

◆ shouldLifetimeExtendThroughPath()

PathLifetimeKind clang::sema::shouldLifetimeExtendThroughPath ( const IndirectLocalPath & Path)
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().

◆ shouldRunGSLAssignmentAnalysis()

◆ shouldTrackFirstArgument()

◆ shouldTrackFirstArgumentForConstructor()

◆ shouldTrackImplicitObjectArg()

bool clang::sema::shouldTrackImplicitObjectArg ( const CXXMethodDecl * Callee)
static

◆ visitFunctionCallArguments()

◆ visitLocalsRetainedByInitializer()

void clang::sema::visitLocalsRetainedByInitializer ( IndirectLocalPath & Path,
Expr * Init,
LocalVisitor Visit,
bool RevisitSubinits )
static

◆ visitLocalsRetainedByReferenceBinding()

void clang::sema::visitLocalsRetainedByReferenceBinding ( IndirectLocalPath & Path,
Expr * Init,
ReferenceKind RK,
LocalVisitor Visit )
static