clang 22.0.0git
clang::lifetimes::internal::FactGenerator Class Reference
Inheritance diagram for clang::lifetimes::internal::FactGenerator:
[legend]

Public Member Functions

 FactGenerator (FactManager &FactMgr, AnalysisDeclContext &AC)
void run ()
void VisitDeclStmt (const DeclStmt *DS)
void VisitDeclRefExpr (const DeclRefExpr *DRE)
void VisitCXXConstructExpr (const CXXConstructExpr *CCE)
void VisitCXXMemberCallExpr (const CXXMemberCallExpr *MCE)
void VisitCXXNullPtrLiteralExpr (const CXXNullPtrLiteralExpr *N)
void VisitImplicitCastExpr (const ImplicitCastExpr *ICE)
void VisitUnaryOperator (const UnaryOperator *UO)
void VisitReturnStmt (const ReturnStmt *RS)
void VisitBinaryOperator (const BinaryOperator *BO)
void VisitCXXOperatorCallExpr (const CXXOperatorCallExpr *OCE)
void VisitCXXFunctionalCastExpr (const CXXFunctionalCastExpr *FCE)
void VisitInitListExpr (const InitListExpr *ILE)
void VisitMaterializeTemporaryExpr (const MaterializeTemporaryExpr *MTE)
void handleDestructor (const CFGAutomaticObjDtor &DtorOpt)
Public Member Functions inherited from clang::StmtVisitorBase< Ptr, ImplClass, RetTy, ParamTys >
RetTy Visit (PTR(Stmt) S, ParamTys... P)
 BINOP_FALLBACK (PtrMemD) BINOP_FALLBACK(PtrMemI) BINOP_FALLBACK(Mul) BINOP_FALLBACK(Div) BINOP_FALLBACK(Rem) BINOP_FALLBACK(Add) BINOP_FALLBACK(Sub) BINOP_FALLBACK(Shl) BINOP_FALLBACK(LT) BINOP_FALLBACK(GT) BINOP_FALLBACK(LE) BINOP_FALLBACK(GE) BINOP_FALLBACK(EQ) BINOP_FALLBACK(NE) BINOP_FALLBACK(And) BINOP_FALLBACK(Xor) BINOP_FALLBACK(Or) BINOP_FALLBACK(LAnd) BINOP_FALLBACK(LOr) CAO_FALLBACK(MulAssign) CAO_FALLBACK(DivAssign) CAO_FALLBACK(RemAssign) CAO_FALLBACK(AddAssign) CAO_FALLBACK(SubAssign) CAO_FALLBACK(ShlAssign) CAO_FALLBACK(ShrAssign) CAO_FALLBACK(AndAssign) CAO_FALLBACK(OrAssign) UNARYOP_FALLBACK(PostInc) UNARYOP_FALLBACK(PostDec) UNARYOP_FALLBACK(PreInc) UNARYOP_FALLBACK(PreDec) UNARYOP_FALLBACK(AddrOf) UNARYOP_FALLBACK(Deref) UNARYOP_FALLBACK(Plus) UNARYOP_FALLBACK(Minus) UNARYOP_FALLBACK(Not) UNARYOP_FALLBACK(LNot) UNARYOP_FALLBACK(Real) UNARYOP_FALLBACK(Imag) UNARYOP_FALLBACK(Extension) UNARYOP_FALLBACK(Coawait) RetTy VisitStmt(PTR(Stmt) Node

Additional Inherited Members

Public Attributes inherited from clang::StmtVisitorBase< Ptr, ImplClass, RetTy, ParamTys >
ParamTys P { return RetTy()

Detailed Description

Definition at line 427 of file LifetimeSafety.cpp.

Constructor & Destructor Documentation

◆ FactGenerator()

clang::lifetimes::internal::FactGenerator::FactGenerator ( FactManager & FactMgr,
AnalysisDeclContext & AC )
inline

Definition at line 431 of file LifetimeSafety.cpp.

Member Function Documentation

◆ handleDestructor()

void clang::lifetimes::internal::FactGenerator::handleDestructor ( const CFGAutomaticObjDtor & DtorOpt)
inline

TODO: Also handle trivial destructors (e.g., for int variables) which will never have a CFGAutomaticObjDtor node. TODO: Handle loans to temporaries. TODO: Consider using clang::CFG::BuildOptions::AddLifetime to reuse the lifetime ends.

TODO(opt): Do better than a linear search to find loans associated with 'DestructedVD'.

Definition at line 575 of file LifetimeSafety.cpp.

References clang::lifetimes::internal::AccessPath::D, clang::Stmt::getEndLoc(), clang::CFGAutomaticObjDtor::getTriggerStmt(), and clang::CFGAutomaticObjDtor::getVarDecl().

Referenced by run().

◆ run()

◆ VisitBinaryOperator()

void clang::lifetimes::internal::FactGenerator::VisitBinaryOperator ( const BinaryOperator * BO)
inline

◆ VisitCXXConstructExpr()

void clang::lifetimes::internal::FactGenerator::VisitCXXConstructExpr ( const CXXConstructExpr * CCE)
inline

Definition at line 481 of file LifetimeSafety.cpp.

References clang::Expr::getType().

◆ VisitCXXFunctionalCastExpr()

void clang::lifetimes::internal::FactGenerator::VisitCXXFunctionalCastExpr ( const CXXFunctionalCastExpr * FCE)
inline

Definition at line 549 of file LifetimeSafety.cpp.

References clang::CastExpr::getSubExpr(), and clang::Expr::getType().

◆ VisitCXXMemberCallExpr()

void clang::lifetimes::internal::FactGenerator::VisitCXXMemberCallExpr ( const CXXMemberCallExpr * MCE)
inline

◆ VisitCXXNullPtrLiteralExpr()

void clang::lifetimes::internal::FactGenerator::VisitCXXNullPtrLiteralExpr ( const CXXNullPtrLiteralExpr * N)
inline

TODO: Handle nullptr expr as a special 'null' loan. Uninitialized pointers can use the same type of loan.

Definition at line 500 of file LifetimeSafety.cpp.

◆ VisitCXXOperatorCallExpr()

void clang::lifetimes::internal::FactGenerator::VisitCXXOperatorCallExpr ( const CXXOperatorCallExpr * OCE)
inline

◆ VisitDeclRefExpr()

void clang::lifetimes::internal::FactGenerator::VisitDeclRefExpr ( const DeclRefExpr * DRE)
inline

Definition at line 460 of file LifetimeSafety.cpp.

References clang::Expr::getType().

◆ VisitDeclStmt()

void clang::lifetimes::internal::FactGenerator::VisitDeclStmt ( const DeclStmt * DS)
inline

Definition at line 452 of file LifetimeSafety.cpp.

References clang::DeclStmt::decls().

◆ VisitImplicitCastExpr()

void clang::lifetimes::internal::FactGenerator::VisitImplicitCastExpr ( const ImplicitCastExpr * ICE)
inline

Definition at line 506 of file LifetimeSafety.cpp.

References clang::CastExpr::getSubExpr().

◆ VisitInitListExpr()

void clang::lifetimes::internal::FactGenerator::VisitInitListExpr ( const InitListExpr * ILE)
inline

◆ VisitMaterializeTemporaryExpr()

void clang::lifetimes::internal::FactGenerator::VisitMaterializeTemporaryExpr ( const MaterializeTemporaryExpr * MTE)
inline

Definition at line 567 of file LifetimeSafety.cpp.

References clang::MaterializeTemporaryExpr::getSubExpr().

◆ VisitReturnStmt()

void clang::lifetimes::internal::FactGenerator::VisitReturnStmt ( const ReturnStmt * RS)
inline

Definition at line 529 of file LifetimeSafety.cpp.

References clang::ReturnStmt::getRetValue().

◆ VisitUnaryOperator()

void clang::lifetimes::internal::FactGenerator::VisitUnaryOperator ( const UnaryOperator * UO)
inline

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