]> granicus.if.org Git - clang/commitdiff
Added method "canReasonAbout" to ConstraintManager. This method returns true if
authorTed Kremenek <kremenek@apple.com>
Wed, 11 Mar 2009 02:22:59 +0000 (02:22 +0000)
committerTed Kremenek <kremenek@apple.com>
Wed, 11 Mar 2009 02:22:59 +0000 (02:22 +0000)
a ConstraintManager can usefully reason about the given SVal.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66624 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Analysis/PathSensitive/ConstraintManager.h
lib/Analysis/SimpleConstraintManager.cpp
lib/Analysis/SimpleConstraintManager.h

index f526d7819e73bde9c2fef73588661632e50c9a28..32e5bb0cb373540160b38fd742329e1072b971ff 100644 (file)
@@ -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);
index c72f39c2fc2a6cee151150870056e020d98787b1..82cc0bb7bc2ba89a7a6eb968702221f468247fbf 100644 (file)
@@ -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) {
index 02292a1cbc4057ee3447af777207ed0f1571e670..08ab66063af4865449841ece6431800f2f160417 100644 (file)
@@ -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);