clang 22.0.0git
clang::lifetimes::internal::Origin Struct Reference

An Origin is a symbolic identifier that represents the set of possible loans a pointer-like object could hold at any given time. More...

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

Public Member Functions

 Origin (OriginID ID, const clang::ValueDecl *D, const Type *QT)
 Origin (OriginID ID, const clang::Expr *E, const Type *QT)
const clang::ValueDeclgetDecl () const
const clang::ExprgetExpr () const

Public Attributes

OriginID ID
llvm::PointerUnion< const clang::ValueDecl *, const clang::Expr * > Ptr
 A pointer to the AST node that this origin represents.
const TypeTy
 The type at this indirection level.

Detailed Description

An Origin is a symbolic identifier that represents the set of possible loans a pointer-like object could hold at any given time.

Each Origin corresponds to a single level of indirection. For complex types with multiple levels of indirection (e.g., int**), multiple Origins are organized into an OriginList structure (see below).

Definition at line 38 of file Origins.h.

Constructor & Destructor Documentation

◆ Origin() [1/2]

clang::lifetimes::internal::Origin::Origin ( OriginID ID,
const clang::ValueDecl * D,
const Type * QT )
inline

Definition at line 54 of file Origins.h.

References ID, Ptr, and Ty.

◆ Origin() [2/2]

clang::lifetimes::internal::Origin::Origin ( OriginID ID,
const clang::Expr * E,
const Type * QT )
inline

Definition at line 56 of file Origins.h.

References ID, Ptr, and Ty.

Member Function Documentation

◆ getDecl()

const clang::ValueDecl * clang::lifetimes::internal::Origin::getDecl ( ) const
inline

Definition at line 59 of file Origins.h.

References Ptr.

Referenced by clang::lifetimes::internal::OriginManager::dump().

◆ getExpr()

const clang::Expr * clang::lifetimes::internal::Origin::getExpr ( ) const
inline

Definition at line 62 of file Origins.h.

References Ptr.

Referenced by clang::lifetimes::internal::OriginManager::dump().

Member Data Documentation

◆ ID

OriginID clang::lifetimes::internal::Origin::ID

Definition at line 39 of file Origins.h.

Referenced by Origin(), and Origin().

◆ Ptr

llvm::PointerUnion<const clang::ValueDecl *, const clang::Expr *> clang::lifetimes::internal::Origin::Ptr

A pointer to the AST node that this origin represents.

This union distinguishes between origins from declarations (variables or parameters) and origins from expressions.

Definition at line 43 of file Origins.h.

Referenced by getDecl(), getExpr(), Origin(), and Origin().

◆ Ty

const Type* clang::lifetimes::internal::Origin::Ty

The type at this indirection level.

For int** pp: Root origin: QT = int** (what pp points to) Pointee origin: QT = int* (what *pp points to)

Null for synthetic lvalue origins (e.g., outer origin of DeclRefExpr).

Definition at line 52 of file Origins.h.

Referenced by clang::lifetimes::internal::OriginManager::dump(), Origin(), and Origin().


The documentation for this struct was generated from the following file: