[cfe-commits] r71699 - /cfe/trunk/include/clang/Analysis/PathSensitive/ExplodedGraph.h

Ted Kremenek kremenek at apple.com
Wed May 13 12:14:16 PDT 2009


Author: kremenek
Date: Wed May 13 14:14:06 2009
New Revision: 71699

URL: http://llvm.org/viewvc/llvm-project?rev=71699&view=rev
Log:
Add ExplodedNode utility methods 'getLocationAs()' and 'getFirstPred()'

Modified:
    cfe/trunk/include/clang/Analysis/PathSensitive/ExplodedGraph.h

Modified: cfe/trunk/include/clang/Analysis/PathSensitive/ExplodedGraph.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/PathSensitive/ExplodedGraph.h?rev=71699&r1=71698&r2=71699&view=diff

==============================================================================
--- cfe/trunk/include/clang/Analysis/PathSensitive/ExplodedGraph.h (original)
+++ cfe/trunk/include/clang/Analysis/PathSensitive/ExplodedGraph.h Wed May 13 14:14:06 2009
@@ -123,6 +123,9 @@
   /// getLocation - Returns the edge associated with the given node.
   ProgramPoint getLocation() const { return Location; }
   
+  template <typename T>
+  const T* getLocationAs() const { return llvm::dyn_cast<T>(&Location); }
+  
   unsigned succ_size() const { return Succs.size(); }
   unsigned pred_size() const { return Preds.size(); }
   bool succ_empty() const { return Succs.empty(); }
@@ -183,6 +186,14 @@
     ExplodedNodeImpl::addPredecessor(V);
   }
   
+  ExplodedNode* getFirstPred() {
+    return pred_empty() ? NULL : *(pred_begin());
+  }
+  
+  const ExplodedNode* getFirstPred() const {
+    return const_cast<ExplodedNode*>(this)->getFirstPred();
+  }
+  
   // Iterators over successor and predecessor vertices.
   typedef ExplodedNode**       succ_iterator;
   typedef const ExplodedNode* const * const_succ_iterator;





More information about the cfe-commits mailing list