diff options
author | Csaba Dabis <dabis.csaba98@gmail.com> | 2019-08-09 02:20:44 +0000 |
---|---|---|
committer | Csaba Dabis <dabis.csaba98@gmail.com> | 2019-08-09 02:20:44 +0000 |
commit | 124ef7fce40369a176a2d354a214bf62460b5446 (patch) | |
tree | 0333be04380fdc9f2dbc4adef22e071e6d9eec44 /clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp | |
parent | 1861f4ea25844a1a6b2f940e9f12acbaa5d63f4d (diff) | |
download | bcm5719-llvm-124ef7fce40369a176a2d354a214bf62460b5446.tar.gz bcm5719-llvm-124ef7fce40369a176a2d354a214bf62460b5446.zip |
[analyzer] ConditionBRVisitor: Fix HTML PathDiagnosticPopUpPieces
Summary:
A condition could be a multi-line expression where we create the highlight
in separated chunks. PathDiagnosticPopUpPiece is not made for that purpose,
it cannot be added to multiple lines because we have only one ending part
which contains all the notes. So that it cannot have multiple endings and
therefore this patch narrows down the ranges of the highlight to the given
interesting variable of the condition. It prevents HTML-breaking injections.
Reviewed By: NoQ
Differential Revision: https://reviews.llvm.org/D65663
llvm-svn: 368382
Diffstat (limited to 'clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp')
-rw-r--r-- | clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp b/clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp index f781c949e4d..a6416957225 100644 --- a/clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp +++ b/clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp @@ -612,7 +612,7 @@ HandlePopUpPieceStartTag(Rewriter &R, for (const auto &Range : PopUpRanges) { html::HighlightRange(R, Range.getBegin(), Range.getEnd(), "", "<table class='variable_popup'><tbody>", - /*IsTokenRange=*/false); + /*IsTokenRange=*/true); } } @@ -644,12 +644,11 @@ static void HandlePopUpPieceEndTag(Rewriter &R, Out << "</tbody></table></span>"; html::HighlightRange(R, Range.getBegin(), Range.getEnd(), "<span class='variable'>", Buf.c_str(), - /*IsTokenRange=*/false); - - // Otherwise inject just the new row at the end of the range. + /*IsTokenRange=*/true); } else { + // Otherwise inject just the new row at the end of the range. html::HighlightRange(R, Range.getBegin(), Range.getEnd(), "", Buf.c_str(), - /*IsTokenRange=*/false); + /*IsTokenRange=*/true); } } |