Ted Kremenek | d59cccc | 2008-02-14 18:28:23 +0000 | [diff] [blame] | 1 | // GRSimpleVals.h - Transfer functions for tracking simple values -*- C++ -*--// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
Gabor Greif | 843e934 | 2008-03-06 10:40:09 +0000 | [diff] [blame^] | 10 | // This file defines GRSimpleVals, a sub-class of GRTransferFuncs that |
Ted Kremenek | d59cccc | 2008-02-14 18:28:23 +0000 | [diff] [blame] | 11 | // provides transfer functions for performing simple value tracking with |
| 12 | // limited support for symbolics. |
| 13 | // |
| 14 | //===----------------------------------------------------------------------===// |
| 15 | |
| 16 | #ifndef LLVM_CLANG_ANALYSIS_GRSIMPLEVALS |
| 17 | #define LLVM_CLANG_ANALYSIS_GRSIMPLEVALS |
| 18 | |
| 19 | #include "clang/Analysis/PathSensitive/GRTransferFuncs.h" |
Ted Kremenek | e01c987 | 2008-02-14 22:36:46 +0000 | [diff] [blame] | 20 | #include "clang/Analysis/PathSensitive/GRExprEngine.h" |
Ted Kremenek | d59cccc | 2008-02-14 18:28:23 +0000 | [diff] [blame] | 21 | |
| 22 | namespace clang { |
| 23 | |
| 24 | class GRSimpleVals : public GRTransferFuncs { |
| 25 | public: |
| 26 | GRSimpleVals() {} |
| 27 | virtual ~GRSimpleVals() {} |
| 28 | |
Ted Kremenek | c3f261d | 2008-02-14 18:40:24 +0000 | [diff] [blame] | 29 | // Casts. |
| 30 | |
Ted Kremenek | 9ef1ec9 | 2008-02-21 18:43:30 +0000 | [diff] [blame] | 31 | virtual RVal EvalCast(ValueManager& ValMgr, NonLVal V, QualType CastT); |
| 32 | virtual RVal EvalCast(ValueManager& ValMgr, LVal V, QualType CastT); |
Ted Kremenek | c3f261d | 2008-02-14 18:40:24 +0000 | [diff] [blame] | 33 | |
| 34 | // Unary Operators. |
| 35 | |
Ted Kremenek | aa1c4e5 | 2008-02-21 18:02:17 +0000 | [diff] [blame] | 36 | virtual RVal EvalMinus(ValueManager& ValMgr, UnaryOperator* U, NonLVal X); |
| 37 | |
| 38 | virtual RVal EvalComplement(ValueManager& ValMgr, NonLVal X); |
Ted Kremenek | 6cb0b54 | 2008-02-14 19:37:24 +0000 | [diff] [blame] | 39 | |
| 40 | // Binary Operators. |
| 41 | |
Ted Kremenek | aa1c4e5 | 2008-02-21 18:02:17 +0000 | [diff] [blame] | 42 | virtual RVal EvalBinOp(ValueManager& ValMgr, BinaryOperator::Opcode Op, |
| 43 | NonLVal L, NonLVal R); |
Ted Kremenek | 6cb0b54 | 2008-02-14 19:37:24 +0000 | [diff] [blame] | 44 | |
Ted Kremenek | aa1c4e5 | 2008-02-21 18:02:17 +0000 | [diff] [blame] | 45 | virtual RVal EvalBinOp(ValueManager& ValMgr, BinaryOperator::Opcode Op, |
| 46 | LVal L, LVal R); |
Ted Kremenek | c6fbdcd | 2008-02-15 23:15:23 +0000 | [diff] [blame] | 47 | |
Ted Kremenek | b640b3b | 2008-02-15 00:52:26 +0000 | [diff] [blame] | 48 | // Pointer arithmetic. |
| 49 | |
Ted Kremenek | aa1c4e5 | 2008-02-21 18:02:17 +0000 | [diff] [blame] | 50 | virtual RVal EvalBinOp(ValueManager& ValMgr, BinaryOperator::Opcode Op, |
| 51 | LVal L, NonLVal R); |
Ted Kremenek | b640b3b | 2008-02-15 00:52:26 +0000 | [diff] [blame] | 52 | |
Ted Kremenek | 0674769 | 2008-02-26 23:04:29 +0000 | [diff] [blame] | 53 | // Calls. |
| 54 | |
Ted Kremenek | 330dddd | 2008-03-05 00:33:14 +0000 | [diff] [blame] | 55 | virtual void EvalCall(ExplodedNodeSet<ValueState>& Dst, |
| 56 | ValueStateManager& StateMgr, |
| 57 | GRStmtNodeBuilder<ValueState>& Builder, |
| 58 | ValueManager& ValMgr, |
| 59 | CallExpr* CE, LVal L, |
| 60 | ExplodedNode<ValueState>* Pred); |
Ted Kremenek | 0674769 | 2008-02-26 23:04:29 +0000 | [diff] [blame] | 61 | |
Ted Kremenek | c6fbdcd | 2008-02-15 23:15:23 +0000 | [diff] [blame] | 62 | protected: |
Ted Kremenek | d59cccc | 2008-02-14 18:28:23 +0000 | [diff] [blame] | 63 | |
Ted Kremenek | aa1c4e5 | 2008-02-21 18:02:17 +0000 | [diff] [blame] | 64 | // Equality operators for LVals. |
| 65 | |
| 66 | RVal EvalEQ(ValueManager& ValMgr, LVal L, LVal R); |
| 67 | RVal EvalNE(ValueManager& ValMgr, LVal L, LVal R); |
| 68 | }; |
Ted Kremenek | d59cccc | 2008-02-14 18:28:23 +0000 | [diff] [blame] | 69 | |
| 70 | } // end clang namespace |
| 71 | |
| 72 | #endif |