aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/Support/CFG.h
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2008-04-22 05:20:06 +0000
committerNick Lewycky <nicholas@mxc.ca>2008-04-22 05:20:06 +0000
commit75712b8b3f5fa9c2a27058b97a984aeb693b8f3e (patch)
tree22fceb813cbaf7366c49503df5eac63deac0b54d /include/llvm/Support/CFG.h
parent59091c46300c8b82e859426d6f58208ebe0d211f (diff)
downloadexternal_llvm-75712b8b3f5fa9c2a27058b97a984aeb693b8f3e.tar.gz
external_llvm-75712b8b3f5fa9c2a27058b97a984aeb693b8f3e.tar.bz2
external_llvm-75712b8b3f5fa9c2a27058b97a984aeb693b8f3e.zip
Whoops! Undo r50087, unbreak the build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50088 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Support/CFG.h')
-rw-r--r--include/llvm/Support/CFG.h16
1 files changed, 13 insertions, 3 deletions
diff --git a/include/llvm/Support/CFG.h b/include/llvm/Support/CFG.h
index b146a9675c..f8cbeb0a50 100644
--- a/include/llvm/Support/CFG.h
+++ b/include/llvm/Support/CFG.h
@@ -53,13 +53,16 @@ public:
inline pointer operator*() const {
assert(!It.atEnd() && "pred_iterator out of range!");
- return cast<TerminatorInst>(*It)->getParent();
+ if (isa<TerminatorInst>(*It)) // not dyn_cast due to const-correctness
+ return cast<TerminatorInst>(*It)->getParent();
+
+ return cast<_Ptr>(*It);
}
inline pointer *operator->() const { return &(operator*()); }
inline _Self& operator++() { // Preincrement
assert(!It.atEnd() && "pred_iterator out of range!");
- ++It; advancePastNonTerminators();
+ ++It; advancePastNonPreds();
return *this;
}
@@ -103,6 +106,8 @@ public:
inline SuccIterator(Term_ T, bool) // end iterator
: Term(T), idx(Term->getNumSuccessors()) {
assert(T && "getTerminator returned null!");
+ if (Term->getParent()->getUnwindDest())
+ ++idx;
}
inline const _Self &operator=(const _Self &I) {
@@ -118,7 +123,12 @@ public:
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 { return Term->getSuccessor(idx); }
+ inline pointer operator*() const {
+ if (idx == Term->getNumSuccessors())
+ return Term->getParent()->getUnwindDest();
+
+ return Term->getSuccessor(idx);
+ }
inline pointer operator->() const { return operator*(); }
inline _Self& operator++() { ++idx; return *this; } // Preincrement