mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-03 14:21:30 +00:00
Standardize {pred,succ,use,user}_empty()
The functions {pred,succ,use,user}_{begin,end} exist, but many users
have to check *_begin() with *_end() by hand to determine if the
BasicBlock or User is empty. Fix this with a standard *_empty(),
demonstrating a few usecases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225760 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -93,6 +93,9 @@ inline pred_iterator pred_end(BasicBlock *BB) { return pred_iterator(BB, true);}
|
||||
inline const_pred_iterator pred_end(const BasicBlock *BB) {
|
||||
return const_pred_iterator(BB, true);
|
||||
}
|
||||
inline bool pred_empty(const BasicBlock *BB) {
|
||||
return pred_begin(BB) == pred_end(BB);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -257,6 +260,9 @@ inline succ_iterator succ_end(BasicBlock *BB) {
|
||||
inline succ_const_iterator succ_end(const BasicBlock *BB) {
|
||||
return succ_const_iterator(BB->getTerminator(), true);
|
||||
}
|
||||
inline bool succ_empty(const BasicBlock *BB) {
|
||||
return succ_begin(BB) == succ_end(BB);
|
||||
}
|
||||
|
||||
template <typename T, typename U> struct isPodLike<SuccIterator<T, U> > {
|
||||
static const bool value = isPodLike<T>::value;
|
||||
|
||||
@@ -286,6 +286,8 @@ public:
|
||||
return iterator_range<const_use_iterator>(use_begin(), use_end());
|
||||
}
|
||||
|
||||
bool user_empty() const { return UseList == nullptr; }
|
||||
|
||||
typedef user_iterator_impl<User> user_iterator;
|
||||
typedef user_iterator_impl<const User> const_user_iterator;
|
||||
user_iterator user_begin() { return user_iterator(UseList); }
|
||||
|
||||
Reference in New Issue
Block a user