<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/65006>65006</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [clang-coverage/llvm-cov] -fcoverage-prefix-map is not flexiable
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          SGZW
      </td>
    </tr>
</table>

<pre>
    In my project, I use a bazel-like distributed c++ compilation tool provided by the company. In order to speed up compilation, create different directories to compile different .cc files at the same time, as follows
/compile_dir/{uuid1}/xx.cc/xx.h/common.h -> /compile_dir/{uuid1}/xx.o

/compile_dir/{uuid2}/yy.cc/xx.h/common.h -> /compile_dir/{uuid2}/yy.o

When I use clang's coverage tool(https://clang.llvm.org/docs/SourceBasedCodeCoverage.html), in the structure exported by llvm-cov, the coverage of common.h will appear multiple times, and each time it is different, This affects the final coverage statistics

I analyzed the essential reason, We currently always store absolute filenames in coverage mapping, so different compilation directories make it impossible to merge file statistics

So I want to use the parameters of fcoverage-prefix-map to replace the coverage mapping directory, but since I don't know the uuid generated by the company's internal distributed compilation tool in advance, I can't modify it by passing parameters during compilation

I wonder if clang coverage can add a gconv environment variable GCOV_PREFIX to GCOV_PREFIX_STRIP (https://llvm.org/docs/CommandGuide/llvm-cov.html) to solve this kind of problem, or fcoverage-prefix-map supports regular expressions
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycVU1v40YM_TXjC2FDlr8PPjTOeuFTF5tFt-gloGYom818CMORHe2vL0ZyEqfZtkBPQWSSj-89koMifPREW7W4U4v7EbbpFOL24fMf30dVMN324MF10MTwJ-mkyh0coBUChAp_kB1bfiIwLCly1SYyoFV5p8o70ME1bDFx8JBCsLnEmQ0ZqDpIJ-oD0HcTOHgI0VCEFEAaIgNtc5ueQXUkTBmorimST2A4kk4hMknOG8JvAyZ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