aboutsummaryrefslogtreecommitdiff
path: root/include/clang/StaticAnalyzer/PathSensitive/TransferFuncs.h
blob: 950143d91da0ad04ccecbd1b1d153c19d7f6e44c (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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
//== TransferFuncs.h - 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 file defines TransferFuncs, which provides a base-class that
//  defines an interface for transfer functions used by ExprEngine.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_CLANG_GR_TRANSFERFUNCS
#define LLVM_CLANG_GR_TRANSFERFUNCS

#include "clang/StaticAnalyzer/PathSensitive/GRState.h"
#include "clang/StaticAnalyzer/PathSensitive/SVals.h"
#include <vector>

namespace clang {
class ObjCMessageExpr;

namespace ento {
class ExplodedNode;
class ExplodedNodeSet;
class EndOfFunctionNodeBuilder;
class ExprEngine;
class StmtNodeBuilder;
class StmtNodeBuilderRef;

class TransferFuncs {
public:
  TransferFuncs() {}
  virtual ~TransferFuncs() {}

  virtual void RegisterPrinters(std::vector<GRState::Printer*>& Printers) {}
  virtual void RegisterChecks(ExprEngine& Eng) {}


  // Calls.

  virtual void evalCall(ExplodedNodeSet& Dst,
                        ExprEngine& Engine,
                        StmtNodeBuilder& Builder,
                        const CallExpr* CE, SVal L,
                        ExplodedNode* Pred) {}

  virtual void evalObjCMessageExpr(ExplodedNodeSet& Dst,
                                   ExprEngine& Engine,
                                   StmtNodeBuilder& Builder,
                                   const ObjCMessageExpr* ME,
                                   ExplodedNode* Pred,
                                   const GRState *state) {}

  // Stores.

  virtual void evalBind(StmtNodeBuilderRef& B, SVal location, SVal val) {}

  // End-of-path and dead symbol notification.

  virtual void evalEndPath(ExprEngine& Engine,
                           EndOfFunctionNodeBuilder& Builder) {}


  virtual void evalDeadSymbols(ExplodedNodeSet& Dst,
                               ExprEngine& Engine,
                               StmtNodeBuilder& Builder,
                               ExplodedNode* Pred,
                               const GRState* state,
                               SymbolReaper& SymReaper) {}

  // Return statements.
  virtual void evalReturn(ExplodedNodeSet& Dst,
                          ExprEngine& Engine,
                          StmtNodeBuilder& Builder,
                          const ReturnStmt* S,
                          ExplodedNode* Pred) {}

  // Assumptions.
  virtual const GRState* evalAssume(const GRState *state,
                                    SVal Cond, bool Assumption) {
    return state;
  }  
};

} // end GR namespace

} // end clang namespace

#endif