[llvm-bugs] [Bug 46394] New: [codeview] Misssing LF_NESTTYPE with nested templates (structure/class)

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jun 18 22:11:53 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=46394

            Bug ID: 46394
           Summary: [codeview] Misssing LF_NESTTYPE with nested templates
                    (structure/class)
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: DebugInfo
          Assignee: unassignedbugs at nondot.org
          Reporter: international.phantom at gmail.com
                CC: jdevlieghere at apple.com, keith.walker at arm.com,
                    llvm-bugs at lists.llvm.org,
                    paul_robinson at playstation.sony.com

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 at D`, parent = 0x1001]
         - LF_MEMBER [name = `Member_TA`, Type = 0x1001]

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200619/9be2b0f5/attachment.html>


More information about the llvm-bugs mailing list