[llvm-commits] [llvm] r50705 - /llvm/branches/non-call-eh/include/llvm/Support/CFG.h
Nick Lewycky
nicholas at mxc.ca
Mon May 5 21:00:56 PDT 2008
Author: nicholas
Date: Mon May 5 23:00:56 2008
New Revision: 50705
URL: http://llvm.org/viewvc/llvm-project?rev=50705&view=rev
Log:
Create isUnwindEdge methods on the iterators.
Modified:
llvm/branches/non-call-eh/include/llvm/Support/CFG.h
Modified: llvm/branches/non-call-eh/include/llvm/Support/CFG.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/Support/CFG.h?rev=50705&r1=50704&r2=50705&view=diff
==============================================================================
--- llvm/branches/non-call-eh/include/llvm/Support/CFG.h (original)
+++ llvm/branches/non-call-eh/include/llvm/Support/CFG.h Mon May 5 23:00:56 2008
@@ -48,6 +48,13 @@
}
inline PredIterator(_Ptr *bb, bool) : It(bb->use_end()) {}
+ /// isUnwindEdge - This is used to determine whether this predecessor is a
+ /// exception edge.
+ bool isUnwindEdge() const {
+ assert(!It.atEnd() && "pred_iterator out of range!");
+ return isa<BasicBlock>(*It);
+ }
+
inline bool operator==(const _Self& x) const { return It == x.It; }
inline bool operator!=(const _Self& x) const { return !operator==(x); }
@@ -120,14 +127,20 @@
/// operate on terminator instructions directly.
unsigned getSuccessorIndex() const { return idx; }
+ /// isUnwindEdge - This is used to determine whether this successor is a
+ /// exception edge.
+ bool isUnwindEdge() const {
+ return idx == Term->getNumSuccessors();
+ }
+
inline bool operator==(const _Self& x) const { return idx == x.idx; }
inline bool operator!=(const _Self& x) const { return !operator==(x); }
inline pointer operator*() const {
- if (idx == Term->getNumSuccessors())
+ if (isUnwindEdge())
return Term->getParent()->getUnwindDest();
-
- return Term->getSuccessor(idx);
+ else
+ return Term->getSuccessor(idx);
}
inline pointer operator->() const { return operator*(); }
More information about the llvm-commits
mailing list