[llvm-bugs] [Bug 43614] New: clang's coverage mapping uses absolute paths instead of relative paths
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Oct 8 16:46:59 PDT 2019
https://bugs.llvm.org/show_bug.cgi?id=43614
Bug ID: 43614
Summary: clang's coverage mapping uses absolute paths instead
of relative paths
Product: clang
Version: 8.0
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: LLVM Codegen
Assignee: unassignedclangbugs at nondot.org
Reporter: rnk at google.com
CC: arphaman at gmail.com, llvm-bugs at lists.llvm.org,
neeilans at live.com, nicolasweber at gmx.de,
richard-llvm at metafoo.co.uk, vk at vedantk.com
Originally reported as https://crbug.com/1010267.
Clang has a few options that are meant to help prevent absolute paths from
appearing in the compiler's output:
- -fdebug-compilation-dir .
- -no-canonical-prefixes
The intention is that when using these flags, the output should be the same
regardless of the CWD used to run the compiler, as long as all the input files
exist at the same relative paths in two compilations. This makes it possible to
distribute local compilation to another machine without having to set up a
chroot or recreate the user's CWD on the remote machine.
However, when enabling the coverage mapping with -fprofile-instr-generate
-fcoverage-mapping, the coverage mapping data ends up containing absolute
paths. The code calls sys::fs::make_absolute here:
https://github.com/llvm/llvm-project/blob/367405008755640eac6114b18ec8c98be0cf5392/clang/lib/CodeGen/CoverageMappingGen.cpp#L1283
std::string normalizeFilename(StringRef Filename) {
llvm::SmallString<256> Path(Filename);
llvm::sys::fs::make_absolute(Path);
llvm::sys::path::remove_dots(Path, /*remove_dot_dot=*/true);
return Path.str().str();
}
The make_absolute call seems to be present in the original version of the code
added in r214752.
What would be the best way to indicate to the coverage code that we don't want
absolute paths in the output? Should the coverage code reuse the logic of
`CGDebugInfo::remapDI` to respect -fdebug-prefix-map? Coverage mapping info is
kind of like debug info, but it's certainly not DWARF.
--
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/20191008/2edd7454/attachment.html>
More information about the llvm-bugs
mailing list