[llvm-bugs] [Bug 46361] New: [Codeview] Omitted class member function declaration for lambda.

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jun 17 02:35:41 PDT 2020


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

            Bug ID: 46361
           Summary: [Codeview] Omitted class member function declaration
                    for lambda.
           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:

//------------------------------------------------------------
int test() {
  auto myLambdaFunction = [&](auto Param) {
    return Param;
  };

  return myLambdaFunction(1);
}
//------------------------------------------------------------

Using the command line to generate debug info CodeView:

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

The output generated by llvm-pdbutil, shows the definition for a member
function (operator ()), but it does not include its declaration in the class
associated with the lambda:

  0 | S_GPROC32_ID `test`
  0 | S_LOCAL `myLambdaFunction`
      type=0x1005 (test::<unnamed-tag>)
  0 | S_PROC_ID_END

** Class associated with lambda **
----------------------------------
0x1005 | LF_CLASS [size = 76] `test::<unnamed-tag>`
         unique name: `.?AV<lambda_0>@?0??test@@YAHXZ@`
         field list: 0x1004
0x1004 | LF_FIELDLIST      <--- Empty field list

** operator() definition **
---------------------------
  0 | S_LPROC32_ID `test::<unnamed-tag>::operator()<int>`
      type = `0x100C (operator())`
  0 | S_LOCAL `this`
      type=0x100D (const test::<unnamed-tag>*), flags = param
  0 | S_LOCAL [size = 16] `Param`
      type=0x0074 (int), flags = param
  0 | S_PROC_ID_END

0x100C | LF_MFUNC_ID
         name = operator(), type = 0x100B, class type = 0x1003
0x100B | LF_MFUNCTION
         return type = <no type>, # args = 1, param list = 0x100A
         class type = 0x1003, this type = 0x1009
0x100A | LF_ARGLIST
         0x0074 (int): `int`
0x1003 | LF_CLASS `test::<unnamed-tag>`
         options: forward ref

Using MSVC on the same test, the output looks like:

  0 | S_GPROC32_ID `test`
      type = `0x1015 (test)`
      original type = 0x100F
  0 | S_BPREL32 `myLambdaFunction`
      type = 0x100F
  0 | S_PROC_ID_END

0x100F | LF_CLASS `test::__l2::<lambda_5684e4bda96652f15ead82ba8f8a98f2>`
         unique name:
`.?AV<lambda_5684e4bda96652f15ead82ba8f8a98f2>@@`28ae9b9a`
         field list: 0x100E
0x100E | LF_FIELDLIST
         - LF_METHOD .....
         - LF_ONEMETHOD ....

-- 
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/20200617/457be3df/attachment-0001.html>


More information about the llvm-bugs mailing list