Ted Kremenek | d59cccc | 2008-02-14 18:28:23 +0000 | [diff] [blame] | 1 | //== GRTransferFuncs.cpp - Path-Sens. Transfer Functions Interface -*- 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 GRTransferFuncs, which provides a base-class that |
| 11 | // defines an interface for transfer functions used by GRExprEngine. |
| 12 | // |
| 13 | //===----------------------------------------------------------------------===// |
| 14 | |
| 15 | #include "clang/Analysis/PathSensitive/GRTransferFuncs.h" |
| 16 | |
| 17 | using namespace clang; |
| 18 | |
| 19 | //===----------------------------------------------------------------------===// |
| 20 | // Transfer function for Casts. |
| 21 | //===----------------------------------------------------------------------===// |
| 22 | |
| 23 | RValue GRTransferFuncs::EvalCast(ValueManager& ValMgr, RValue X, |
| 24 | Expr* CastExpr) { |
| 25 | |
| 26 | switch (X.getBaseKind()) { |
| 27 | default: |
| 28 | assert(false && "Invalid RValue."); break; |
| 29 | |
| 30 | case RValue::LValueKind: |
| 31 | return EvalCast(ValMgr, cast<LValue>(X), CastExpr); |
| 32 | |
| 33 | case RValue::NonLValueKind: |
| 34 | return EvalCast(ValMgr, cast<NonLValue>(X), CastExpr); |
| 35 | |
| 36 | case RValue::UninitializedKind: |
| 37 | case RValue::UnknownKind: break; |
| 38 | } |
| 39 | |
| 40 | return X; |
| 41 | } |