<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Oct 24, 2014 at 2:17 PM, Diego Novillo <span dir="ltr"><<a href="mailto:dnovillo@google.com" target="_blank">dnovillo@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br><br><div class="gmail_quote"><span>On Fri Oct 24 2014 at 4:59:25 PM David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>> wrote:<br></span><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span>On Fri, Oct 24, 2014 at 1:52 PM, David Majnemer <span dir="ltr"><<a href="mailto:david.majnemer@gmail.com" target="_blank">david.majnemer@gmail.com</a>></span> wrote:<br></span><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span><div><div>On Fri, Oct 24, 2014 at 12:05 PM, David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>></span> wrote:</div></div></span><span><div>I think it's a bit more clear when written like:</div><div><div>DISubprogram llvm::getDISubprogram(const Function *F) {</div><span><div>  // We look for the first instr that has a debug annotation leading back to F.</div></span><div>  for (auto &BB : *F) {</div><div>    auto Inst = std::find_if(BB.begin(), BB.end(), [](const Instruction &Inst) {</div><div>      return !Inst.getDebugLoc().isUnknown();</div><div>    });</div></div></span></div></div></div></blockquote></div></div></div><span><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><br>& I here I had been trying to figure out a way to use STL algorithms here just to mess with Diego.<br></div></div></div></div></span></blockquote><div><br></div><div>Hm? Context?</div></div></blockquote><div><br>you wrote getDISubprogram recently - I reviewed it. Timur moved it so it's not file-local anymore (so he can use it for some other stuff - COFF debug info?) but in doing so, changed the semantics slightly.<br><br>We were just discussing how that change arose, why, and how the confusion might be avoided. David was proposing an alternative phrasing of the algorithm (above, using find_if, etc) that would be a bit less confusing to him.<br><br>(& I was just joking that when I was reviewing this code I'd joked to Eric (after I'd brought up using range-for loops in that code review) about finding some standard algorithms to suggest, just to throw more C++ at you :))<br><br>- David <br> </div></div><br></div></div>