aboutsummaryrefslogtreecommitdiff
path: root/include/clang/Analysis/PathSensitive/ExplodedGraph.h
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-05-13 19:14:06 +0000
committerTed Kremenek <kremenek@apple.com>2009-05-13 19:14:06 +0000
commit52c3196a89a26cebcf069dd140c3396b743b8e33 (patch)
treed6705d31182fe90c19709f688854f49f9f2f4809 /include/clang/Analysis/PathSensitive/ExplodedGraph.h
parent95a0da7b263777e6f97e5a08b6eb893681a234ba (diff)
Add ExplodedNode utility methods 'getLocationAs()' and 'getFirstPred()'
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71699 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Analysis/PathSensitive/ExplodedGraph.h')
-rw-r--r--include/clang/Analysis/PathSensitive/ExplodedGraph.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/clang/Analysis/PathSensitive/ExplodedGraph.h b/include/clang/Analysis/PathSensitive/ExplodedGraph.h
index f00e48887e..8494d93565 100644
--- a/include/clang/Analysis/PathSensitive/ExplodedGraph.h
+++ b/include/clang/Analysis/PathSensitive/ExplodedGraph.h
@@ -123,6 +123,9 @@ public:
/// 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 @@ public:
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;