summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-03-11 02:22:59 +0000
committerTed Kremenek <kremenek@apple.com>2009-03-11 02:22:59 +0000
commit4e34f958f42abefd57dea9e4c13cc98bb9e292ab (patch)
treebb1eb0de34a537456f76ba45c2d1994959f06966 /clang
parent39df18f6da323b145157fc33fb62187693835bb0 (diff)
downloadbcm5719-llvm-4e34f958f42abefd57dea9e4c13cc98bb9e292ab.tar.gz
bcm5719-llvm-4e34f958f42abefd57dea9e4c13cc98bb9e292ab.zip
Added method "canReasonAbout" to ConstraintManager. This method returns true if
a ConstraintManager can usefully reason about the given SVal. llvm-svn: 66624
Diffstat (limited to 'clang')
-rw-r--r--clang/include/clang/Analysis/PathSensitive/ConstraintManager.h7
-rw-r--r--clang/lib/Analysis/SimpleConstraintManager.cpp4
-rw-r--r--clang/lib/Analysis/SimpleConstraintManager.h3
3 files changed, 14 insertions, 0 deletions
diff --git a/clang/include/clang/Analysis/PathSensitive/ConstraintManager.h b/clang/include/clang/Analysis/PathSensitive/ConstraintManager.h
index f526d7819e7..32e5bb0cb37 100644
--- a/clang/include/clang/Analysis/PathSensitive/ConstraintManager.h
+++ b/clang/include/clang/Analysis/PathSensitive/ConstraintManager.h
@@ -51,6 +51,13 @@ public:
const char* nl, const char *sep) = 0;
virtual void EndPath(const GRState* St) {}
+
+ /// canReasonAbout - Not all ConstraintManagers can accurately reason about
+ /// all SVal values. This method returns true if the ConstraintManager can
+ /// reasonably handle a given SVal value. This is typically queried by
+ /// GRExprEngine to determine if the value should be replaced with a
+ /// conjured symbolic value in order to recover some precision.
+ virtual bool canReasonAbout(SVal X) const = 0;
};
ConstraintManager* CreateBasicConstraintManager(GRStateManager& statemgr);
diff --git a/clang/lib/Analysis/SimpleConstraintManager.cpp b/clang/lib/Analysis/SimpleConstraintManager.cpp
index c72f39c2fc2..82cc0bb7bc2 100644
--- a/clang/lib/Analysis/SimpleConstraintManager.cpp
+++ b/clang/lib/Analysis/SimpleConstraintManager.cpp
@@ -20,6 +20,10 @@ namespace clang {
SimpleConstraintManager::~SimpleConstraintManager() {}
+bool SimpleConstraintManager::canReasonAbout(SVal X) const {
+ return true;
+}
+
const GRState*
SimpleConstraintManager::Assume(const GRState* St, SVal Cond, bool Assumption,
bool& isFeasible) {
diff --git a/clang/lib/Analysis/SimpleConstraintManager.h b/clang/lib/Analysis/SimpleConstraintManager.h
index 02292a1cbc4..08ab66063af 100644
--- a/clang/lib/Analysis/SimpleConstraintManager.h
+++ b/clang/lib/Analysis/SimpleConstraintManager.h
@@ -26,6 +26,9 @@ public:
SimpleConstraintManager(GRStateManager& statemgr)
: StateMgr(statemgr) {}
virtual ~SimpleConstraintManager();
+
+ bool canReasonAbout(SVal X) const;
+
virtual const GRState* Assume(const GRState* St, SVal Cond, bool Assumption,
bool& isFeasible);
OpenPOWER on IntegriCloud