[llvm-branch-commits] [cfe-branch] r71710 - /cfe/branches/Apple/Dib/include/clang/Analysis/PathSensitive/ExplodedGraph.h

Mike Stump mrs at apple.com
Wed May 13 13:11:03 PDT 2009


Author: mrs
Date: Wed May 13 15:11:02 2009
New Revision: 71710

URL: http://llvm.org/viewvc/llvm-project?rev=71710&view=rev
Log:
Merge in 71699:

Add ExplodedNode utility methods 'getLocationAs()' and 'getFirstPred()'

Modified:
    cfe/branches/Apple/Dib/include/clang/Analysis/PathSensitive/ExplodedGraph.h

Modified: cfe/branches/Apple/Dib/include/clang/Analysis/PathSensitive/ExplodedGraph.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/Dib/include/clang/Analysis/PathSensitive/ExplodedGraph.h?rev=71710&r1=71709&r2=71710&view=diff

==============================================================================
--- cfe/branches/Apple/Dib/include/clang/Analysis/PathSensitive/ExplodedGraph.h (original)
+++ cfe/branches/Apple/Dib/include/clang/Analysis/PathSensitive/ExplodedGraph.h Wed May 13 15:11:02 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 llvm-branch-commits mailing list