clang 22.0.0git
Public Member Functions | Public Attributes | List of all members
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...

Public Member Functions

 Origin (OriginID ID, const clang::ValueDecl *D)
 
 Origin (OriginID ID, const clang::Expr *E)
 
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.
 

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.

TODO: Enhance the origin model to handle complex types, pointer indirection and reborrowing. The plan is to move from a single origin per variable/expression to a "list of origins" governed by the Type. For example, the type 'int**' would have two origins. See discussion: https://github.com/llvm/llvm-project/pull/142313/commits/0cd187b01e61b200d92ca0b640789c1586075142#r2137644238

Definition at line 63 of file LifetimeSafety.cpp.

Constructor & Destructor Documentation

◆ Origin() [1/2]

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

Definition at line 70 of file LifetimeSafety.cpp.

◆ Origin() [2/2]

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

Definition at line 71 of file LifetimeSafety.cpp.

Member Function Documentation

◆ getDecl()

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

Definition at line 73 of file LifetimeSafety.cpp.

References Ptr.

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

◆ getExpr()

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

Definition at line 76 of file LifetimeSafety.cpp.

References Ptr.

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

Member Data Documentation

◆ ID

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

Definition at line 64 of file LifetimeSafety.cpp.

◆ 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 68 of file LifetimeSafety.cpp.

Referenced by getDecl(), and getExpr().


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