[llvm] r207719 - Revert "Emit DW_AT_object_pointer once, on the declaration, for each function."

Robinson, Paul Paul_Robinson at playstation.sony.com
Thu May 1 08:50:18 PDT 2014


> -----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!  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.  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.
--paulr





More information about the llvm-commits mailing list