summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis/SimpleConstraintManager.h
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-02-14 17:08:39 +0000
committerTed Kremenek <kremenek@apple.com>2009-02-14 17:08:39 +0000
commit7efe43db994db1b17675c6b646f01c2495893d5f (patch)
tree1a054d91beb3ecc997a41ca590dddd614f1063cf /clang/lib/Analysis/SimpleConstraintManager.h
parent7e96595f118a2ac02ed57ca359235faf36fa804b (diff)
downloadbcm5719-llvm-7efe43db994db1b17675c6b646f01c2495893d5f.tar.gz
bcm5719-llvm-7efe43db994db1b17675c6b646f01c2495893d5f.zip
Patch by Ben Laurie:
ConstraintManager: - constify getSymVal() BasicConstraintManager: - Pull out logic that would be common to ConstraintManagers of a similar nature and put them in a parent class called 'SimpleConstraintManager'. RangeConstraintManager: - Added a new prototype ConstraintManager to track ranges of variables! This ConstraintManager keeps tracks of ranges of concrete integers that a symbolic integer may have. AnalysisConsumer: - Add driver option to use RangeConstraintManager with GRExprEngine-based analyses. llvm-svn: 64558
Diffstat (limited to 'clang/lib/Analysis/SimpleConstraintManager.h')
-rw-r--r--clang/lib/Analysis/SimpleConstraintManager.h160
1 files changed, 160 insertions, 0 deletions
diff --git a/clang/lib/Analysis/SimpleConstraintManager.h b/clang/lib/Analysis/SimpleConstraintManager.h
new file mode 100644
index 00000000000..5d5a5133694
--- /dev/null
+++ b/clang/lib/Analysis/SimpleConstraintManager.h
@@ -0,0 +1,160 @@
+//== SimpleConstraintManager.h ----------------------------------*- C++ -*--==//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// Code shared between BasicConstraintManager and RangeConstraintManager.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_CLANG_ANALYSIS_SIMPLE_CONSTRAINT_MANAGER_H
+#define LLVM_CLANG_ANALYSIS_SIMPLE_CONSTRAINT_MANAGER_H
+
+#include "clang/Analysis/PathSensitive/ConstraintManager.h"
+#include "clang/Analysis/PathSensitive/GRState.h"
+
+namespace clang {
+
+class SimpleConstraintManager : public ConstraintManager {
+protected:
+ GRStateManager& StateMgr;
+public:
+ SimpleConstraintManager(GRStateManager& statemgr)
+ : StateMgr(statemgr) {}
+ virtual ~SimpleConstraintManager();
+ virtual const GRState* Assume(const GRState* St, SVal Cond, bool Assumption,
+ bool& isFeasible);
+
+ const GRState* Assume(const GRState* St, Loc Cond, bool Assumption,
+ bool& isFeasible);
+
+ const GRState* AssumeAux(const GRState* St, Loc Cond,bool Assumption,
+ bool& isFeasible);
+
+ const GRState* Assume(const GRState* St, NonLoc Cond, bool Assumption,
+ bool& isFeasible);
+
+ const GRState* AssumeAux(const GRState* St, NonLoc Cond, bool Assumption,
+ bool& isFeasible);
+
+ const GRState* AssumeSymInt(const GRState* St, bool Assumption,
+ const SymIntConstraint& C, bool& isFeasible);
+
+ virtual const GRState* AssumeSymNE(const GRState* St, SymbolRef sym,
+ const llvm::APSInt& V,
+ bool& isFeasible) = 0;
+
+ virtual const GRState* AssumeSymEQ(const GRState* St, SymbolRef sym,
+ const llvm::APSInt& V,
+ bool& isFeasible) = 0;
+
+ virtual const GRState* AssumeSymLT(const GRState* St, SymbolRef sym,
+ const llvm::APSInt& V,
+ bool& isFeasible) = 0;
+
+ virtual const GRState* AssumeSymGT(const GRState* St, SymbolRef sym,
+ const llvm::APSInt& V,
+ bool& isFeasible) = 0;
+
+ virtual const GRState* AssumeSymLE(const GRState* St, SymbolRef sym,
+ const llvm::APSInt& V,
+ bool& isFeasible) = 0;
+
+ virtual const GRState* AssumeSymGE(const GRState* St, SymbolRef sym,
+ const llvm::APSInt& V,
+ bool& isFeasible) = 0;
+
+ const GRState* AssumeInBound(const GRState* St, SVal Idx, SVal UpperBound,
+ bool Assumption, bool& isFeasible);
+
+private:
+ BasicValueFactory& getBasicVals() { return StateMgr.getBasicVals(); }
+};
+
+} // end clang namespace
+
+#endif // ndef LLVM_CLANG_ANALYSIS_SIMPLE_CONSTRAINT_MANAGER_H
+//== SimpleConstraintManager.h ----------------------------------*- C++ -*--==//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// Code shared between BasicConstraintManager and RangeConstraintManager.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_CLANG_ANALYSIS_SIMPLE_CONSTRAINT_MANAGER_H
+#define LLVM_CLANG_ANALYSIS_SIMPLE_CONSTRAINT_MANAGER_H
+
+#include "clang/Analysis/PathSensitive/ConstraintManager.h"
+#include "clang/Analysis/PathSensitive/GRState.h"
+
+namespace clang {
+
+class SimpleConstraintManager : public ConstraintManager {
+protected:
+ GRStateManager& StateMgr;
+public:
+ SimpleConstraintManager(GRStateManager& statemgr)
+ : StateMgr(statemgr) {}
+ virtual ~SimpleConstraintManager();
+ virtual const GRState* Assume(const GRState* St, SVal Cond, bool Assumption,
+ bool& isFeasible);
+
+ const GRState* Assume(const GRState* St, Loc Cond, bool Assumption,
+ bool& isFeasible);
+
+ const GRState* AssumeAux(const GRState* St, Loc Cond,bool Assumption,
+ bool& isFeasible);
+
+ const GRState* Assume(const GRState* St, NonLoc Cond, bool Assumption,
+ bool& isFeasible);
+
+ const GRState* AssumeAux(const GRState* St, NonLoc Cond, bool Assumption,
+ bool& isFeasible);
+
+ const GRState* AssumeSymInt(const GRState* St, bool Assumption,
+ const SymIntConstraint& C, bool& isFeasible);
+
+ virtual const GRState* AssumeSymNE(const GRState* St, SymbolRef sym,
+ const llvm::APSInt& V,
+ bool& isFeasible) = 0;
+
+ virtual const GRState* AssumeSymEQ(const GRState* St, SymbolRef sym,
+ const llvm::APSInt& V,
+ bool& isFeasible) = 0;
+
+ virtual const GRState* AssumeSymLT(const GRState* St, SymbolRef sym,
+ const llvm::APSInt& V,
+ bool& isFeasible) = 0;
+
+ virtual const GRState* AssumeSymGT(const GRState* St, SymbolRef sym,
+ const llvm::APSInt& V,
+ bool& isFeasible) = 0;
+
+ virtual const GRState* AssumeSymLE(const GRState* St, SymbolRef sym,
+ const llvm::APSInt& V,
+ bool& isFeasible) = 0;
+
+ virtual const GRState* AssumeSymGE(const GRState* St, SymbolRef sym,
+ const llvm::APSInt& V,
+ bool& isFeasible) = 0;
+
+ const GRState* AssumeInBound(const GRState* St, SVal Idx, SVal UpperBound,
+ bool Assumption, bool& isFeasible);
+
+private:
+ BasicValueFactory& getBasicVals() { return StateMgr.getBasicVals(); }
+};
+
+} // end clang namespace
+
+#endif // ndef LLVM_CLANG_ANALYSIS_SIMPLE_CONSTRAINT_MANAGER_H
OpenPOWER on IntegriCloud