aboutsummaryrefslogtreecommitdiff
path: root/include/clang
diff options
context:
space:
mode:
authorZhongxing Xu <xuzhongxing@gmail.com>2008-08-29 14:52:36 +0000
committerZhongxing Xu <xuzhongxing@gmail.com>2008-08-29 14:52:36 +0000
commit39cfed397baf1ffca0ab85cfa3d03087fe80e2cc (patch)
tree61ea23083c1597ea7d9a01005aa405de9fc79055 /include/clang
parent85c59edda02df48fae8dc85049743319bc6e7e89 (diff)
Migrate the rest symbolic analysis stuff to BasicConstraintManager.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55536 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang')
-rw-r--r--include/clang/Analysis/PathSensitive/ConstraintManager.h26
-rw-r--r--include/clang/Analysis/PathSensitive/GRState.h28
2 files changed, 36 insertions, 18 deletions
diff --git a/include/clang/Analysis/PathSensitive/ConstraintManager.h b/include/clang/Analysis/PathSensitive/ConstraintManager.h
index 39e5918c19..6014e66015 100644
--- a/include/clang/Analysis/PathSensitive/ConstraintManager.h
+++ b/include/clang/Analysis/PathSensitive/ConstraintManager.h
@@ -1,17 +1,39 @@
-#ifndef CONSTRAINT_MANAGER_H
-#define CONSTRAINT_MANAGER_H
+#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 RVal;
+class SymbolID;
class ConstraintManager {
public:
virtual ~ConstraintManager();
virtual const GRState* Assume(const GRState* St, RVal Cond, bool Assumption,
bool& isFeasible) = 0;
+
+ virtual const GRState* AddNE(const GRState* St, SymbolID sym,
+ const llvm::APSInt& V) = 0;
+ virtual const llvm::APSInt* getSymVal(const GRState* St, SymbolID sym) = 0;
+
+ virtual bool isEqual(const GRState* St, SymbolID 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;
};
ConstraintManager* CreateBasicConstraintManager(GRStateManager& statemgr);
diff --git a/include/clang/Analysis/PathSensitive/GRState.h b/include/clang/Analysis/PathSensitive/GRState.h
index 8570a9d0c2..993977984f 100644
--- a/include/clang/Analysis/PathSensitive/GRState.h
+++ b/include/clang/Analysis/PathSensitive/GRState.h
@@ -115,13 +115,6 @@ public:
Profile(ID, this);
}
- // Queries.
-
- bool isNotEqual(SymbolID sym, const llvm::APSInt& V) const;
- bool isEqual(SymbolID sym, const llvm::APSInt& V) const;
-
- const llvm::APSInt* getSymVal(SymbolID sym) const;
-
RVal LookupExpr(Expr* E) const {
return Env.LookupExpr(E);
}
@@ -153,7 +146,8 @@ public:
void* const* FindGDM(void* K) const;
template <typename T>
- typename GRStateTrait<T>::data_type get() const {
+ typename GRStateTrait<T>::data_type
+ get() const {
return GRStateTrait<T>::MakeData(FindGDM(GRStateTrait<T>::GDMIndex()));
}
@@ -173,6 +167,7 @@ public:
};
void print(std::ostream& Out, StoreManager& StoreMgr,
+ ConstraintManager& ConstraintMgr,
Printer **Beg = 0, Printer **End = 0,
const char* nl = "\n", const char *sep = "") const;
};
@@ -412,12 +407,6 @@ public:
const GRState* getPersistentState(GRState& Impl);
- const GRState* AddEQ(const GRState* St, SymbolID sym,
- const llvm::APSInt& V);
-
- const GRState* AddNE(const GRState* St, SymbolID sym,
- const llvm::APSInt& V);
-
bool isEqual(const GRState* state, Expr* Ex, const llvm::APSInt& V);
bool isEqual(const GRState* state, Expr* Ex, uint64_t);
@@ -460,12 +449,19 @@ public:
return GRStateTrait<T>::MakeContext(p);
}
-
- // Assumption logic.
+
const GRState* Assume(const GRState* St, RVal Cond, bool Assumption,
bool& isFeasible) {
return ConstraintMgr->Assume(St, Cond, Assumption, isFeasible);
}
+
+ const GRState* AddNE(const GRState* St, SymbolID sym, const llvm::APSInt& V) {
+ return ConstraintMgr->AddNE(St, sym, V);
+ }
+
+ const llvm::APSInt* getSymVal(const GRState* St, SymbolID sym) {
+ return ConstraintMgr->getSymVal(St, sym);
+ }
};
//===----------------------------------------------------------------------===//