<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Debug info for imported declarations sometimes reference empty DIEs"
   href="https://bugs.llvm.org/show_bug.cgi?id=52159">52159</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Debug info for imported declarations sometimes reference empty DIEs
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>12.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>DebugInfo
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>ellis.sparky.hoag@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>jdevlieghere@apple.com, keith.walker@arm.com, llvm-bugs@lists.llvm.org, paul_robinson@playstation.sony.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>When an imported declaration references a function that has been inlined and
removed, its DIE will reference an empty subprogram DIE. 

In clang, it creates a new empty DIE rather than using the existing abstract
origin DIE.
```
$ cat main.cpp
namespace ns {
inline __attribute__((always_inline))
void foo() { int a = 4; }
}

void goo() {
  using ns::foo;
  foo();
}
$ clang -g main.cpp -c -o - | llvm-dwarfdump -
0x0000000b: DW_TAG_compile_unit
...

0x0000002a:   DW_TAG_namespace
                DW_AT_name      ("ns")

0x0000002f:     DW_TAG_subprogram
                  DW_AT_linkage_name    ("_ZN2ns3fooEv")
                  DW_AT_name    ("foo")
                  DW_AT_decl_line       (3)
                  DW_AT_external        (true)
                  DW_AT_inline  (DW_INL_inlined)

0x0000003b:       DW_TAG_variable
                    DW_AT_name  ("a")
                    DW_AT_decl_line     (3)
                    DW_AT_type  (0x00000049 "int")

0x00000046:       NULL

0x00000047:     DW_TAG_subprogram

0x00000048:     NULL

0x00000050:   DW_TAG_subprogram
                DW_AT_low_pc    (0x0000000000000000)
                DW_AT_high_pc   (0x000000000000000d)
                DW_AT_frame_base        (DW_OP_reg6 RBP)
                DW_AT_linkage_name      ("_Z3goov")
                DW_AT_name      ("goo")
                DW_AT_decl_line (6)
                DW_AT_external  (true)

0x00000069:     DW_TAG_imported_declaration
                  DW_AT_decl_line       (7)
                  DW_AT_import  (0x00000047)

0x00000070:     DW_TAG_inlined_subroutine
                  DW_AT_abstract_origin (0x0000002f "_ZN2ns3fooEv")
                  DW_AT_low_pc  (0x0000000000000004)
                  DW_AT_high_pc (0x000000000000000b)
                  DW_AT_call_line       (8)
                  DW_AT_call_column     (0x03)

0x00000084:       DW_TAG_variable
                    DW_AT_location      (DW_OP_fbreg -4)
                    DW_AT_abstract_origin       (0x0000003b "a")

0x0000008c:       NULL

0x0000008d:     NULL

0x0000008e:   NULL
```</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>