diff options
| author | Artem Dergachev <artem.dergachev@gmail.com> | 2020-02-04 22:48:19 +0300 |
|---|---|---|
| committer | Hans Wennborg <hans@chromium.org> | 2020-02-10 13:41:47 +0100 |
| commit | 720870ee60a2cf5259bdc5e9b2a5336381a165fc (patch) | |
| tree | f14100ac526bad98802cdc97114fbb2bb0471a4c /clang/lib/StaticAnalyzer | |
| parent | e2c0c70101ae4419917b232beae37b3d3a713b0c (diff) | |
| download | bcm5719-llvm-720870ee60a2cf5259bdc5e9b2a5336381a165fc.tar.gz bcm5719-llvm-720870ee60a2cf5259bdc5e9b2a5336381a165fc.zip | |
[analyzer] Fix a couple of bugs in HTML report generation.
It should now produce valid HTML again.
Differential Revision: https://reviews.llvm.org/D73993
(cherry picked from commit 482e236e569e8324f70778af1eb756923cd490dc)
Diffstat (limited to 'clang/lib/StaticAnalyzer')
| -rw-r--r-- | clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp b/clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp index a4918d7179f..002b6070ddc 100644 --- a/clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp +++ b/clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp @@ -607,10 +607,17 @@ window.addEventListener("keydown", function (event) { )<<<"; } +static bool shouldDisplayPopUpRange(const SourceRange &Range) { + return !(Range.getBegin().isMacroID() || Range.getEnd().isMacroID()); +} + static void HandlePopUpPieceStartTag(Rewriter &R, const std::vector<SourceRange> &PopUpRanges) { for (const auto &Range : PopUpRanges) { + if (!shouldDisplayPopUpRange(Range)) + continue; + html::HighlightRange(R, Range.getBegin(), Range.getEnd(), "", "<table class='variable_popup'><tbody>", /*IsTokenRange=*/true); @@ -626,6 +633,8 @@ static void HandlePopUpPieceEndTag(Rewriter &R, llvm::raw_svector_ostream Out(Buf); SourceRange Range(Piece.getLocation().asRange()); + if (!shouldDisplayPopUpRange(Range)) + return; // Write out the path indices with a right arrow and the message as a row. Out << "<tr><td valign='top'><div class='PathIndex PathIndexPopUp'>" @@ -870,7 +879,7 @@ void HTMLDiagnostics::HandlePiece(Rewriter &R, FileID BugFileID, << (num - 1) << "\" title=\"Previous event (" << (num - 1) - << ")\">←</a></div></td>"; + << ")\">←</a></div>"; } os << "</td><td>"; |

