<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] Different lambda functions getting the same codeview function ID"
   href="https://bugs.llvm.org/show_bug.cgi?id=48432">48432</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[codeview] Different lambda functions getting the same codeview function ID
          </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>akhuang@google.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>If there are multiple lambda functions in a file, they sometimes get the same
function id.
In the symbolizer output below, both lambda functions in the stack trace have
the line number 5, even though the second one should be on line 6.

repro:

$ cat t.cpp
template <class F> void uselambda1(int &x, F f) { f(x); }
template <class F> void uselambda2(int &x, F f) { f(x); }

int Test(int n) {
  uselambda1(n, [](int &x) { x /= 10; });
  uselambda2(n, [](int &x) { x *= 2; });
  return n;
}

int main() {
  return Test(100);
}

$ clang -cc1 -triple x86_64-pc-windows-msvc -gcodeview
-debug-info-kind=line-tables-only -O2 -emit-obj -o t.obj t.cpp
$ lld-link -debug -entry:main -pdb:t.pdb t.obj
$ llvm-symbolizer --obj=t.exe --relative-address 0x1001 0x1018
Test(int)::(anonymous class)::operator()
C:\src\tests\sbox-integration\small-repro\t.cpp:5:0
uselambda1
C:\src\tests\sbox-integration\small-repro\t.cpp:1:0
Test(int)??:0:0

Test(int)::(anonymous class)::operator()
C:\src\tests\sbox-integration\small-repro\t.cpp:5:0
uselambda2
C:\src\tests\sbox-integration\small-repro\t.cpp:2:0
Test(int)
??:0:0

A dump of the inline line table shows that there are two functions with the
func id 0x1001.

                       Inlinee Lines
============================================================
Mod 0000 | `C:\src\tests\t.obj`:
 Inlinee |  Line | Source File
  0x1000 |     1 | C:\src\tests\t.cpp (MD5: 4A4CBE958FA977B1C4A844AA292CF8C3)
  0x1001 |     5 | C:\src\tests\t.cpp (MD5: 4A4CBE958FA977B1C4A844AA292CF8C3)
  0x1002 |     2 | C:\src\tests\t.cpp (MD5: 4A4CBE958FA977B1C4A844AA292CF8C3)
  0x1001 |     6 | C:\src\tests\t.cpp (MD5: 4A4CBE958FA977B1C4A844AA292CF8C3)

Mod 0001 | `* Linker *`:


(side note: there should be a line number for `Test(int)` in the symbolizer
output -- this is an unrelated bug in llvm-symbolizer)</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>