2008-02-15 02:28:23 +08:00
|
|
|
// 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.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
2008-03-06 18:40:09 +08:00
|
|
|
// This file defines GRSimpleVals, a sub-class of GRTransferFuncs that
|
2008-02-15 02:28:23 +08:00
|
|
|
// 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"
|
2008-02-15 06:36:46 +08:00
|
|
|
#include "clang/Analysis/PathSensitive/GRExprEngine.h"
|
2008-02-15 02:28:23 +08:00
|
|
|
|
|
|
|
namespace clang {
|
|
|
|
|
2008-04-04 01:57:38 +08:00
|
|
|
class PathDiagnostic;
|
|
|
|
class ASTContext;
|
|
|
|
|
2008-02-15 02:28:23 +08:00
|
|
|
class GRSimpleVals : public GRTransferFuncs {
|
2008-07-18 23:27:58 +08:00
|
|
|
protected:
|
|
|
|
|
2008-11-15 08:20:05 +08:00
|
|
|
virtual SVal DetermEvalBinOpNN(GRExprEngine& Eng,
|
2008-07-18 23:27:58 +08:00
|
|
|
BinaryOperator::Opcode Op,
|
2008-10-17 13:57:07 +08:00
|
|
|
NonLoc L, NonLoc R);
|
2008-07-18 23:27:58 +08:00
|
|
|
|
2008-02-15 02:28:23 +08:00
|
|
|
public:
|
|
|
|
GRSimpleVals() {}
|
|
|
|
virtual ~GRSimpleVals() {}
|
|
|
|
|
2008-02-15 02:40:24 +08:00
|
|
|
// Casts.
|
|
|
|
|
2008-10-17 13:57:07 +08:00
|
|
|
virtual SVal EvalCast(GRExprEngine& Engine, NonLoc V, QualType CastT);
|
|
|
|
virtual SVal EvalCast(GRExprEngine& Engine, Loc V, QualType CastT);
|
2008-02-15 02:40:24 +08:00
|
|
|
|
|
|
|
// Unary Operators.
|
|
|
|
|
2008-10-17 13:57:07 +08:00
|
|
|
virtual SVal EvalMinus(GRExprEngine& Engine, UnaryOperator* U, NonLoc X);
|
2008-02-22 02:02:17 +08:00
|
|
|
|
2008-10-17 13:57:07 +08:00
|
|
|
virtual SVal EvalComplement(GRExprEngine& Engine, NonLoc X);
|
2008-02-15 03:37:24 +08:00
|
|
|
|
|
|
|
// Binary Operators.
|
|
|
|
|
2008-10-17 13:57:07 +08:00
|
|
|
virtual SVal EvalBinOp(GRExprEngine& Engine, BinaryOperator::Opcode Op,
|
|
|
|
Loc L, Loc R);
|
2008-02-16 07:15:23 +08:00
|
|
|
|
2008-02-15 08:52:26 +08:00
|
|
|
// Pointer arithmetic.
|
|
|
|
|
2008-10-17 13:57:07 +08:00
|
|
|
virtual SVal EvalBinOp(GRExprEngine& Engine, BinaryOperator::Opcode Op,
|
|
|
|
Loc L, NonLoc R);
|
2008-02-15 08:52:26 +08:00
|
|
|
|
2008-02-27 07:04:29 +08:00
|
|
|
// Calls.
|
|
|
|
|
2008-08-13 12:27:00 +08:00
|
|
|
virtual void EvalCall(ExplodedNodeSet<GRState>& Dst,
|
2008-03-12 09:21:45 +08:00
|
|
|
GRExprEngine& Engine,
|
2008-08-13 12:27:00 +08:00
|
|
|
GRStmtNodeBuilder<GRState>& Builder,
|
2008-10-17 13:57:07 +08:00
|
|
|
CallExpr* CE, SVal L,
|
2008-08-13 12:27:00 +08:00
|
|
|
ExplodedNode<GRState>* Pred);
|
2008-02-27 07:04:29 +08:00
|
|
|
|
2008-08-13 12:27:00 +08:00
|
|
|
virtual void EvalObjCMessageExpr(ExplodedNodeSet<GRState>& Dst,
|
2008-04-16 07:06:53 +08:00
|
|
|
GRExprEngine& Engine,
|
2008-08-13 12:27:00 +08:00
|
|
|
GRStmtNodeBuilder<GRState>& Builder,
|
2008-04-16 07:06:53 +08:00
|
|
|
ObjCMessageExpr* ME,
|
2008-08-13 12:27:00 +08:00
|
|
|
ExplodedNode<GRState>* Pred);
|
2008-04-16 07:06:53 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
2008-04-04 01:57:38 +08:00
|
|
|
static void GeneratePathDiagnostic(PathDiagnostic& PD, ASTContext& Ctx,
|
2008-08-13 12:27:00 +08:00
|
|
|
ExplodedNode<GRState>* N);
|
2008-04-04 01:57:38 +08:00
|
|
|
|
2008-02-16 07:15:23 +08:00
|
|
|
protected:
|
2008-02-15 02:28:23 +08:00
|
|
|
|
2008-10-17 13:57:07 +08:00
|
|
|
// Equality operators for Locs.
|
2008-02-22 02:02:17 +08:00
|
|
|
|
2008-10-17 13:57:07 +08:00
|
|
|
SVal EvalEQ(GRExprEngine& Engine, Loc L, Loc R);
|
|
|
|
SVal EvalNE(GRExprEngine& Engine, Loc L, Loc R);
|
2008-02-22 02:02:17 +08:00
|
|
|
};
|
2008-02-15 02:28:23 +08:00
|
|
|
|
|
|
|
} // end clang namespace
|
|
|
|
|
|
|
|
#endif
|