[RFC] Adding a few more range adaptors

Hi all,

while converting some code to use C++11 features, I noticed that some commonly used iterators don't have range adapters. What do you think about adding these?

llvm/IR/InstIterator.h:
inst_begin() / inst_end() -> instructions()

llvm/IR/CFG.h:
pred_begin() / pred_end() -> predecessors()
succ_begin() / succ_end() -> successors()

llvm/IR/BasicBlock.h:
BasicBlock::begin() / BasicBlock::getFirstNonPHI() -> BasicBlock::phis()
BasicBlock::getFirstNonPHI() / BasicBlock::end() -> BasicBlock::non_phis()

-Manuel

There’s been no wholesale effort to add range adapters. Were just adding them as/when someone feels the need. Feel free to add any you happen n to wasn’t/need.

Personally I think the phi’s/non_phi’s would be especially helpful over the existing formulation. (I think there’s a similar work in some other APIs (maybe operands to an instruction?) Where a list is split into two by some boundary iterator and would be nice as two range accessor’s for the distinct sub ranges and one for the overall range.