aboutsummaryrefslogtreecommitdiff
path: root/include/clang/Analysis/PathSensitive/ConstraintManager.h
blob: cec7f69df3b7cb958cd52d50dfb4fa7ee58ec8a1 (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
//== ConstraintManager.h - Constraints on symbolic values.-------*- C++ -*--==//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
//  This file defined the interface to manage constraints on symbolic values.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_CLANG_ANALYSIS_CONSTRAINT_MANAGER_H
#define LLVM_CLANG_ANALYSIS_CONSTRAINT_MANAGER_H

// FIXME: Typedef LiveSymbolsTy/DeadSymbolsTy at a more appropriate place.
#include "clang/Analysis/PathSensitive/Store.h"

namespace llvm {
class APSInt;
}

namespace clang {

class GRState;
class GRStateManager;
class SVal;
class SymbolRef;

class ConstraintManager {
public:
  virtual ~ConstraintManager();
  virtual const GRState* Assume(const GRState* St, SVal Cond, 
                                bool Assumption, bool& isFeasible) = 0;

  virtual const GRState* AssumeInBound(const GRState* St, SVal Idx, 
                                       SVal UpperBound, bool Assumption,
                                       bool& isFeasible) = 0;

  virtual const GRState* AddNE(const GRState* St, SymbolRef sym, 
                               const llvm::APSInt& V) = 0;
  virtual const llvm::APSInt* getSymVal(const GRState* St, SymbolRef sym) = 0;

  virtual bool isEqual(const GRState* St, SymbolRef sym, 
                       const llvm::APSInt& V) const = 0;

  virtual const GRState* RemoveDeadBindings(const GRState* St,
                                    StoreManager::LiveSymbolsTy& LSymbols,
                                    StoreManager::DeadSymbolsTy& DSymbols) = 0;

  virtual void print(const GRState* St, std::ostream& Out, 
                     const char* nl, const char *sep) = 0;

  virtual void EndPath(const GRState* St) {}
};

ConstraintManager* CreateBasicConstraintManager(GRStateManager& statemgr);

} // end clang namespace

#endif