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

    <tr>
        <th>Summary</th>
        <td>
            Clang mixes traditional output with SARIF diagnostics
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang:diagnostics,
            confirmed
      </td>
    </tr>

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

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

<pre>
    @AaronBallman [identified that `clang -v -fdiagnostics-format=sarif`](https://discourse.llvm.org/t/adding-options-for-clang-to-write-diagnostics-to-file/67762/41) will [output the verbose parts as unstructured text and the remainder as SARIF](https://godbolt.org/z/e4hqhY746), and @dwblaikie confirmed this.

This makes piping SARIF diagnostics difficult, as we'd need an intermediate step to scrape the JSON. Fortunately, I think the [`driver`](https://docs.oasis-open.org/sarif/sarif/v2.1.0/csprd01/sarif-v2.1.0-csprd01.html#_Toc10540969) and [`invocation`](https://docs.oasis-open.org/sarif/sarif/v2.1.0/csprd01/sarif-v2.1.0-csprd01.html#_Toc10541005) properties have us covered. I haven't finished combing the `invocation` property, but it looks as though we should be able to port most of this information over.

Since this is metadata, it would probably be best if this information is always present in SARIF; that means `-v` has no effect when `-fdiagnostics-format=sarif` is turned on.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzEVM2OpDYQfhr3pQQyhqabA4eeGSFNDomU2UtOkcFFUzvGJnbRvZOnj0z3ZCebTa57Acm2vp_6-XSMdHaIrdg_CKWGz6YXSon9006vPPnQppNd781bKyp50sG7B23trB2I_QMZdEwjoQGeNIOo5WC1O0N2gWw0pM_OR6YhZqMPs2ZRPkUdaBS1FPsnoY4T8xJFeRKqE6ozFAe_hoi5tZc59-EsVMdCddoYcufML0zebWDZxpOxz66BGLOPXOyzkSwK1dWHQ62E6qpCqAauZG1S7VdeVgaeEC4Yeh8RFh04go6wushhH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