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 | // |
| 10 | // This files defines GRSimpleVals, a sub-class of GRTransferFuncs that |
| 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 | d59cccc | 2008-02-14 18:28:23 +0000 | [diff] [blame] | 31 | virtual RValue EvalCast(ValueManager& ValMgr, NonLValue V, Expr* CastExpr); |
| 32 | virtual RValue EvalCast(ValueManager& ValMgr, LValue V, Expr* CastExpr); |
Ted Kremenek | c3f261d | 2008-02-14 18:40:24 +0000 | [diff] [blame] | 33 | |
| 34 | // Unary Operators. |
| 35 | |
| 36 | virtual NonLValue EvalMinus(ValueManager& ValMgr, UnaryOperator* U, |
| 37 | NonLValue X); |
| 38 | |
Ted Kremenek | 90e4203 | 2008-02-20 04:12:31 +0000 | [diff] [blame] | 39 | virtual NonLValue EvalPlus(ValueManager& ValMgr, UnaryOperator* U, |
| 40 | NonLValue X); |
| 41 | |
Ted Kremenek | c3f261d | 2008-02-14 18:40:24 +0000 | [diff] [blame] | 42 | virtual NonLValue EvalComplement(ValueManager& ValMgr, NonLValue X); |
Ted Kremenek | 6cb0b54 | 2008-02-14 19:37:24 +0000 | [diff] [blame] | 43 | |
| 44 | // Binary Operators. |
| 45 | |
| 46 | virtual NonLValue EvalBinaryOp(ValueManager& ValMgr, |
| 47 | BinaryOperator::Opcode Op, |
| 48 | NonLValue LHS, NonLValue RHS); |
| 49 | |
Ted Kremenek | c6fbdcd | 2008-02-15 23:15:23 +0000 | [diff] [blame] | 50 | virtual RValue EvalBinaryOp(ValueManager& ValMgr, |
| 51 | BinaryOperator::Opcode Op, |
| 52 | LValue LHS, LValue RHS); |
| 53 | |
Ted Kremenek | b640b3b | 2008-02-15 00:52:26 +0000 | [diff] [blame] | 54 | // Pointer arithmetic. |
| 55 | |
| 56 | virtual LValue EvalBinaryOp(ValueManager& ValMgr, BinaryOperator::Opcode Op, |
| 57 | LValue LHS, NonLValue RHS); |
| 58 | |
Ted Kremenek | c6fbdcd | 2008-02-15 23:15:23 +0000 | [diff] [blame] | 59 | protected: |
Ted Kremenek | 6cb0b54 | 2008-02-14 19:37:24 +0000 | [diff] [blame] | 60 | // Equality operators for LValues. |
Ted Kremenek | c6fbdcd | 2008-02-15 23:15:23 +0000 | [diff] [blame] | 61 | NonLValue EvalEQ(ValueManager& ValMgr, LValue LHS, LValue RHS); |
| 62 | NonLValue EvalNE(ValueManager& ValMgr, LValue LHS, LValue RHS); |
Ted Kremenek | d59cccc | 2008-02-14 18:28:23 +0000 | [diff] [blame] | 63 | }; |
| 64 | |
| 65 | |
| 66 | } // end clang namespace |
| 67 | |
| 68 | #endif |