r345823 - Update to the 10-10 SARIF spec.

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 1 04:52:07 PDT 2018


Author: aaronballman
Date: Thu Nov  1 04:52:07 2018
New Revision: 345823

URL: http://llvm.org/viewvc/llvm-project?rev=345823&view=rev
Log:
Update to the 10-10 SARIF spec.

This removes the Step property (which can be calculated by consumers trivially), and updates the schema and version numbers accordingly.

Modified:
    cfe/trunk/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp
    cfe/trunk/test/Analysis/diagnostics/Inputs/expected-sarif/sarif-diagnostics-taint-test.c.sarif
    cfe/trunk/test/Analysis/diagnostics/sarif-diagnostics-taint-test.c

Modified: cfe/trunk/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp?rev=345823&r1=345822&r2=345823&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp Thu Nov  1 04:52:07 2018
@@ -154,10 +154,9 @@ static StringRef importanceToStr(Importa
   llvm_unreachable("Fully covered switch is not so fully covered");
 }
 
-static json::Object createThreadFlowLocation(int Step, json::Object &&Location,
+static json::Object createThreadFlowLocation(json::Object &&Location,
                                              Importance I) {
-  return json::Object{{"step", Step},
-                      {"location", std::move(Location)},
+  return json::Object{{"location", std::move(Location)},
                       {"importance", importanceToStr(I)}};
 }
 
@@ -192,12 +191,10 @@ static Importance calculateImportance(co
 static json::Object createThreadFlow(const PathPieces &Pieces,
                                      json::Object &Files) {
   const SourceManager &SMgr = Pieces.front()->getLocation().getManager();
-  int Step = 1;
   json::Array Locations;
   for (const auto &Piece : Pieces) {
     const PathDiagnosticLocation &P = Piece->getLocation();
     Locations.push_back(createThreadFlowLocation(
-        Step++,
         createLocation(createPhysicalLocation(P.asRange(),
                                               *P.asLocation().getFileEntry(),
                                               SMgr, Files),
@@ -261,8 +258,10 @@ void SarifDiagnostics::FlushDiagnosticsI
     llvm::errs() << "warning: could not create file: " << EC.message() << '\n';
     return;
   }
-  json::Object Sarif{{"$schema", "http://json.schemastore.org/sarif-2.0.0"},
-                     {"version", "2.0.0-beta.2018-09-26"},
-                     {"runs", json::Array{createRun(Diags)}}};
+  json::Object Sarif{
+      {"$schema",
+       "http://json.schemastore.org/sarif-2.0.0-csd.2.beta.2018-10-10"},
+      {"version", "2.0.0-csd.2.beta.2018-10-10"},
+      {"runs", json::Array{createRun(Diags)}}};
   OS << llvm::formatv("{0:2}", json::Value(std::move(Sarif)));
 }

Modified: cfe/trunk/test/Analysis/diagnostics/Inputs/expected-sarif/sarif-diagnostics-taint-test.c.sarif
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/diagnostics/Inputs/expected-sarif/sarif-diagnostics-taint-test.c.sarif?rev=345823&r1=345822&r2=345823&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/diagnostics/Inputs/expected-sarif/sarif-diagnostics-taint-test.c.sarif (original)
+++ cfe/trunk/test/Analysis/diagnostics/Inputs/expected-sarif/sarif-diagnostics-taint-test.c.sarif Thu Nov  1 04:52:07 2018
@@ -1,5 +1,5 @@
 {
-  "$schema": "http://json.schemastore.org/sarif-2.0.0",
+  "$schema": "http://json.schemastore.org/sarif-2.0.0-csd.2.beta.2018-10-10",
   "runs": [
     {
       "files": {
@@ -7,7 +7,7 @@
           "fileLocation": {
             "uri": "file:sarif-diagnostics-taint-test.c"
           },
-          "length": 497,
+          "length": 510,
           "mimeType": "text/plain",
           "roles": [
             "resultFile"
@@ -38,8 +38,7 @@
                             "startLine": 13
                           }
                         }
-                      },
-                      "step": 1
+                      }
                     },
                     {
                       "importance": "essential",
@@ -58,8 +57,7 @@
                             "startLine": 9
                           }
                         }
-                      },
-                      "step": 2
+                      }
                     }
                   ]
                 }
@@ -95,5 +93,5 @@
       }
     }
   ],
-  "version": "2.0.0-beta.2018-09-26"
+  "version": "2.0.0-csd.2.beta.2018-10-10"
 }

Modified: cfe/trunk/test/Analysis/diagnostics/sarif-diagnostics-taint-test.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/diagnostics/sarif-diagnostics-taint-test.c?rev=345823&r1=345822&r2=345823&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/diagnostics/sarif-diagnostics-taint-test.c (original)
+++ cfe/trunk/test/Analysis/diagnostics/sarif-diagnostics-taint-test.c Thu Nov  1 04:52:07 2018
@@ -1,4 +1,4 @@
-// RUN: %clang_analyze_cc1 -analyzer-checker=alpha.security.taint,debug.TaintTest %s -verify -analyzer-output=sarif -o - | diff -U1 -w -I ".*file:.*sarif-diagnostics-taint-test.c" -I '"version":' -I "2\.0\.0\-beta\." - %S/Inputs/expected-sarif/sarif-diagnostics-taint-test.c.sarif
+// RUN: %clang_analyze_cc1 -analyzer-checker=alpha.security.taint,debug.TaintTest %s -verify -analyzer-output=sarif -o - | diff -U1 -w -I ".*file:.*sarif-diagnostics-taint-test.c" -I '"version":' -I "2\.0\.0\-csd\.[0-9]*\.beta\." - %S/Inputs/expected-sarif/sarif-diagnostics-taint-test.c.sarif
 #include "../Inputs/system-header-simulator.h"
 
 int atoi(const char *nptr);




More information about the cfe-commits mailing list