]> granicus.if.org Git - clang/commitdiff
Added batch versions of GRState::scanReachableSymbols() so that clients can scan...
authorTed Kremenek <kremenek@apple.com>
Thu, 26 Nov 2009 02:32:19 +0000 (02:32 +0000)
committerTed Kremenek <kremenek@apple.com>
Thu, 26 Nov 2009 02:32:19 +0000 (02:32 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89926 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Analysis/PathSensitive/GRState.h
lib/Analysis/GRState.cpp

index ef0c36c44d9fbb155b1f8d877a536552246553af..898f6edad0f24faf7b1bd96f9ce23467451fb4c0 100644 (file)
@@ -264,8 +264,21 @@ public:
   const llvm::APSInt *getSymVal(SymbolRef sym);
 
   bool scanReachableSymbols(SVal val, SymbolVisitor& visitor) const;
+  
+  bool scanReachableSymbols(const SVal *I, const SVal *E,
+                            SymbolVisitor &visitor) const;
+  
+  bool scanReachableSymbols(const MemRegion * const *I, 
+                            const MemRegion * const *E,
+                            SymbolVisitor &visitor) const;
 
   template <typename CB> CB scanReachableSymbols(SVal val) const;
+  template <typename CB> CB scanReachableSymbols(const SVal *beg,
+                                                 const SVal *end) const;
+  
+  template <typename CB> CB
+  scanReachableSymbols(const MemRegion * const *beg,
+                       const MemRegion * const *end) const;
 
   //==---------------------------------------------------------------------==//
   // Accessing the Generic Data Map (GDM).
@@ -726,7 +739,21 @@ CB GRState::scanReachableSymbols(SVal val) const {
   scanReachableSymbols(val, cb);
   return cb;
 }
+  
+template <typename CB>
+CB GRState::scanReachableSymbols(const SVal *beg, const SVal *end) const {
+  CB cb(this);
+  scanReachableSymbols(beg, end, cb);
+  return cb;
+}
 
+template <typename CB>
+CB GRState::scanReachableSymbols(const MemRegion * const *beg,
+                                 const MemRegion * const *end) const {
+  CB cb(this);
+  scanReachableSymbols(beg, end, cb);
+  return cb;
+}
 } // end clang namespace
 
 #endif
index 23ee0b2258bd77fc12b812d26b95ab5fc957b239..5284d65e9ade7ea33bd3c03b79a4bf5c34ab7ca7 100644 (file)
@@ -308,6 +308,27 @@ bool GRState::scanReachableSymbols(SVal val, SymbolVisitor& visitor) const {
   return S.scan(val);
 }
 
+bool GRState::scanReachableSymbols(const SVal *I, const SVal *E,
+                                   SymbolVisitor &visitor) const {
+  ScanReachableSymbols S(this, visitor);
+  for ( ; I != E; ++I) {
+    if (S.scan(*I))
+      return true;
+  }
+  return false;  
+}
+
+bool GRState::scanReachableSymbols(const MemRegion * const *I,
+                                   const MemRegion * const *E,
+                                   SymbolVisitor &visitor) const {
+  ScanReachableSymbols S(this, visitor);
+  for ( ; I != E; ++I) {
+    if (S.scan(*I))
+      return true;
+  }
+  return false;
+}
+
 //===----------------------------------------------------------------------===//
 // Queries.
 //===----------------------------------------------------------------------===//