summaryrefslogtreecommitdiffstats
path: root/clang/Analysis/GRTransferFuncs.cpp
blob: 33663d6c60dd9884a7782fe64cb5ba5e0ce55736 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
//== GRTransferFuncs.cpp - 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 files defines GRTransferFuncs, which provides a base-class that
//  defines an interface for transfer functions used by GRExprEngine.
//
//===----------------------------------------------------------------------===//

#include "clang/Analysis/PathSensitive/GRTransferFuncs.h"

using namespace clang;

//===----------------------------------------------------------------------===//
// Transfer function for Casts.
//===----------------------------------------------------------------------===//

RValue GRTransferFuncs::EvalCast(ValueManager& ValMgr, RValue X,
                                 Expr* CastExpr) {
  
  switch (X.getBaseKind()) {
    default:
      assert(false && "Invalid RValue."); break;

    case RValue::LValueKind: 
      return EvalCast(ValMgr, cast<LValue>(X), CastExpr);

    case RValue::NonLValueKind:
      return EvalCast(ValMgr, cast<NonLValue>(X), CastExpr);
    
    case RValue::UninitializedKind:
    case RValue::UnknownKind: break;
  }
  
  return X;
}

// Binary Operators (except assignments and comma).

RValue GRTransferFuncs::EvalBinaryOp(ValueManager& ValMgr,
                                     BinaryOperator::Opcode Op,
                                     LValue LHS, LValue RHS) {
  
  switch (Op) {
    default:
      assert (false && "Not yet implemented.");
      
    case BinaryOperator::EQ:
      return EvalEQ(ValMgr, LHS, RHS);
      
    case BinaryOperator::NE:
      return EvalNE(ValMgr, LHS, RHS);
  }
}
OpenPOWER on IntegriCloud