clang 22.0.0git
clang::lifetimes::internal::LifetimeSafetyAnalysis Class Reference

Running the lifetime safety analysis and querying its results. More...

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

Public Member Functions

 LifetimeSafetyAnalysis (AnalysisDeclContext &AC, LifetimeSafetyReporter *Reporter)
void run ()
LoanPropagationAnalysisgetLoanPropagation () const
LiveOriginsAnalysisgetLiveOrigins () const
FactManagergetFactManager ()

Detailed Description

Running the lifetime safety analysis and querying its results.

It encapsulates the various dataflow analyses.

Definition at line 62 of file LifetimeSafety.h.

Constructor & Destructor Documentation

◆ LifetimeSafetyAnalysis()

clang::lifetimes::internal::LifetimeSafetyAnalysis::LifetimeSafetyAnalysis ( AnalysisDeclContext & AC,
LifetimeSafetyReporter * Reporter )

Definition at line 34 of file LifetimeSafety.cpp.

Member Function Documentation

◆ getFactManager()

FactManager & clang::lifetimes::internal::LifetimeSafetyAnalysis::getFactManager ( )
inline

Definition at line 74 of file LifetimeSafety.h.

◆ getLiveOrigins()

LiveOriginsAnalysis & clang::lifetimes::internal::LifetimeSafetyAnalysis::getLiveOrigins ( ) const
inline

Definition at line 73 of file LifetimeSafety.h.

◆ getLoanPropagation()

LoanPropagationAnalysis & clang::lifetimes::internal::LifetimeSafetyAnalysis::getLoanPropagation ( ) const
inline
Note
These are provided only for testing purposes.

Definition at line 70 of file LifetimeSafety.h.

◆ run()

void clang::lifetimes::internal::LifetimeSafetyAnalysis::run ( )

TODO(opt): Consider optimizing individual blocks before running the dataflow analysis.

  1. Expression Origins: These are assigned once and read at most once, forming simple chains. These chains can be compressed into a single assignment.
  2. Block-Local Loans: Origins of expressions are never read by other blocks; only Decls are visible. Therefore, loans in a block that never reach an Origin associated with a Decl can be safely dropped by the analysis.
  3. Collapse ExpireFacts belonging to same source location into a single Fact.

Definition at line 38 of file LifetimeSafety.cpp.

References clang::CFG::dump(), clang::lifetimes::internal::FactsGenerator::run(), and clang::lifetimes::internal::runLifetimeChecker().

Referenced by clang::lifetimes::runLifetimeSafetyAnalysis().


The documentation for this class was generated from the following files: