File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -466,9 +466,15 @@ class ValueBase : public SILNode, public SILAllocated<ValueBase> {
466466 // / entire use list.
467467 inline bool hasTwoUses () const ;
468468
469- // / Helper struct for DowncastUserFilterRange
469+ // / Helper struct for DowncastUserFilterRange and UserRange
470470 struct UseToUser ;
471471
472+ using UserRange =
473+ llvm::iterator_range<llvm::mapped_iterator<swift::ValueBaseUseIterator,
474+ swift::ValueBase::UseToUser,
475+ swift::SILInstruction *>>;
476+ inline UserRange getUsers () const ;
477+
472478 template <typename Subclass>
473479 using DowncastUserFilterRange =
474480 DowncastFilterRange<Subclass,
@@ -1439,6 +1445,10 @@ struct ValueBase::UseToUser {
14391445 SILInstruction *operator ()(Operand &use) { return use.getUser (); }
14401446};
14411447
1448+ inline ValueBase::UserRange ValueBase::getUsers () const {
1449+ return llvm::map_range (getUses (), ValueBase::UseToUser ());
1450+ }
1451+
14421452template <typename T>
14431453inline ValueBase::DowncastUserFilterRange<T> ValueBase::getUsersOfType () const {
14441454 auto begin = llvm::map_iterator (use_begin (), UseToUser ());
You can’t perform that action at this time.
0 commit comments