clang: clang::sema Namespace Reference (original) (raw)

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

AnalysisResult

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

analyzePathForGSLPointer()

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

Definition at line 1195 of file CheckExprLifetime.cpp.

References Abandon, clang::Type::getPointeeType(), clang::FunctionDecl::getReturnType(), isPointerLikeType(), clang::Type::isReferenceType(), NotGSLPointer, Path, pathContainsInit(), pathOnlyHandlesGslPointer(), Report, and Skip.

Referenced by checkExprLifetimeImpl().

checkAssignmentLifetime()

checkCaptureByLifetime()

checkExprLifetimeImpl()

Definition at line 1278 of file CheckExprLifetime.cpp.

References Abandon, clang::InitializedEntity::allocateManglingNumber(), analyzePathForGSLPointer(), clang::sema::AssignedEntity::AssignmentOperator, clang::SemaBase::Diag(), clang::sema::CapturingEntity::Entity, Extend, clang::SourceRange::getBegin(), clang::InitializedEntity::getDecl(), clang::NamedDecl::getDeclName(), clang::ParmVarDecl::getDefaultArgRange(), clang::Sema::getLangOpts(), clang::Decl::getLocation(), clang::InitializedEntity::getParent(), clang::ValueDecl::getType(), clang::Expr::getType(), clang::InitializedEntity::getType(), clang::Init, isAssignmentOperatorLifetimeBound(), clang::Decl::isImplicit(), clang::ValueDecl::isInitCapture(), isPointerLikeType(), clang::Type::isPointerType(), clang::Type::isReferenceType(), clang::SourceLocation::isValid(), clang::LCK_ByRef, clang::sema::AssignedEntity::LHS, clang::Member, nextPathEntryRange(), NoExtend, NotGSLPointer, Path, pathContainsInit(), Report, shouldLifetimeExtendThroughPath(), shouldRunGSLAssignmentAnalysis(), and Skip.

Referenced by checkAssignmentLifetime(), checkCaptureByLifetime(), checkExprLifetimeMustTailArg(), and checkInitLifetime().

checkExprLifetimeMustTailArg()

checkInitLifetime()

getDeclWithMergedLifetimeBoundAttrs() [1/2]

getDeclWithMergedLifetimeBoundAttrs() [2/2]

getEntityLifetime()

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

implicitObjectParamIsLifetimeBound()

instantiateTemplateAttribute()

instantiateTemplateAttributeForDecl()

isAssignmentOperatorLifetimeBound()

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

isContainerOfOwner()

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

isContainerOfPointer()

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

isCopyLikeConstructor()

isGLSPointerType()

isInStlNamespace()

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

isNormalAssignmentOperator()

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

Definition at line 509 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().

isPointerLikeType()

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

isRecordWithAttr()

template<typename T >

static bool clang::sema::isRecordWithAttr ( QualType Type) static

isStdInitializerListOfPointer()

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

isVarOnPath()

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

nextPathEntryRange()

pathContainsInit()

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

pathOnlyHandlesGslPointer()

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

shouldLifetimeExtendThroughPath()

static PathLifetimeKind clang::sema::shouldLifetimeExtendThroughPath ( const IndirectLocalPath & Path) static

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

Definition at line 431 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(), isStdInitializerListOfPointer(), and clang::FunctionDecl::param_empty().

Referenced by visitFunctionCallArguments().

shouldTrackImplicitObjectArg()

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

visitFunctionCallArguments()

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

Definition at line 560 of file CheckExprLifetime.cpp.

References clang::Call, clang::Sema::CanBeGetReturnObject(), D, clang::Decl::getAttr(), getDeclWithMergedLifetimeBoundAttrs(), clang::FunctionDecl::getNumParams(), clang::FunctionDecl::getParamDecl(), clang::Decl::hasAttr(), clang::Expr::IgnoreImplicit(), implicitObjectParamIsLifetimeBound(), isPointerLikeType(), Path, shouldTrackFirstArgument(), shouldTrackFirstArgumentForConstructor(), shouldTrackImplicitObjectArg(), visitLocalsRetainedByInitializer(), and visitLocalsRetainedByReferenceBinding().

Referenced by visitLocalsRetainedByInitializer(), and visitLocalsRetainedByReferenceBinding().

visitLocalsRetainedByInitializer()

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

Visit the locals that would be reachable through an object initialized by the prvalue expression Init.

Definition at line 842 of file CheckExprLifetime.cpp.

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

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

visitLocalsRetainedByReferenceBinding()

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