blob: 3a73e41033ddfce188cdbc1b900fa0563be11677 [file] [log] [blame]
Ted Kremenekd59cccc2008-02-14 18:28:23 +00001// 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 Kremeneke01c9872008-02-14 22:36:46 +000020#include "clang/Analysis/PathSensitive/GRExprEngine.h"
Ted Kremenekd59cccc2008-02-14 18:28:23 +000021
22namespace clang {
23
24class GRSimpleVals : public GRTransferFuncs {
25public:
26 GRSimpleVals() {}
27 virtual ~GRSimpleVals() {}
28
Ted Kremenekc3f261d2008-02-14 18:40:24 +000029 // Casts.
30
Ted Kremenekd59cccc2008-02-14 18:28:23 +000031 virtual RValue EvalCast(ValueManager& ValMgr, NonLValue V, Expr* CastExpr);
32 virtual RValue EvalCast(ValueManager& ValMgr, LValue V, Expr* CastExpr);
Ted Kremenekc3f261d2008-02-14 18:40:24 +000033
34 // Unary Operators.
35
36 virtual NonLValue EvalMinus(ValueManager& ValMgr, UnaryOperator* U,
37 NonLValue X);
38
Ted Kremenek90e42032008-02-20 04:12:31 +000039 virtual NonLValue EvalPlus(ValueManager& ValMgr, UnaryOperator* U,
40 NonLValue X);
41
Ted Kremenekc3f261d2008-02-14 18:40:24 +000042 virtual NonLValue EvalComplement(ValueManager& ValMgr, NonLValue X);
Ted Kremenek6cb0b542008-02-14 19:37:24 +000043
44 // Binary Operators.
45
46 virtual NonLValue EvalBinaryOp(ValueManager& ValMgr,
47 BinaryOperator::Opcode Op,
48 NonLValue LHS, NonLValue RHS);
49
Ted Kremenekc6fbdcd2008-02-15 23:15:23 +000050 virtual RValue EvalBinaryOp(ValueManager& ValMgr,
51 BinaryOperator::Opcode Op,
52 LValue LHS, LValue RHS);
53
Ted Kremenekb640b3b2008-02-15 00:52:26 +000054 // Pointer arithmetic.
55
56 virtual LValue EvalBinaryOp(ValueManager& ValMgr, BinaryOperator::Opcode Op,
57 LValue LHS, NonLValue RHS);
58
Ted Kremenekc6fbdcd2008-02-15 23:15:23 +000059protected:
Ted Kremenek6cb0b542008-02-14 19:37:24 +000060 // Equality operators for LValues.
Ted Kremenekc6fbdcd2008-02-15 23:15:23 +000061 NonLValue EvalEQ(ValueManager& ValMgr, LValue LHS, LValue RHS);
62 NonLValue EvalNE(ValueManager& ValMgr, LValue LHS, LValue RHS);
Ted Kremenekd59cccc2008-02-14 18:28:23 +000063};
64
65
66} // end clang namespace
67
68#endif