This adds a callback to PrintingPolicy to allow CGDebugInfo to remap file paths according to -fdebug-prefix-map. Otherwise the debug info (particularly function names for C++ lambdas) may contain paths that should have been remapped in the debug info.
Details
- Reviewers
dblaikie davide probinson - Commits
- rG56acd5a66ea3: Honor -fdebug-prefix-map when creating function names for the debug info.
rGbef4f92a3b05: Honor -fdebug-prefix-map when creating function names for the debug info.
rC348397: Honor -fdebug-prefix-map when creating function names for the debug info.
rL348397: Honor -fdebug-prefix-map when creating function names for the debug info.
rL348060: Honor -fdebug-prefix-map when creating function names for the debug info.
rC348060: Honor -fdebug-prefix-map when creating function names for the debug info.
Diff Detail
Event Timeline
Can't say I know much abouth the path remapping functionality - what it's used for, where it's implemented in general, etc - so figure someone with more of that knowledge might be best off reviewing this.
lib/CodeGen/CGDebugInfo.cpp | ||
---|---|---|
238 | Unconditionally? |
One common use-case for path remapping is a build system that builds on a different machine in some local directory, but wanting the debug info appear as if the source code were in a previously agreed-upon path so it can be debugged on another machine were the source code can be found in that same path.
Only initialize RemapFilePaths when DebugPrefixMap is nonempty. Should be slightly faster.
LGTM aside from a grump about the test, which is totally up to you.
test/CodeGenCXX/debug-prefix-map-lambda.cpp | ||
---|---|---|
8 | I've never liked tests that hard-code the test file name. FileCheck lets you define variables on the RUN line, is there a lit substitution that will return just the basename? |
test/CodeGenCXX/debug-prefix-map-lambda.cpp | ||
---|---|---|
8 | Looks like there is not LIT substitution for the filename without the path. At least not a documented one. |
Unconditionally?