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

    <tr>
        <th>Summary</th>
        <td>
            Explain code coverage with Lit in docs/SourceBasedCodeCoverage.rst
        </td>
    </tr>

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

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

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

<pre>
    The documentation for code coverage in `docs/SourceBasedCodeCoverage.rst` omits a couple of crucial steps when using it with Lit.  I’d suggest the following additions (patch attached):

At the end of “Running the instrumented program”:

> For a program such as the :doc:`Lit <CommandGuide/lit>` testing tool which
> invokes other programs, it may be necessary to set ``LLVM_PROFILE_FILE`` for
> each invocation. The pattern strings "%p" or "%Nm" may help to avoid
> corruption due to concurrency.

18 lines later, after “code-block:: console”:


> For an example of merging multiple profiles created by testing,
> see the LLVM `coverage build script <https://github.com/llvm/llvm-zorg/blob/main/zorg/jenkins/jobs/jobs/llvm-coverage>`_.

[Coverage_doc_Flash_Sheridan.patch](https://github.com/llvm/llvm-project/files/10248227/Coverage_doc_Flash_Sheridan.patch)

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVE2PnDgQ_TXmUkoLDPTAgcNMz7CKNPuhZLXXlrGrwTPGhfwxnd5fvzLTbCeRVtlcQJjyq1fvVZXwXo8WsWP1A6sfMxHDRK7rjfDT5wmdVsJmA6lL9-eEoEjGGW0QQZOFEzmQpBAkvaETI4K2wPa5IukZ7z9TdBIfhEd1IIWHa9DO-cD2OdCsgwcBkuJiEOgE0kWphQEfcPFwntBC9NqOoAOcdZjgWYcdwEf2xFmTs7ZV4OM4og8QJoQTGUPnFC-U0omhB8abRQQ5gQhByAkV4y0r71n-yPLr8_79NlqVOGzYh0_R2oSV_mnrg1sLRwWLo9GJeQt8_A6OlU_QkwOxBYKPKb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