|
clang 22.0.0git
|
Namespaces | |
| namespace | utils |
Classes | |
| struct | AccessPath |
| Represents the storage location being borrowed, e.g., a specific stack variable. More... | |
| class | DataflowAnalysis |
| A generic, policy-based driver for dataflow analyses. More... | |
| class | ExpireFact |
| class | Fact |
| An abstract base class for a single, atomic lifetime-relevant event. More... | |
| class | FactManager |
| class | FactsGenerator |
| class | IssueFact |
| struct | LifetimeFactory |
| An object to hold the factories for immutable collections, ensuring that all created states share the same underlying memory management. More... | |
| class | LifetimeSafetyAnalysis |
| Running the lifetime safety analysis and querying its results. More... | |
| struct | LivenessInfo |
| Information about why an origin is live at a program point. More... | |
| class | LiveOriginsAnalysis |
| struct | Loan |
| Information about a single borrow, or "Loan". More... | |
| class | LoanManager |
| Manages the creation, storage and retrieval of loans. More... | |
| class | LoanPropagationAnalysis |
| struct | Origin |
| An Origin is a symbolic identifier that represents the set of possible loans a pointer-like object could hold at any given time. More... | |
| class | OriginFlowFact |
| class | OriginManager |
| Manages the creation, storage, and retrieval of origins for pointer-like variables and expressions. More... | |
| class | ReturnOfOriginFact |
| class | TestPointFact |
| A dummy-fact used to mark a specific point in the code for testing. More... | |
| class | UseFact |
Typedefs | |
| using | ProgramPoint = const Fact * |
| A ProgramPoint identifies a location in the CFG by pointing to a specific Fact. | |
| using | LivenessMap = llvm::ImmutableMap<OriginID, LivenessInfo> |
| using | LoanSet = llvm::ImmutableSet<LoanID> |
| using | OriginLoanMap = llvm::ImmutableMap<OriginID, LoanSet> |
| using | LoanID = utils::ID<struct LoanTag> |
| using | OriginID = utils::ID<struct OriginTag> |
Enumerations | |
| enum class | LivenessKind : uint8_t { Dead , Maybe , Must } |
| enum class | Direction { Forward , Backward } |
Functions | |
| void | runLifetimeChecker (const LoanPropagationAnalysis &LoanPropagation, const LiveOriginsAnalysis &LiveOrigins, const FactManager &FactMgr, AnalysisDeclContext &ADC, LifetimeSafetyReporter *Reporter) |
| Runs the lifetime checker, which detects use-after-free errors by examining loan expiration points and checking if any live origins hold the expired loan. | |
| llvm::raw_ostream & | operator<< (llvm::raw_ostream &OS, LoanID ID) |
| llvm::raw_ostream & | operator<< (llvm::raw_ostream &OS, OriginID ID) |
| static Confidence | livenessKindToConfidence (LivenessKind K) |
| static bool | isGslPointerType (QualType QT) |
| static bool | isPointerType (QualType QT) |
| static bool | hasOrigin (const Expr *E) |
| static bool | hasOrigin (const VarDecl *VD) |
| static const Loan * | createLoan (FactManager &FactMgr, const DeclRefExpr *DRE) |
| Creates a loan for the storage path of a given declaration reference. | |
| using clang::lifetimes::internal::LivenessMap = llvm::ImmutableMap<OriginID, LivenessInfo> |
Definition at line 74 of file LiveOrigins.h.
| using clang::lifetimes::internal::LoanID = utils::ID<struct LoanTag> |
| using clang::lifetimes::internal::LoanSet = llvm::ImmutableSet<LoanID> |
Definition at line 29 of file LoanPropagation.h.
| using clang::lifetimes::internal::OriginID = utils::ID<struct OriginTag> |
| using clang::lifetimes::internal::OriginLoanMap = llvm::ImmutableMap<OriginID, LoanSet> |
Definition at line 30 of file LoanPropagation.h.
| using clang::lifetimes::internal::ProgramPoint = const Fact * |
A ProgramPoint identifies a location in the CFG by pointing to a specific Fact.
identified by a lifetime-related event (Fact).
A ProgramPoint has "after" semantics: it represents the location immediately after its corresponding Fact.
|
strong |
| Enumerator | |
|---|---|
| Forward | |
| Backward | |
Definition at line 29 of file Dataflow.h.
|
strong |
| Enumerator | |
|---|---|
| Dead | |
| Maybe | |
| Must | |
Definition at line 34 of file LiveOrigins.h.
|
static |
Creates a loan for the storage path of a given declaration reference.
This function should be called whenever a DeclRefExpr represents a borrow.
| DRE | The declaration reference expression that initiates the borrow. |
Definition at line 46 of file FactsGenerator.cpp.
References clang::lifetimes::internal::LoanManager::addLoan(), clang::DeclRefExpr::getDecl(), and clang::lifetimes::internal::FactManager::getLoanMgr().
Referenced by clang::lifetimes::internal::FactsGenerator::VisitDeclRefExpr().
Definition at line 34 of file FactsGenerator.cpp.
References clang::Expr::getType(), clang::Expr::isGLValue(), and isPointerType().
Referenced by clang::lifetimes::internal::FactsGenerator::VisitDeclStmt(), clang::lifetimes::internal::FactsGenerator::VisitImplicitCastExpr(), clang::lifetimes::internal::FactsGenerator::VisitInitListExpr(), clang::lifetimes::internal::FactsGenerator::VisitMaterializeTemporaryExpr(), and clang::lifetimes::internal::FactsGenerator::VisitReturnStmt().
Definition at line 38 of file FactsGenerator.cpp.
References clang::ValueDecl::getType(), and isPointerType().
Definition at line 18 of file FactsGenerator.cpp.
References clang::Type::getAsCXXRecordDecl().
Referenced by isPointerType(), clang::lifetimes::internal::FactsGenerator::VisitCXXConstructExpr(), clang::lifetimes::internal::FactsGenerator::VisitCXXFunctionalCastExpr(), and clang::lifetimes::internal::FactsGenerator::VisitCXXMemberCallExpr().
Definition at line 30 of file FactsGenerator.cpp.
References isGslPointerType(), and clang::Type::isPointerOrReferenceType().
Referenced by hasOrigin(), hasOrigin(), clang::lifetimes::internal::FactsGenerator::VisitDeclRefExpr(), and clang::lifetimes::internal::FactsGenerator::VisitUnaryOperator().
|
static |
Definition at line 29 of file Checker.cpp.
References Dead, clang::lifetimes::Definite, clang::lifetimes::Maybe, Maybe, Must, and clang::lifetimes::None.
|
inline |
|
inline |
| void clang::lifetimes::internal::runLifetimeChecker | ( | const LoanPropagationAnalysis & | LoanPropagation, |
| const LiveOriginsAnalysis & | LiveOrigins, | ||
| const FactManager & | FactMgr, | ||
| AnalysisDeclContext & | ADC, | ||
| LifetimeSafetyReporter * | Reporter ) |
Runs the lifetime checker, which detects use-after-free errors by examining loan expiration points and checking if any live origins hold the expired loan.
Definition at line 122 of file Checker.cpp.
Referenced by clang::lifetimes::internal::LifetimeSafetyAnalysis::run().