[llvm] r205974 - Follow-up to r205973: change the return type to const MDNode*.

David Blaikie dblaikie at gmail.com
Thu Apr 10 11:37:45 PDT 2014


On Thu, Apr 10, 2014 at 11:29 AM, Adrian Prantl <aprantl at apple.com> wrote:
> Because they store it in LiveUserVar, or in a DebugLoc, both of which take MDNodes. The more I think about it I'm actually preferring the original version that returns a DIVariable again. It's also more descriptive and (marginally more) type safe.

Yeah - I'd be sort of inclined to leave it as DIVariable, it's
self-documenting at least (as you say, the type safety of the DI*s
isn't very strong - since they can be invalid at any point anyway) -
and helps us push that type safety out through other APIs over time.

>
> -- adrian
>
> On Apr 10, 2014, at 11:18 AM, David Blaikie <dblaikie at gmail.com> wrote:
>
>> On Thu, Apr 10, 2014 at 11:10 AM, Adrian Prantl <aprantl at apple.com> wrote:
>>>
>>> On Apr 10, 2014, at 11:04 AM, David Blaikie <dblaikie at gmail.com> wrote:
>>>
>>>> On Thu, Apr 10, 2014 at 10:50 AM, Adrian Prantl <aprantl at apple.com> wrote:
>>>>> Author: adrian
>>>>> Date: Thu Apr 10 12:50:30 2014
>>>>> New Revision: 205974
>>>>>
>>>>> URL: http://llvm.org/viewvc/llvm-project?rev=205974&view=rev
>>>>> Log:
>>>>> Follow-up to r205973: change the return type to const MDNode*.
>>>>
>>>> It'd be helpful to explain (in the commit message, ideally) the
>>>> motivation for changes like this.
>>>
>>> That's right. All uses cast the result to const MDNode*, so wrapping the result in a DIVariable seems like a waste of resources (then again wrapping an MDNode in a DIVariable should be close to zero cost, but this way the helper function at least matches its uses).
>>
>> Curious - why would all the callers want MDNodes instead of DIVariables?
>




More information about the llvm-commits mailing list