diff options
author | Aaron Ballman <aaron@aaronballman.com> | 2018-11-01 11:52:07 +0000 |
---|---|---|
committer | Aaron Ballman <aaron@aaronballman.com> | 2018-11-01 11:52:07 +0000 |
commit | fa28f335b84babbaadb1a39b9d16247c947b4683 (patch) | |
tree | 33bae0c67d6b016c9d7c28be65db408b535d2768 /clang/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp | |
parent | bb84407f3d97da8664e9c3e6aa6eaef6a894ca1e (diff) | |
download | bcm5719-llvm-fa28f335b84babbaadb1a39b9d16247c947b4683.tar.gz bcm5719-llvm-fa28f335b84babbaadb1a39b9d16247c947b4683.zip |
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.
llvm-svn: 345823
Diffstat (limited to 'clang/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp')
-rw-r--r-- | clang/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp b/clang/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp index d86d1ff6870..34e948634a0 100644 --- a/clang/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp +++ b/clang/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp @@ -154,10 +154,9 @@ static StringRef importanceToStr(Importance I) { 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(const PathDiagnosticPiece &Piece) { 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::FlushDiagnosticsImpl( 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))); } |