[PATCH] D27963: [Codegen] Have the generic debug skip functions return true on empty.

Kyle Butt via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 20 12:58:58 PST 2016


iteratee added a comment.

In https://reviews.llvm.org/D27963#627614, @fhahn wrote:

> `skipDebugInstructionsForward/Backward` take the iterator by value and return the advanced iterator again, because it seemed more in line with C++'s iterator functions (like next and prev), @MatzeB suggested that in   https://reviews.llvm.org/D27782#623009 .


Note that the standard also has ::advance(it, n) which works via side-effect, so the std can't decide one way or the other.

> In my opinion, it's obvious what the current implementation does by just looking at the call and having the end/beginning checks are in the caller's code, whereas the version proposed in this review is a little bit less obvious and the savings in code size seem quite small.

Even without returning empty, I prefer the side effect version. It makes nearly all the call sites simpler.


Repository:
  rL LLVM

https://reviews.llvm.org/D27963





More information about the llvm-commits mailing list