//== GRTransferFuncs.h - Path-Sens. Transfer Functions Interface -*- C++ -*--=// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // This file defines GRTransferFuncs, which provides a base-class that // defines an interface for transfer functions used by GRExprEngine. // //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_ANALYSIS_GRTF #define LLVM_CLANG_ANALYSIS_GRTF #include "clang/Analysis/PathSensitive/SVals.h" #include "clang/Analysis/PathSensitive/GRCoreEngine.h" #include "clang/Analysis/PathSensitive/GRState.h" #include namespace clang { class GRExprEngine; class ObjCMessageExpr; class GRTransferFuncs { friend class GRExprEngine; protected: virtual SVal DetermEvalBinOpNN(GRExprEngine& Eng, BinaryOperator::Opcode Op, NonLoc L, NonLoc R) { return UnknownVal(); } public: GRTransferFuncs() {} virtual ~GRTransferFuncs() {} virtual void RegisterPrinters(std::vector& Printers) {} virtual void RegisterChecks(GRExprEngine& Eng); // Casts. virtual SVal EvalCast(GRExprEngine& Engine, NonLoc V, QualType CastT) =0; virtual SVal EvalCast(GRExprEngine& Engine, Loc V, QualType CastT) = 0; // Unary Operators. virtual SVal EvalMinus(GRExprEngine& Engine, UnaryOperator* U, NonLoc X) = 0; virtual SVal EvalComplement(GRExprEngine& Engine, NonLoc X) = 0; // Binary Operators. // FIXME: We're moving back towards using GREXprEngine directly. No need // for OStates virtual void EvalBinOpNN(GRStateSet& OStates, GRExprEngine& Eng, const GRState* St, Expr* Ex, BinaryOperator::Opcode Op, NonLoc L, NonLoc R); virtual SVal EvalBinOp(GRExprEngine& Engine, BinaryOperator::Opcode Op, Loc L, Loc R) = 0; // Pointer arithmetic. virtual SVal EvalBinOp(GRExprEngine& Engine, BinaryOperator::Opcode Op, Loc L, NonLoc R) = 0; // Calls. virtual void EvalCall(ExplodedNodeSet& Dst, GRExprEngine& Engine, GRStmtNodeBuilder& Builder, CallExpr* CE, SVal L, ExplodedNode* Pred) {} virtual void EvalObjCMessageExpr(ExplodedNodeSet& Dst, GRExprEngine& Engine, GRStmtNodeBuilder& Builder, ObjCMessageExpr* ME, ExplodedNode* Pred) {} // Stores. /// EvalStore - Evaluate the effects of a store, creating a new node /// the represents the effect of binding 'Val' to the location 'TargetLV'. // TargetLV is guaranteed to either be an UnknownVal or an Loc. virtual void EvalStore(ExplodedNodeSet& Dst, GRExprEngine& Engine, GRStmtNodeBuilder& Builder, Expr* E, ExplodedNode* Pred, const GRState* St, SVal TargetLV, SVal Val); // End-of-path and dead symbol notification. virtual void EvalEndPath(GRExprEngine& Engine, GREndPathNodeBuilder& Builder) {} virtual void EvalDeadSymbols(ExplodedNodeSet& Dst, GRExprEngine& Engine, GRStmtNodeBuilder& Builder, ExplodedNode* Pred, Stmt* S, const GRState* St, const GRStateManager::DeadSymbolsTy& Dead) {} // Return statements. virtual void EvalReturn(ExplodedNodeSet& Dst, GRExprEngine& Engine, GRStmtNodeBuilder& Builder, ReturnStmt* S, ExplodedNode* Pred) {} // Assumptions. virtual const GRState* EvalAssume(GRStateManager& VMgr, const GRState* St, SVal Cond, bool Assumption, bool& isFeasible) { return St; } }; } // end clang namespace #endif