aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/Support/CFG.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-10-11 04:18:11 +0000
committerChris Lattner <sabre@nondot.org>2007-10-11 04:18:11 +0000
commit3ef437d137afe7409b93310a2092a2f8a8dbfcca (patch)
treeb179649549eed3d0516011a9f586ea518400dc53 /include/llvm/Support/CFG.h
parentbdc2154986f6f302ef59b506013b73f82a7a5ee5 (diff)
downloadexternal_llvm-3ef437d137afe7409b93310a2092a2f8a8dbfcca.tar.gz
external_llvm-3ef437d137afe7409b93310a2092a2f8a8dbfcca.tar.bz2
external_llvm-3ef437d137afe7409b93310a2092a2f8a8dbfcca.zip
Add a new use_iterator::atEnd() method, which allows us to shrink
pred_iterator down to a single ivar. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42859 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Support/CFG.h')
-rw-r--r--include/llvm/Support/CFG.h11
1 files changed, 5 insertions, 6 deletions
diff --git a/include/llvm/Support/CFG.h b/include/llvm/Support/CFG.h
index 4efefa7253..a2cc22c910 100644
--- a/include/llvm/Support/CFG.h
+++ b/include/llvm/Support/CFG.h
@@ -29,7 +29,6 @@ namespace llvm {
template <class _Ptr, class _USE_iterator> // Predecessor Iterator
class PredIterator : public forward_iterator<_Ptr, ptrdiff_t> {
typedef forward_iterator<_Ptr, ptrdiff_t> super;
- _Ptr *BB;
_USE_iterator It;
public:
typedef PredIterator<_Ptr,_USE_iterator> _Self;
@@ -37,26 +36,26 @@ public:
inline void advancePastNonTerminators() {
// Loop to ignore non terminator uses (for example PHI nodes)...
- while (It != BB->use_end() && !isa<TerminatorInst>(*It))
+ while (!It.atEnd() && !isa<TerminatorInst>(*It))
++It;
}
- inline PredIterator(_Ptr *bb) : BB(bb), It(bb->use_begin()) {
+ inline PredIterator(_Ptr *bb) : It(bb->use_begin()) {
advancePastNonTerminators();
}
- inline PredIterator(_Ptr *bb, bool) : BB(bb), It(bb->use_end()) {}
+ inline PredIterator(_Ptr *bb, bool) : It(bb->use_end()) {}
inline bool operator==(const _Self& x) const { return It == x.It; }
inline bool operator!=(const _Self& x) const { return !operator==(x); }
inline pointer operator*() const {
- assert(It != BB->use_end() && "pred_iterator out of range!");
+ assert(!It.atEnd() && "pred_iterator out of range!");
return cast<TerminatorInst>(*It)->getParent();
}
inline pointer *operator->() const { return &(operator*()); }
inline _Self& operator++() { // Preincrement
- assert(It != BB->use_end() && "pred_iterator out of range!");
+ assert(!It.atEnd() && "pred_iterator out of range!");
++It; advancePastNonTerminators();
return *this;
}