Skip to content
GRSimpleVals.h 2.7 KiB
Newer Older
// GRSimpleVals.h - Transfer functions for tracking simple values -*- C++ -*--//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
Gabor Greif's avatar
Gabor Greif committed
//  This file defines GRSimpleVals, a sub-class of GRTransferFuncs that
//  provides transfer functions for performing simple value tracking with
//  limited support for symbolics.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_CLANG_ANALYSIS_GRSIMPLEVALS
#define LLVM_CLANG_ANALYSIS_GRSIMPLEVALS

#include "clang/Analysis/PathSensitive/GRTransferFuncs.h"
#include "clang/Analysis/PathSensitive/GRExprEngine.h"
class GRSimpleVals : public GRTransferFuncs {
protected:
  
  virtual RVal DetermEvalBinOpNN(ValueStateManager& StateMgr,
                                 BinaryOperator::Opcode Op,
                                 NonLVal L, NonLVal R);
  
public:
  GRSimpleVals() {}
  virtual ~GRSimpleVals() {}
  
  virtual RVal EvalCast(GRExprEngine& Engine, NonLVal V, QualType CastT);
  virtual RVal EvalCast(GRExprEngine& Engine, LVal V, QualType CastT);
  virtual RVal EvalMinus(GRExprEngine& Engine, UnaryOperator* U, NonLVal X);
  virtual RVal EvalComplement(GRExprEngine& Engine, NonLVal X);
  virtual RVal EvalBinOp(GRExprEngine& Engine, BinaryOperator::Opcode Op,
  virtual RVal EvalBinOp(GRExprEngine& Engine, BinaryOperator::Opcode Op,
  virtual void EvalCall(ExplodedNodeSet<ValueState>& Dst,
                        GRExprEngine& Engine,
                        GRStmtNodeBuilder<ValueState>& Builder,
                        CallExpr* CE, RVal L,
  virtual void EvalObjCMessageExpr(ExplodedNodeSet<ValueState>& Dst,
                                   GRExprEngine& Engine,
                                   GRStmtNodeBuilder<ValueState>& Builder,
                                   ObjCMessageExpr* ME,
                                   ExplodedNode<ValueState>* Pred);
  
  
  
  static void GeneratePathDiagnostic(PathDiagnostic& PD, ASTContext& Ctx,
                                     ExplodedNode<ValueState>* N);
  
  RVal EvalEQ(GRExprEngine& Engine, LVal L, LVal R);
  RVal EvalNE(GRExprEngine& Engine, LVal L, LVal R);