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 | 3385c5cc4dfdb024cd6ddc3f8012e6744e677505 (patch) | |
tree | a0f3c59dcf11db113ae5bd49a76cff9f6d235270 /clang/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp | |
parent | 68a6a28ef835d121b9673e4ca08c38f221d3aee7 (diff) | |
download | bcm5719-llvm-3385c5cc4dfdb024cd6ddc3f8012e6744e677505.tar.gz bcm5719-llvm-3385c5cc4dfdb024cd6ddc3f8012e6744e677505.zip |
Fix a SARIF exporter crash with macro expansions
Differential Revision: https://reviews.llvm.org/D65209
llvm-svn: 370061
Diffstat (limited to 'clang/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp')
-rw-r--r-- | clang/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp b/clang/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp index 3b4667765c2..dd66d902d9d 100644 --- a/clang/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp +++ b/clang/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()}}; } |