[llvm-bugs] [Bug 42237] New: -fdebug-prefix-map is not applied to lambda template arguments

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jun 11 09:27:33 PDT 2019


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

            Bug ID: 42237
           Summary: -fdebug-prefix-map is not applied to lambda template
                    arguments
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: ncalexander at gmail.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
                    neeilans at live.com, richard-llvm at metafoo.co.uk

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
https://github.com/llvm-mirror/clang/blob/15d397ff14e322428f9d7cda7b9a8d4087ef1b62/lib/CodeGen/CGDebugInfo.cpp#L263.
 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:
https://searchfox.org/mozilla-central/rev/0da35261b6789eec65476dbdd4913df6e235af6d/dom/audiochannel/AudioChannelService.cpp#745.

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.

-- 
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/20190611/0de8a782/attachment.html>


More information about the llvm-bugs mailing list