[PATCH] D99695: [llvm-cov] Use -path-equivalence to support relative path.
Zequan Wu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 31 17:20:07 PDT 2021
zequanwu created this revision.
zequanwu added reviewers: vsk, tunz, phosek, rnk.
zequanwu requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Right now, llvm-cov doesn't support relative path and `-path-equivalence` is
only used for search source files. If the file path embedded in the binary is a
relative path and we use `llvm-cov show -path-equivalence=from,to`, the location
of generated coverage report files will be relative to current working direcotry.
If `../../test.cpp` is embedded, coverage report files will be generated outside
the directory specified by `-o`.
This patch let llvm-cov construct output directory with the to part of
`-path-equivalence=from,to` as prefix. 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`.
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?
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D99695
Files:
llvm/test/tools/llvm-cov/Inputs/relative_path.o64l
llvm/test/tools/llvm-cov/Inputs/relative_path.proftext
llvm/test/tools/llvm-cov/relative_path.c
llvm/test/tools/llvm-cov/warnings.h
llvm/tools/llvm-cov/CodeCoverage.cpp
llvm/tools/llvm-cov/CoverageReport.cpp
llvm/tools/llvm-cov/CoverageReport.h
llvm/tools/llvm-cov/CoverageViewOptions.h
llvm/tools/llvm-cov/SourceCoverageView.cpp
llvm/tools/llvm-cov/SourceCoverageView.h
llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp
llvm/tools/llvm-cov/SourceCoverageViewText.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99695.334564.patch
Type: text/x-patch
Size: 13407 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210401/25a44668/attachment.bin>
More information about the llvm-commits
mailing list