|
clang 23.0.0git
|
Manages the creation, storage, and retrieval of origins for pointer-like variables and expressions. More...
#include "clang/Analysis/Analyses/LifetimeSafety/Origins.h"
Public Member Functions | |
| OriginManager (const AnalysisDeclContext &AC) | |
| OriginList * | getOrCreateList (const ValueDecl *D) |
| Gets or creates the OriginList for a given ValueDecl. | |
| OriginList * | getOrCreateList (const Expr *E) |
| Gets or creates the OriginList for a given Expr. | |
| OriginList * | createSingleOriginList (OriginID OID) |
| Wraps an existing OriginID in a new single-element OriginList, so a fact can refer to a single level of an existing OriginList. | |
| std::optional< OriginList * > | getThisOrigins () const |
| Returns the OriginList for the implicit 'this' parameter if the current declaration is an instance method. | |
| const Origin & | getOrigin (OriginID ID) const |
| llvm::ArrayRef< Origin > | getOrigins () const |
| unsigned | getNumOrigins () const |
| bool | hasOrigins (QualType QT) const |
| bool | hasOrigins (const Expr *E) const |
| Determines if an expression has origins that need to be tracked. | |
| void | dump (OriginID OID, llvm::raw_ostream &OS) const |
| void | collectMissingOrigins (Stmt &FunctionBody, LifetimeSafetyStats &LSStats) |
| Collects statistics about expressions that lack associated origins. | |
Manages the creation, storage, and retrieval of origins for pointer-like variables and expressions.
|
explicit |
Definition at line 160 of file Origins.cpp.
References clang::AnalysisDeclContext::getDecl().
| void clang::lifetimes::internal::OriginManager::collectMissingOrigins | ( | Stmt & | FunctionBody, |
| LifetimeSafetyStats & | LSStats ) |
Collects statistics about expressions that lack associated origins.
Definition at line 300 of file Origins.cpp.
Referenced by clang::lifetimes::internal::collectLifetimeStats().
| OriginList * clang::lifetimes::internal::OriginManager::createSingleOriginList | ( | OriginID | OID | ) |
Wraps an existing OriginID in a new single-element OriginList, so a fact can refer to a single level of an existing OriginList.
Definition at line 189 of file Origins.cpp.
| void clang::lifetimes::internal::OriginManager::dump | ( | OriginID | OID, |
| llvm::raw_ostream & | OS ) const |
Definition at line 276 of file Origins.cpp.
References clang::QualType::getAsString(), clang::lifetimes::internal::Origin::getDecl(), clang::lifetimes::internal::Origin::getExpr(), getOrigin(), clang::Stmt::getStmtClassName(), and clang::lifetimes::internal::Origin::Ty.
Referenced by clang::lifetimes::internal::ExpireFact::dump(), clang::lifetimes::internal::FieldEscapeFact::dump(), clang::lifetimes::internal::GlobalEscapeFact::dump(), clang::lifetimes::internal::InvalidateOriginFact::dump(), clang::lifetimes::internal::IssueFact::dump(), clang::lifetimes::internal::KillOriginFact::dump(), clang::lifetimes::internal::MovedOriginFact::dump(), clang::lifetimes::internal::OriginFlowFact::dump(), clang::lifetimes::internal::ReturnEscapeFact::dump(), and clang::lifetimes::internal::UseFact::dump().
|
inline |
Definition at line 159 of file Origins.h.
Referenced by clang::lifetimes::internal::computePersistentOrigins().
| OriginList * clang::lifetimes::internal::OriginManager::getOrCreateList | ( | const Expr * | E | ) |
Gets or creates the OriginList for a given Expr.
Creates a list based on the expression's type and value category:
Definition at line 217 of file Origins.cpp.
References clang::lifetimes::internal::doesDeclHaveStorage(), getOrCreateList(), clang::Expr::getType(), hasOrigins(), clang::Expr::IgnoreParens(), clang::isa(), clang::Expr::isGLValue(), clang::Type::isReferenceType(), and clang::lifetimes::internal::OriginList::setInnerOriginList().
| OriginList * clang::lifetimes::internal::OriginManager::getOrCreateList | ( | const ValueDecl * | D | ) |
Gets or creates the OriginList for a given ValueDecl.
Creates a list structure mirroring the levels of indirection in the declaration's type (e.g., int** p creates list of size 2).
Definition at line 208 of file Origins.cpp.
References clang::ValueDecl::getType(), and hasOrigins().
Referenced by getOrCreateList().
Definition at line 295 of file Origins.cpp.
Referenced by dump().
|
inline |
|
inline |
Returns the OriginList for the implicit 'this' parameter if the current declaration is an instance method.
Determines if an expression has origins that need to be tracked.
An expression has origins if:
Examples:
Definition at line 139 of file Origins.cpp.
References clang::Expr::getType(), hasOrigins(), and clang::Expr::isGLValue().
Definition at line 103 of file Origins.cpp.
References clang::Type::getAsCXXRecordDecl(), clang::QualType::getCanonicalType(), clang::QualType::getTypePtr(), hasOrigins(), clang::lifetimes::isGslPointerType(), clang::Type::isPointerOrReferenceType(), and clang::lifetimes::isStdCallableWrapperType().
Referenced by getOrCreateList(), getOrCreateList(), hasOrigins(), and hasOrigins().