blob: 34b1d4f183cf66d24e9b00f62c2a9f5eda85d9ee [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
39 virtual NonLValue EvalComplement(ValueManager& ValMgr, NonLValue X);
Ted Kremenek6cb0b542008-02-14 19:37:24 +000040
41 // Binary Operators.
42
43 virtual NonLValue EvalBinaryOp(ValueManager& ValMgr,
44 BinaryOperator::Opcode Op,
45 NonLValue LHS, NonLValue RHS);
46
Ted Kremenekc6fbdcd2008-02-15 23:15:23 +000047 virtual RValue EvalBinaryOp(ValueManager& ValMgr,
48 BinaryOperator::Opcode Op,
49 LValue LHS, LValue RHS);
50
Ted Kremenekb640b3b2008-02-15 00:52:26 +000051 // Pointer arithmetic.
52
53 virtual LValue EvalBinaryOp(ValueManager& ValMgr, BinaryOperator::Opcode Op,
54 LValue LHS, NonLValue RHS);
55
Ted Kremenekc6fbdcd2008-02-15 23:15:23 +000056protected:
Ted Kremenek6cb0b542008-02-14 19:37:24 +000057 // Equality operators for LValues.
Ted Kremenekc6fbdcd2008-02-15 23:15:23 +000058 NonLValue EvalEQ(ValueManager& ValMgr, LValue LHS, LValue RHS);
59 NonLValue EvalNE(ValueManager& ValMgr, LValue LHS, LValue RHS);
Ted Kremenekd59cccc2008-02-14 18:28:23 +000060};
61
62
63} // end clang namespace
64
65#endif