diff options
author | George Karpenkov <ekarpenkov@apple.com> | 2018-01-17 02:59:11 +0000 |
---|---|---|
committer | George Karpenkov <ekarpenkov@apple.com> | 2018-01-17 02:59:11 +0000 |
commit | b2aa74af5d94a29e28664955d6f716bedb766545 (patch) | |
tree | 3d74c91520e9fb52c8cbf196cd6fd839702758af /lib/Rewrite/HTMLRewrite.cpp | |
parent | 0b2fb3a9d0e6306f3839c8c5460e74e6f88b086a (diff) | |
download | clang-b2aa74af5d94a29e28664955d6f716bedb766545.tar.gz |
[analyzer] support a mode to only show relevant lines in HTML diagnostics
HTML diagnostics can be an overwhelming blob of pages of code.
This patch adds a checkbox which filters this list down to only the
lines *relevant* to the counterexample by e.g. skipping branches which
analyzer has assumed to be infeasible at a time.
The resulting amount of output is much smaller, and often fits on one
screen, and also provides a much more readable diagnostics.
Differential Revision: https://reviews.llvm.org/D41378
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@322612 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Rewrite/HTMLRewrite.cpp')
-rw-r--r-- | lib/Rewrite/HTMLRewrite.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/Rewrite/HTMLRewrite.cpp b/lib/Rewrite/HTMLRewrite.cpp index 618c0179f1..d3247846bc 100644 --- a/lib/Rewrite/HTMLRewrite.cpp +++ b/lib/Rewrite/HTMLRewrite.cpp @@ -210,9 +210,9 @@ static void AddLineNumber(RewriteBuffer &RB, unsigned LineNo, SmallString<256> Str; llvm::raw_svector_ostream OS(Str); - OS << "<tr><td class=\"num\" id=\"LN" - << LineNo << "\">" - << LineNo << "</td><td class=\"line\">"; + OS << "<tr class=\"codeline\" data-linenumber=\"" << LineNo << "\">" + << "<td class=\"num\" id=\"LN" << LineNo << "\">" << LineNo + << "</td><td class=\"line\">"; if (B == E) { // Handle empty lines. OS << " </td></tr>"; @@ -263,7 +263,10 @@ void html::AddLineNumbers(Rewriter& R, FileID FID) { } // Add one big table tag that surrounds all of the code. - RB.InsertTextBefore(0, "<table class=\"code\">\n"); + std::string s; + llvm::raw_string_ostream os(s); + os << "<table class=\"code\" data-fileid=\"" << FID.getHashValue() << "\">\n"; + RB.InsertTextBefore(0, os.str()); RB.InsertTextAfter(FileEnd - FileBeg, "</table>"); } |