clang 23.0.0git
clang::lifetimes Namespace Reference

Namespaces

namespace  internal

Classes

struct  LifetimeSafetyOpts
class  LifetimeSafetySemaHelper
 Abstract interface for operations requiring Sema access. More...
class  LifetimeSafetySemaHelperImpl
struct  LifetimeSafetyStats
 A structure to hold the statistics related to LifetimeAnalysis. More...

Enumerations

enum class  WarningScope { CrossTU , IntraTU }
 Enum to track functions visible across or within TU. More...

Functions

void runLifetimeSafetyAnalysis (AnalysisDeclContext &AC, LifetimeSafetySemaHelper *SemaHelper, LifetimeSafetyStats &Stats, bool CollectStats)
 The main entry point for the analysis.
void printStats (const LifetimeSafetyStats &Stats)
 Utility function to print missing origin stats.
const FunctionDeclgetDeclWithMergedLifetimeBoundAttrs (const FunctionDecl *FD)
const CXXMethodDeclgetDeclWithMergedLifetimeBoundAttrs (const CXXMethodDecl *CMD)
bool isNormalAssignmentOperator (const FunctionDecl *FD)
bool isAssignmentOperatorLifetimeBound (const CXXMethodDecl *CMD)
static const LifetimeBoundAttr * getLifetimeBoundAttrFromFunctionType (const TypeSourceInfo &TSI)
 Check if a function has a lifetimebound attribute on its function type (which represents the implicit 'this' parameter for methods).
const LifetimeBoundAttr * getDirectImplicitObjectLifetimeBoundAttr (const FunctionDecl *FD)
const LifetimeBoundAttr * getImplicitObjectParamLifetimeBoundAttr (const FunctionDecl *FD)
bool implicitObjectParamIsLifetimeBound (const FunctionDecl *FD)
bool isInStlNamespace (const Decl *D)
bool isPointerLikeType (QualType QT)
static bool isReferenceOrPointerLikeType (QualType QT)
bool shouldTrackImplicitObjectArg (const Expr &ImplicitObjectArgument, const CXXMethodDecl *Callee, bool RunningUnderLifetimeSafety)
bool shouldTrackFirstArgument (const FunctionDecl *FD)
bool shouldTrackSecondArgument (const FunctionDecl *FD)
template<typename T>
static bool isRecordWithAttr (const CXXRecordDecl *RD)
template<typename T>
static bool isRecordWithAttr (QualType Type)
bool isGslPointerType (QualType QT)
bool isGslOwnerType (QualType QT)
bool isGslOwnerType (const CXXRecordDecl *RD)
static StringRef getName (const CXXRecordDecl &RD)
static StringRef getName (const FunctionDecl &FD)
static bool isStdUniquePtr (const CXXRecordDecl &RD)
bool isUniquePtrRelease (const CXXMethodDecl &MD)
bool isInvalidationMethod (const CXXMethodDecl &MD)
bool destructsFirstArg (const FunctionDecl &FD)
bool isStdCallableWrapperType (const CXXRecordDecl *RD)
bool isStdReferenceCast (const FunctionDecl *FD)
bool IsLifetimeSafetyEnabled (Sema &S, const Decl *D)

Enumeration Type Documentation

◆ WarningScope

enum class clang::lifetimes::WarningScope
strong

Enum to track functions visible across or within TU.

Enumerator
CrossTU 
IntraTU 

Definition at line 44 of file LifetimeSafety.h.

Function Documentation

◆ destructsFirstArg()

bool clang::lifetimes::destructsFirstArg ( const FunctionDecl & FD)

Definition at line 450 of file LifetimeAnnotations.cpp.

References getName(), clang::isa(), and isInStlNamespace().

◆ getDeclWithMergedLifetimeBoundAttrs() [1/2]

const CXXMethodDecl * clang::lifetimes::getDeclWithMergedLifetimeBoundAttrs ( const CXXMethodDecl * CMD)

Definition at line 27 of file LifetimeAnnotations.cpp.

References getDeclWithMergedLifetimeBoundAttrs().

◆ getDeclWithMergedLifetimeBoundAttrs() [2/2]

◆ getDirectImplicitObjectLifetimeBoundAttr()

const LifetimeBoundAttr * clang::lifetimes::getDirectImplicitObjectLifetimeBoundAttr ( const FunctionDecl * FD)

◆ getImplicitObjectParamLifetimeBoundAttr()

◆ getLifetimeBoundAttrFromFunctionType()

const LifetimeBoundAttr * clang::lifetimes::getLifetimeBoundAttrFromFunctionType ( const TypeSourceInfo & TSI)
static

Check if a function has a lifetimebound attribute on its function type (which represents the implicit 'this' parameter for methods).

Returns the attribute if found, nullptr otherwise.

Definition at line 61 of file LifetimeAnnotations.cpp.

References clang::TypeLoc::getAsAdjusted(), and clang::TypeSourceInfo::getTypeLoc().

Referenced by getDirectImplicitObjectLifetimeBoundAttr().

◆ getName() [1/2]

StringRef clang::lifetimes::getName ( const CXXRecordDecl & RD)
static

◆ getName() [2/2]

StringRef clang::lifetimes::getName ( const FunctionDecl & FD)
static

◆ implicitObjectParamIsLifetimeBound()

bool clang::lifetimes::implicitObjectParamIsLifetimeBound ( const FunctionDecl * FD)

◆ isAssignmentOperatorLifetimeBound()

◆ isGslOwnerType() [1/2]

bool clang::lifetimes::isGslOwnerType ( const CXXRecordDecl * RD)

Definition at line 313 of file LifetimeAnnotations.cpp.

References isRecordWithAttr().

◆ isGslOwnerType() [2/2]

◆ isGslPointerType()

◆ isInStlNamespace()

◆ isInvalidationMethod()

◆ IsLifetimeSafetyEnabled()

bool clang::lifetimes::IsLifetimeSafetyEnabled ( Sema & S,
const Decl * D )
inline

◆ isNormalAssignmentOperator()

◆ isPointerLikeType()

◆ isRecordWithAttr() [1/2]

template<typename T>
bool clang::lifetimes::isRecordWithAttr ( const CXXRecordDecl * RD)
static

◆ isRecordWithAttr() [2/2]

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

◆ isReferenceOrPointerLikeType()

bool clang::lifetimes::isReferenceOrPointerLikeType ( QualType QT)
static

◆ isStdCallableWrapperType()

◆ isStdReferenceCast()

bool clang::lifetimes::isStdReferenceCast ( const FunctionDecl * FD)

Definition at line 463 of file LifetimeAnnotations.cpp.

References clang::FunctionDecl::getBuiltinID().

◆ isStdUniquePtr()

bool clang::lifetimes::isStdUniquePtr ( const CXXRecordDecl & RD)
static

Definition at line 331 of file LifetimeAnnotations.cpp.

References getName(), and clang::Decl::isInStdNamespace().

Referenced by isUniquePtrRelease().

◆ isUniquePtrRelease()

◆ printStats()

◆ runLifetimeSafetyAnalysis()

◆ shouldTrackFirstArgument()

◆ shouldTrackImplicitObjectArg()

bool clang::lifetimes::shouldTrackImplicitObjectArg ( const Expr & ImplicitObjectArgument,
const CXXMethodDecl * Callee,
bool RunningUnderLifetimeSafety )

◆ shouldTrackSecondArgument()