<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </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 --- - clang++ does not output Dwarf DW_AT_default_value Debugging Information Entry"
   href="http://llvm.org/bugs/show_bug.cgi?id=20690">20690</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang++ does not output Dwarf DW_AT_default_value Debugging Information Entry
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>-New Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>rdsmith@chromium.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=12910" name="attach_12910" title="Dwarf dump of binary compiled from included program">attachment 12910</a> <a href="attachment.cgi?id=12910&action=edit" title="Dwarf dump of binary compiled from included program">[details]</a></span>
Dwarf dump of binary compiled from included program

When compiling a C++ class with methods with default arguments, clang does not
appear to output the Dwarf debugging information entry representing a default
value.  To reproduce, compile the following program on Linux (via clang++ -g
test.cc) and dump the resulting a.out file (I've attached the output of a
simple dump via pyelftools).  The DW_AT_default_value attribute is not present
in the dump.

----
#include <string>
#include <iostream>

class testclass {
 public:
  testclass() {}

  void test_method(int a = 1) {
    std::cout << a << std::endl;
  }
};

int
main(int argc, char** argv) {
  std::string abc("abc");

  testclass t;

  t.test_method(8);

  std::cout << abc << std::endl;
}
----

This bug occurs in clang built from LLVM version 215330, clang version 215327.

This is a problem for, e.g., calling some STL library routines from lldb, as
such routines are often documented as having fewer arguments than they are
defined with, the extra arguments being defaulted and used for, e.g.,
allocation.  Without information about the default arguments, lldb cannot
present the interface to the user they expect.  See
<a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Inferior method execution ignores default arguments"
   href="show_bug.cgi?id=20604">http://llvm.org/bugs/show_bug.cgi?id=20604</a> .</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>