diff options
author | Joe Ranieri <jranieri@grammatech.com> | 2019-08-27 14:20:27 +0000 |
---|---|---|
committer | Joe Ranieri <jranieri@grammatech.com> | 2019-08-27 14:20:27 +0000 |
commit | 46f2f7147d0faaf017ecf7b0d3cca4e78c3f8d96 (patch) | |
tree | 6db562fbb7f73115bbc9d4583c09569f41b775e3 /lib/StaticAnalyzer/Core/SarifDiagnostics.cpp | |
parent | 3e6e5dd4b5330935fbdf866395fade004f61171a (diff) | |
download | clang-46f2f7147d0faaf017ecf7b0d3cca4e78c3f8d96.tar.gz |
Fix a SARIF exporter crash with macro expansions
Differential Revision: https://reviews.llvm.org/D65209
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@370061 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/StaticAnalyzer/Core/SarifDiagnostics.cpp')
-rw-r--r-- | lib/StaticAnalyzer/Core/SarifDiagnostics.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp b/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp index 3b4667765c..dd66d902d9 100644 --- a/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp +++ b/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp @@ -219,9 +219,10 @@ static json::Object createThreadFlow(const PathPieces &Pieces, for (const auto &Piece : Pieces) { const PathDiagnosticLocation &P = Piece->getLocation(); Locations.push_back(createThreadFlowLocation( - createLocation(createPhysicalLocation(P.asRange(), - *P.asLocation().getFileEntry(), - SMgr, Files), + createLocation(createPhysicalLocation( + P.asRange(), + *P.asLocation().getExpansionLoc().getFileEntry(), + SMgr, Files), Piece->getString()), calculateImportance(*Piece))); } @@ -255,7 +256,8 @@ static json::Object createResult(const PathDiagnostic &Diag, json::Array &Files, {"locations", json::Array{createLocation(createPhysicalLocation( Diag.getLocation().asRange(), - *Diag.getLocation().asLocation().getFileEntry(), SMgr, Files))}}, + *Diag.getLocation().asLocation().getExpansionLoc().getFileEntry(), + SMgr, Files))}}, {"ruleIndex", Iter->getValue()}, {"ruleId", Diag.getCheckName()}}; } |