[llvm] r220536 - Make getDISubprogram(const Function *F) available in LLVM

David Blaikie dblaikie at gmail.com
Fri Oct 24 14:32:30 PDT 2014


On Fri, Oct 24, 2014 at 2:17 PM, Diego Novillo <dnovillo at google.com> wrote:

>
>
> On Fri Oct 24 2014 at 4:59:25 PM David Blaikie <dblaikie at gmail.com> wrote:
>
>> On Fri, Oct 24, 2014 at 1:52 PM, David Majnemer <david.majnemer at gmail.com
>> > wrote:
>>
>>> On Fri, Oct 24, 2014 at 12:05 PM, David Blaikie <dblaikie at gmail.com>
>>> wrote:
>>> I think it's a bit more clear when written like:
>>> DISubprogram llvm::getDISubprogram(const Function *F) {
>>>   // We look for the first instr that has a debug annotation leading
>>> back to F.
>>>   for (auto &BB : *F) {
>>>     auto Inst = std::find_if(BB.begin(), BB.end(), [](const Instruction
>>> &Inst) {
>>>       return !Inst.getDebugLoc().isUnknown();
>>>     });
>>>
>>
>> & I here I had been trying to figure out a way to use STL algorithms here
>> just to mess with Diego.
>>
>
> Hm? Context?
>

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.

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.

(& 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
:))

- David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141024/cc28478c/attachment.html>


More information about the llvm-commits mailing list