clang 22.0.0git
CheckExprLifetime.cpp File Reference
#include "CheckExprLifetime.h"
#include "clang/AST/Decl.h"
#include "clang/AST/Expr.h"
#include "clang/AST/Type.h"
#include "clang/Basic/DiagnosticSema.h"
#include "clang/Sema/Initialization.h"
#include "clang/Sema/Sema.h"
#include "llvm/ADT/PointerIntPair.h"

Go to the source code of this file.

Namespaces

namespace  clang
 The JSON file list parser is used to communicate input to InstallAPI.
namespace  clang::sema

Enumerations

enum  clang::sema::PathLifetimeKind { clang::sema::Extend , clang::sema::NoExtend }
 Whether a path to an object supports lifetime extension. More...
enum  clang::sema::AnalysisResult { clang::sema::NotGSLPointer , clang::sema::Report , clang::sema::Abandon , clang::sema::Skip }

Functions

static LifetimeResult clang::sema::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 clang::sema::isVarOnPath (const IndirectLocalPath &Path, VarDecl *VD)
static bool clang::sema::pathContainsInit (const IndirectLocalPath &Path)
static void clang::sema::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 clang::sema::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 clang::sema::isRecordWithAttr (QualType Type)
bool clang::sema::isGLSPointerType (QualType QT)
static bool clang::sema::isPointerLikeType (QualType QT)
static bool clang::sema::isInStlNamespace (const Decl *D)
static bool clang::sema::isContainerOfPointer (const RecordDecl *Container)
static bool clang::sema::isContainerOfOwner (const RecordDecl *Container)
static bool clang::sema::isStdInitializerListOfPointer (const RecordDecl *RD)
static bool clang::sema::shouldTrackImplicitObjectArg (const CXXMethodDecl *Callee)
static bool clang::sema::shouldTrackFirstArgument (const FunctionDecl *FD)
static bool clang::sema::isCopyLikeConstructor (const CXXConstructorDecl *Ctor)
static bool clang::sema::shouldTrackFirstArgumentForConstructor (const CXXConstructExpr *Ctor)
static bool clang::sema::isNormalAssignmentOperator (const FunctionDecl *FD)
static const FunctionDeclclang::sema::getDeclWithMergedLifetimeBoundAttrs (const FunctionDecl *FD)
static const CXXMethodDeclclang::sema::getDeclWithMergedLifetimeBoundAttrs (const CXXMethodDecl *CMD)
bool clang::sema::implicitObjectParamIsLifetimeBound (const FunctionDecl *FD)
static void clang::sema::visitFunctionCallArguments (IndirectLocalPath &Path, Expr *Call, LocalVisitor Visit)
static PathLifetimeKind clang::sema::shouldLifetimeExtendThroughPath (const IndirectLocalPath &Path)
 Determine whether this is an indirect path to a temporary that we are supposed to lifetime-extend along.
static SourceRange clang::sema::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 clang::sema::pathOnlyHandlesGslPointer (const IndirectLocalPath &Path)
static AnalysisResult clang::sema::analyzePathForGSLPointer (const IndirectLocalPath &Path, Local L, LifetimeKind LK)
static bool clang::sema::isAssignmentOperatorLifetimeBound (const CXXMethodDecl *CMD)
static bool clang::sema::shouldRunGSLAssignmentAnalysis (const Sema &SemaRef, const AssignedEntity &Entity)
static void clang::sema::checkExprLifetimeImpl (Sema &SemaRef, const InitializedEntity *InitEntity, const InitializedEntity *ExtendingEntity, LifetimeKind LK, const AssignedEntity *AEntity, const CapturingEntity *CapEntity, Expr *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.
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.
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.
void clang::sema::checkCaptureByLifetime (Sema &SemaRef, const CapturingEntity &Entity, Expr *Init)