<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 - [codeview] Misssing LF_NESTTYPE with nested templates (structure/class)"
   href="https://bugs.llvm.org/show_bug.cgi?id=46394">46394</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[codeview] Misssing LF_NESTTYPE with nested templates (structure/class)
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>trunk
          </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>international.phantom@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>Given the following test case:

//---------------------------------------------------------

template <typename T> struct Template_A {
  template <typename U> struct Template_B { U Member_TB; };
  Template_B<char> Member_TA;
};

Template_A<int> MyTemplate;

struct Struct_A {
  struct Struct_B {
    char Member_SB;
  };
  Struct_B Member_SA;
};

Struct_A MyClass;

//---------------------------------------------------------

Using the command line to generate debug info CodeView:

clang -c -g -O0 test.cpp -o test-cv.o -gcodeview --target=x86_64-windows

The output generated by llvm-pdbutil, shows that Clang does emit the
LF_NESTTYPE for nested structure/class. But it does not emit it if the
structure/class is a template.

The LF_STRUCTURE in the case of templates, does not have the 'contains nested
class' flag.

----------
`Struct_A`
----------
0x100C | LF_STRUCTURE `Struct_A`
         field list: 0x100B
         options: contains nested class     ** Nested Info **

0x100B | LF_FIELDLIST
         - LF_MEMBER [name = `Member_SA`, Type = 0x100A]
         - LF_NESTTYPE [name = `Struct_B`, parent = 0x100A]

-----------------
`Template_A<int>`
-----------------
0x1003 | LF_STRUCTURE `Template_A<int>`
         field list: 0x1002
         options:                           ** Missing Nested Info **

0x1002 | LF_FIELDLIST
         - LF_MEMBER [name = `Member_TA`, Type = 0x1001]

MSVC emits the LF_NESTTYPE for all cases (templates and non-templates).

----------
`Struct_A`
----------
0x1009 | LF_STRUCTURE `Struct_A`
         field list: 0x1008
         options: contains nested class     ** Nested Info **

0x1008 | LF_FIELDLIST
         - LF_NESTTYPE [name = `Struct_B`, parent = 0x1007]
         - LF_MEMBER [name = `Member_SA`, Type = 0x1007]

-----------------
`Template_A<int>`
-----------------
0x1003 | LF_STRUCTURE `Template_A<int>`
         field list: 0x1002
         options: contains nested class     ** Nested Info **

0x1002 | LF_FIELDLIST
         - LF_NESTTYPE [name = `?$Template_B@D`, parent = 0x1001]
         - LF_MEMBER [name = `Member_TA`, Type = 0x1001]</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>