clang 23.0.0git
clang::lifetimes::internal::AccessPath Class Reference

Represents the storage location being borrowed, e.g., a specific stack variable or a field within it: var.field. More...

#include "clang/Analysis/Analyses/LifetimeSafety/Loans.h"

Public Types

enum class  Kind : uint8_t {
  ValueDecl , MaterializeTemporary , PlaceholderParam , PlaceholderThis ,
  NewAllocation
}

Public Member Functions

 AccessPath (const clang::ValueDecl *D)
 AccessPath (const clang::MaterializeTemporaryExpr *MTE)
 AccessPath (const CXXNewExpr *New)
 AccessPath (const AccessPath &Other)
AccessPathoperator= (const AccessPath &)=delete
Kind getKind () const
const clang::ValueDeclgetAsValueDecl () const
const clang::MaterializeTemporaryExprgetAsMaterializeTemporaryExpr () const
const ParmVarDeclgetAsPlaceholderParam () const
const CXXMethodDeclgetAsPlaceholderThis () const
const CXXNewExprgetAsNewAllocation () const
bool operator== (const AccessPath &RHS) const
bool operator!= (const AccessPath &RHS) const
void dump (llvm::raw_ostream &OS) const

Static Public Member Functions

static AccessPath Placeholder (const ParmVarDecl *PVD)
static AccessPath Placeholder (const CXXMethodDecl *MD)

Detailed Description

Represents the storage location being borrowed, e.g., a specific stack variable or a field within it: var.field.

Placeholder paths never expire within the function scope, as they represent storage from the caller's scope.

TODO: Model access paths of other types, e.g. field, array subscript, heap allocation not through new, and globals.

Definition at line 45 of file Loans.h.

Member Enumeration Documentation

◆ Kind

enum class clang::lifetimes::internal::AccessPath::Kind : uint8_t
strong
Enumerator
ValueDecl 
MaterializeTemporary 
PlaceholderParam 
PlaceholderThis 
NewAllocation 

Definition at line 47 of file Loans.h.

Constructor & Destructor Documentation

◆ AccessPath() [1/4]

clang::lifetimes::internal::AccessPath::AccessPath ( const clang::ValueDecl * D)
inline

Definition at line 60 of file Loans.h.

References ValueDecl.

Referenced by AccessPath(), operator!=(), operator=(), operator==(), Placeholder(), and Placeholder().

◆ AccessPath() [2/4]

clang::lifetimes::internal::AccessPath::AccessPath ( const clang::MaterializeTemporaryExpr * MTE)
inline

Definition at line 61 of file Loans.h.

References MaterializeTemporary.

◆ AccessPath() [3/4]

clang::lifetimes::internal::AccessPath::AccessPath ( const CXXNewExpr * New)
inline

Definition at line 63 of file Loans.h.

References New, and NewAllocation.

◆ AccessPath() [4/4]

clang::lifetimes::internal::AccessPath::AccessPath ( const AccessPath & Other)
inline

Definition at line 70 of file Loans.h.

References AccessPath(), and clang::Other.

Member Function Documentation

◆ dump()

void clang::lifetimes::internal::AccessPath::dump ( llvm::raw_ostream & OS) const

◆ getAsMaterializeTemporaryExpr()

const clang::MaterializeTemporaryExpr * clang::lifetimes::internal::AccessPath::getAsMaterializeTemporaryExpr ( ) const
inline

Definition at line 80 of file Loans.h.

References clang::cast(), and MaterializeTemporary.

Referenced by dump().

◆ getAsNewAllocation()

const CXXNewExpr * clang::lifetimes::internal::AccessPath::getAsNewAllocation ( ) const
inline

Definition at line 96 of file Loans.h.

References clang::cast(), and NewAllocation.

Referenced by dump().

◆ getAsPlaceholderParam()

const ParmVarDecl * clang::lifetimes::internal::AccessPath::getAsPlaceholderParam ( ) const
inline

Definition at line 86 of file Loans.h.

References clang::cast(), and PlaceholderParam.

Referenced by dump().

◆ getAsPlaceholderThis()

const CXXMethodDecl * clang::lifetimes::internal::AccessPath::getAsPlaceholderThis ( ) const
inline

Definition at line 91 of file Loans.h.

References clang::cast(), and PlaceholderThis.

◆ getAsValueDecl()

const clang::ValueDecl * clang::lifetimes::internal::AccessPath::getAsValueDecl ( ) const
inline

Definition at line 75 of file Loans.h.

References clang::cast(), and ValueDecl.

Referenced by dump().

◆ getKind()

Kind clang::lifetimes::internal::AccessPath::getKind ( ) const
inline

Definition at line 73 of file Loans.h.

◆ operator!=()

bool clang::lifetimes::internal::AccessPath::operator!= ( const AccessPath & RHS) const
inline

Definition at line 105 of file Loans.h.

References AccessPath().

◆ operator=()

AccessPath & clang::lifetimes::internal::AccessPath::operator= ( const AccessPath & )
delete

References AccessPath().

◆ operator==()

bool clang::lifetimes::internal::AccessPath::operator== ( const AccessPath & RHS) const
inline

Definition at line 102 of file Loans.h.

References AccessPath().

◆ Placeholder() [1/2]

AccessPath clang::lifetimes::internal::AccessPath::Placeholder ( const CXXMethodDecl * MD)
inlinestatic

Definition at line 67 of file Loans.h.

References AccessPath(), and PlaceholderThis.

◆ Placeholder() [2/2]

AccessPath clang::lifetimes::internal::AccessPath::Placeholder ( const ParmVarDecl * PVD)
inlinestatic

Definition at line 64 of file Loans.h.

References AccessPath(), and PlaceholderParam.


The documentation for this class was generated from the following files: