================
@@ -652,6 +659,18 @@ int clangTidyMain(int argc, const char **argv) {
     FileName = PathList.front();
 
   const SmallString<256> FilePath = makeAbsolute(FileName);
+
+  std::unique_ptr<llvm::raw_fd_ostream> SarifOS;
+  if (!ExportSarif.empty()) {
+    std::error_code EC;
+    SarifOS = std::make_unique<llvm::raw_fd_ostream>(ExportSarif, EC,
----------------
matthew-j-code wrote:

I've created a new flag ExportSarifToStdout, so when "-" is set, DiagPrinter is 
now set to an IgnoringDiagConsumer instead of a TextDiagnosticPrinter. 
IgnoringDiagConsumer overrides HandleDiagnostic() to do nothing, so it silently 
discards every diagnostic instead of printing it to stdout. 

`2 warnings generated.
{
  "$schema": 
"https://docs.oasis-open.org/sarif/sarif/v2.1.0/cos02/schemas/sarif-schema-2.1.0.json";,
  "runs": [
    {
      "artifacts": [
        {
          "length": 46,`
          
Please let me know what you think.

https://github.com/llvm/llvm-project/pull/219182
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to