[PATCH] D99695: [llvm-cov] Use -path-equivalence to support relative path.
Vedant Kumar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 1 10:18:50 PDT 2021
vsk added a comment.
> This patch let llvm-cov construct output directory with the to part of -path-equivalence=from,to as prefix
I think this makes sense.
> For example, if we have /tmp/src/a.cpp embedded in the binary, llvm-cov show -path-equivalence=/tmp/src/,/cov ... will generate output direcotry like this: coverage/cov/a.cpp.
What happens if the binary has a relative path '../../a.cpp' embedded and the user passes `-path-equivalence=/tmp/src/,/cov` to llvm-cov? Is a.cpp written to `<coverage-dir>/cov/../../a.cpp`?
> But if -path-equivalence is not given and ../../a.cpp is embedded in the binary, llvm-cov may still generate report files outside report directory when source files are found. Maybe we should give a warning/error to let user use -path-equivalence when relative path is present?
Until recently, relative paths weren't allowed in the coverage mapping. I don't believe it was ever the intention to allow llvm-cov to write files outside of the coverage dir. That sounds dangerous to me, fwiw I think that should be a hard error and the tool should refuse to do it.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D99695/new/
https://reviews.llvm.org/D99695
More information about the llvm-commits
mailing list