[llvm] r207719 - Revert "Emit DW_AT_object_pointer once, on the declaration, for each function."
David Blaikie
dblaikie at gmail.com
Thu May 1 10:27:26 PDT 2014
On Thu, May 1, 2014 at 8:50 AM, Robinson, Paul
<Paul_Robinson at playstation.sony.com> wrote:
>> -----Original Message-----
>> From: David Blaikie [mailto:dblaikie at gmail.com]
>> On Wed, Apr 30, 2014 at 7:40 PM, Robinson, Paul
>> <Paul_Robinson at playstation.sony.com> wrote:
>> > Yeah, I was wondering. Attributes like object_pointer seem more
>> > appropriate to a definition than a declaration, as the declaration
>> > typically wouldn't provide the actual location.
>>
>> I'm not sure the actual location is a prerequisite for making use of
>> object_pointer - I figured callers might like to know about it (but I
>> suppose you can't /call/ a function from just the DWARF declaration?
>> Never really thought about whether debuggers would manage that - they
>> could /maybe/ build the mangled name, etc). Useful for rendering
>> functions in pretty printers (well, the first parameter is flagged as
>> artifiical in the declaration, perhaps that's sufficient for printing
>> purposes - another case where it'd be nice if we didn't have to
>> duplicate that information in the definition, though).
>>
>> But, sure, it'd be great if there was no reason to put object_pointer
>> on declarations - not insignificant space savings when emitting types
>> all over the place.
>>
>> - David
>>
>> > --paulr
>
> If you have a definition, then the location is definitely relevant;
> a location expression might want to push the object address, and for
> that you need to know where the object is!
I'm not suggesting it's not helpful at the definition, just that it
shouldn't need to be duplicated there.
> But if you're inheriting
> the object_pointer from the declaration, which only points to the
> declaration's formal_parameter, which has no location... not very
> helpful.
I don't know why an implementation wouldn't derive it from the
declaration - they must have the same parameters in the same order,
right?
> That's why I'd expect the definition to have one, and if
> the definition has one, then having one on the declaration is not
> necessary.
>
> If you have a declaration with no definition... I suppose it would
> be "for completeness" to have object_pointer point to the 'this'
> parameter (in C++) although some debuggers I've worked with are
> happy to infer that from the first formal_parameter being named
> 'this' and marked artificial.
Right - and I assume they'd be able to infer that in the definition
too. Evidently GCC doesn't infer it in the definition, nor derive it
from the declaration.
More information about the llvm-commits
mailing list