14#ifndef LLVM_CLANG_ANALYSIS_ANALYSES_LIFETIMESAFETY_ORIGINS_H
15#define LLVM_CLANG_ANALYSIS_ANALYSES_LIFETIMESAFETY_ORIGINS_H
22#include "llvm/Support/raw_ostream.h"
29 return OS << ID.Value;
43 llvm::PointerUnion<const clang::ValueDecl *, const clang::Expr *>
Ptr;
107 while (
T->InnerList) {
159 OriginID getNextOriginID() {
return NextOriginID++; }
164 template <
typename T>
165 OriginList *buildListForType(
QualType QT,
const T *Node);
172 llvm::BumpPtrAllocator ListAllocator;
173 llvm::DenseMap<const clang::ValueDecl *, OriginList *> DeclToList;
174 llvm::DenseMap<const clang::Expr *, OriginList *> ExprToList;
C Language Family Type Representation.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
This represents one expression.
A (possibly-)qualified type.
Stmt - This represents one statement.
The base class of the type hierarchy.
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
A list of origins representing levels of indirection for pointer-like types.
OriginID getOuterOriginID() const
OriginList * peelOuterOrigin() const
void setInnerOriginList(OriginList *Inner)
OriginManager(ASTContext &AST)
OriginList * getOrCreateList(const ValueDecl *D)
Gets or creates the OriginList for a given ValueDecl.
const Origin & getOrigin(OriginID ID) const
llvm::ArrayRef< Origin > getOrigins() const
void collectMissingOrigins(Stmt &FunctionBody, LifetimeSafetyStats &LSStats)
Collects statistics about expressions that lack associated origins.
unsigned getNumOrigins() const
void dump(OriginID OID, llvm::raw_ostream &OS) const
utils::ID< struct OriginTag > OriginID
bool doesDeclHaveStorage(const ValueDecl *D)
Returns true if the declaration has its own storage that can be borrowed.
llvm::raw_ostream & operator<<(llvm::raw_ostream &OS, LoanID ID)
bool hasOrigins(QualType QT)
const FunctionProtoType * T
A structure to hold the statistics related to LifetimeAnalysis.
An Origin is a symbolic identifier that represents the set of possible loans a pointer-like object co...
const clang::Expr * getExpr() const
const clang::ValueDecl * getDecl() const
llvm::PointerUnion< const clang::ValueDecl *, const clang::Expr * > Ptr
A pointer to the AST node that this origin represents.
const Type * Ty
The type at this indirection level.
Origin(OriginID ID, const clang::ValueDecl *D, const Type *QT)
Origin(OriginID ID, const clang::Expr *E, const Type *QT)
A generic, type-safe wrapper for an ID, distinguished by its Tag type.