[all-commits] [llvm/llvm-project] 3d24c7: [clang][DebugInfo] Emit DW_AT_object_pointer on fu...

Michael Buch via All-commits all-commits at lists.llvm.org
Tue Jan 14 13:12:36 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3d24c77f14d42721226b31d7e5d08f853cfc92f1
      https://github.com/llvm/llvm-project/commit/3d24c77f14d42721226b31d7e5d08f853cfc92f1
  Author: Michael Buch <michaelbuch12 at gmail.com>
  Date:   2025-01-14 (Tue, 14 Jan 2025)

  Changed paths:
    M clang/lib/CodeGen/CGDebugInfo.cpp
    A clang/test/CodeGenCXX/debug-info-object-pointer.cpp

  Log Message:
  -----------
  [clang][DebugInfo] Emit DW_AT_object_pointer on function definitions with explicit `this` (#122897)

We currently don't emit `DW_AT_object_pointer` on function declarations
or definitions. GCC suffers from the same issue:
https://godbolt.org/z/h4jeT54G5

Fixing this will help LLDB in identifying static vs. non-static member
functions (see https://github.com/llvm/llvm-project/issues/120856).

If I interpreted the DWARFv5 spec correctly, it doesn't mandate this
attribute be present *only* for implicit object parameters:
```
If the member function entry describes a non-static member function,
then that entry has a DW_AT_object_pointer attribute whose value is a reference to
the formal parameter entry that corresponds to the object for which the
function is called.

That parameter also has a DW_AT_artificial attribute whose value is true.
```

This patch attaches the `DW_AT_object_pointer` for function
*defintions*. The declarations will be handled in a separate patch.

The part about `DW_AT_artificial` seems overly restrictive, and not true
for explicit object parameters. We probably should relax this part of
the DWARF spec.

Partially fixes https://github.com/llvm/llvm-project/issues/120974



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list