clang 20.0.0git
Classes | Enumerations | Functions
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 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)
 
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)
 
static bool isAssignmentOperatorLifetimeBound (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 1166 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 1092 of file CheckExprLifetime.cpp.

Function Documentation

◆ analyzePathForGSLPointer()

static AnalysisResult clang::sema::analyzePathForGSLPointer ( const IndirectLocalPath &  Path,
Local  L 
)
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()

static 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 1604 of file CheckExprLifetime.cpp.

References checkExprLifetimeImpl(), and checkExprLifetimeMustTailArg().

Referenced by checkExprLifetimeMustTailArg().

◆ 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 1595 of file CheckExprLifetime.cpp.

References checkExprLifetimeImpl(), checkInitLifetime(), and getEntityLifetime().

Referenced by clang::Sema::checkInitializerLifetime(), and checkInitLifetime().

◆ getEntityLifetime()

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

◆ implicitObjectParamIsLifetimeBound()

bool clang::sema::implicitObjectParamIsLifetimeBound ( const FunctionDecl FD)

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

static bool clang::sema::isAssignmentOperatorLifetimeBound ( CXXMethodDecl CMD)
static

◆ isContainerOfOwner()

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

◆ isContainerOfPointer()

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

◆ isCopyLikeConstructor()

static bool clang::sema::isCopyLikeConstructor ( const CXXConstructorDecl Ctor)
static

◆ isInStlNamespace()

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

◆ isNormalAssignmentOperator()

static bool clang::sema::isNormalAssignmentOperator ( const FunctionDecl FD)
static

◆ isPointerLikeType()

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

◆ isRecordWithAttr()

template<typename T >
static bool clang::sema::isRecordWithAttr ( QualType  Type)
static

Definition at line 257 of file CheckExprLifetime.cpp.

References clang::Type::getAsCXXRecordDecl(), clang::Result, and clang::T.

◆ isStdInitializerListOfPointer()

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

◆ isVarOnPath()

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

Definition at line 235 of file CheckExprLifetime.cpp.

References E, and Path.

Referenced by visitLocalsRetainedByInitializer(), and visitLocalsRetainedByReferenceBinding().

◆ nextPathEntryRange()

static 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 1113 of file CheckExprLifetime.cpp.

References D, E, Kind, and Path.

Referenced by checkExprLifetimeImpl().

◆ pathContainsInit()

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

Definition at line 242 of file CheckExprLifetime.cpp.

References E, and Path.

Referenced by analyzePathForGSLPointer(), and checkExprLifetimeImpl().

◆ pathOnlyHandlesGslPointer()

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

Definition at line 1148 of file CheckExprLifetime.cpp.

References Path.

Referenced by analyzePathForGSLPointer().

◆ shouldLifetimeExtendThroughPath()

static 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 1102 of file CheckExprLifetime.cpp.

References Extend, NoExtend, and Path.

Referenced by checkExprLifetimeImpl().

◆ shouldRunGSLAssignmentAnalysis()

static bool clang::sema::shouldRunGSLAssignmentAnalysis ( const Sema SemaRef,
const AssignedEntity Entity 
)
static

◆ shouldTrackFirstArgument()

static bool clang::sema::shouldTrackFirstArgument ( const FunctionDecl FD)
static

◆ shouldTrackFirstArgumentForConstructor()

static bool clang::sema::shouldTrackFirstArgumentForConstructor ( const CXXConstructExpr Ctor)
static

◆ shouldTrackImplicitObjectArg()

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

Definition at line 345 of file CheckExprLifetime.cpp.

References isInStlNamespace(), and isPointerLikeType().

Referenced by visitFunctionCallArguments().

◆ visitFunctionCallArguments()

static void clang::sema::visitFunctionCallArguments ( IndirectLocalPath &  Path,
Expr Call,
LocalVisitor  Visit 
)
static

◆ visitLocalsRetainedByInitializer()

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

◆ visitLocalsRetainedByReferenceBinding()

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

Visit the locals that would be reachable through a reference bound to the glvalue expression Init.

Definition at line 694 of file CheckExprLifetime.cpp.

References clang::C, clang::Init, isVarOnPath(), Path, visitFunctionCallArguments(), visitLocalsRetainedByInitializer(), and visitLocalsRetainedByReferenceBinding().

Referenced by visitFunctionCallArguments(), visitLocalsRetainedByInitializer(), and visitLocalsRetainedByReferenceBinding().