14#ifndef LLVM_CLANG_ANALYSIS_ANALYSES_LIFETIMESAFETY_LOANS_H
15#define LLVM_CLANG_ANALYSIS_ANALYSES_LIFETIMESAFETY_LOANS_H
21#include "llvm/Support/raw_ostream.h"
27 return OS << ID.Value;
46 enum class Kind : uint8_t {
93 return K == RHS.K && Root == RHS.Root;
96 void dump(llvm::raw_ostream &OS)
const;
117 const Expr *IssuingExpr;
121 : ID(ID), Path(Path), IssuingExpr(IssuingExpr) {}
125 void dump(llvm::raw_ostream &OS)
const;
134 void *Mem = LoanAllocator.Allocate<
Loan>();
135 auto *NewLoan =
new (Mem)
Loan(getNextLoanID(), Path, IssueExpr);
136 AllLoans.push_back(NewLoan);
141 assert(ID.Value < AllLoans.size());
142 return AllLoans[ID.Value];
148 LoanID getNextLoanID() {
return NextLoanID++; }
154 llvm::BumpPtrAllocator LoanAllocator;
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
Defines the clang::Expr interface and subclasses for C++ expressions.
Represents a static or instance method of a struct/union/class.
This represents one expression.
Represents a prvalue temporary that is written into memory so that a reference can bind to it.
Represents a parameter to a function.
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Represents the storage location being borrowed, e.g., a specific stack variable or a field within it:...
bool operator!=(const AccessPath &RHS) const
AccessPath(const clang::ValueDecl *D)
const clang::ValueDecl * getAsValueDecl() const
bool operator==(const AccessPath &RHS) const
AccessPath(const clang::MaterializeTemporaryExpr *MTE)
const clang::MaterializeTemporaryExpr * getAsMaterializeTemporaryExpr() const
void dump(llvm::raw_ostream &OS) const
const CXXMethodDecl * getAsPlaceholderThis() const
const ParmVarDecl * getAsPlaceholderParam() const
AccessPath(const AccessPath &Other)
static AccessPath Placeholder(const ParmVarDecl *PVD)
static AccessPath Placeholder(const CXXMethodDecl *MD)
llvm::ArrayRef< const Loan * > getLoans() const
Loan * createLoan(AccessPath Path, const Expr *IssueExpr)
const Loan * getLoan(LoanID ID) const
Represents lending a storage location.
Loan(LoanID ID, AccessPath Path, const Expr *IssuingExpr)
const Expr * getIssuingExpr() const
const AccessPath & getAccessPath() const
void dump(llvm::raw_ostream &OS) const
utils::ID< struct LoanTag > LoanID
llvm::raw_ostream & operator<<(llvm::raw_ostream &OS, LoanID ID)
@ Other
Other implicit parameter.
A generic, type-safe wrapper for an ID, distinguished by its Tag type.