<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 - -fdebug-prefix-map is not applied to lambda template arguments"
   href="https://bugs.llvm.org/show_bug.cgi?id=42237">42237</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>-fdebug-prefix-map is not applied to lambda template arguments
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </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>ncalexander@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>With -fdebug-prefix-map specified, I witnessed some paths in debug output that
weren't remapped.  I'm not really expert in C++, so it's easiest for me to tell
what my debugging revealed and then try to explain what I think the issue is
and what a test case might look like.

The issue is at
<a href="https://github.com/llvm-mirror/clang/blob/15d397ff14e322428f9d7cda7b9a8d4087ef1b62/lib/CodeGen/CGDebugInfo.cpp#L263">https://github.com/llvm-mirror/clang/blob/15d397ff14e322428f9d7cda7b9a8d4087ef1b62/lib/CodeGen/CGDebugInfo.cpp#L263</a>.
 If `printName` includes a type that is itself a C++ lambda, that lambda has a
source location printed.  Since `printName` doesn't take a `PrintingPolicy`,
the default `PrintingPolicy` is used, and the default doesn't have the
`RemapFilePaths` flag set.

I think a a minimal test case is a function parameterized by a type that is
itself a lambda with a source location.

In practice, I see this with entries like:
```
operator mozilla::detail::RunnableFunction<(lambda at
/home/nalexander/Mozilla/gecko/dom/audiochannel/AudioChannelService.cpp:745:9)>
*
```
while building Firefox.  The code in question can be viewed here:
<a href="https://searchfox.org/mozilla-central/rev/0da35261b6789eec65476dbdd4913df6e235af6d/dom/audiochannel/AudioChannelService.cpp#745">https://searchfox.org/mozilla-central/rev/0da35261b6789eec65476dbdd4913df6e235af6d/dom/audiochannel/AudioChannelService.cpp#745</a>.

It's not trivial to build Firefox so I am happy to dig in to answer follow-up
questions.

I did look at addressing this issue.  I see two options:

1) add an optional `PrintingPolicy` parameter to `printName`.  I worked up a
patch and used this variant only in `CGDebugInfo.cpp`; it appears to work fine.

2) Make the default `PrintingPolicy` have `RemapFilePaths`.  I'm assuming
that's hard due to the rewriting lambda?

2) Make all invocations of `printName` take a `PrintingPolicy`.  This seems the
most sensible -- the default policy opens the door to tickets like this -- but
would require somebody with familiarity with clang's codebase to do properly.</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>