Index: lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp =================================================================== --- lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp +++ lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp @@ -263,6 +263,13 @@ R.InsertTextBefore(SMgr.getLocForStartOfFile(FID), os.str()); } + { + std::string s; + llvm::raw_string_ostream os(s); + os << ""; + R.InsertTextBefore(SMgr.getLocForStartOfFile(FID), os.str()); + } + // Add CSS, header, and footer. html::AddHeaderFooterInternalBuiltinCSS(R, FID, Entry->getName()); Index: tools/scan-build/keyboard-shortcuts.js =================================================================== --- /dev/null +++ tools/scan-build/keyboard-shortcuts.js @@ -0,0 +1,41 @@ +(function () { + +function Jump(matchTarget, lastBlock) { + var match = document.location.hash.match(/Path\d+|EndPath/)[0]; + var matches = document.querySelectorAll('#' + match + ' .PathNav') + if (matches.length == 2) { + document.location = matches[matchTarget].children[0].href; + } else { + if (!document.location.hash.includes(lastBlock)) { + document.location = matches[0].children[0].href; + } + } +}; + +function ShowHelp() { + alert("Keyboard shortcuts:\n\n" + + "Jump to next path: j\n" + + "Jump to previous path: k\n"); +} + +const KEYS = { + J: 74, + K: 75, + SLASH: 191 +} + +document.onkeydown = function (e) { + switch(e.keyCode) { + case KEYS.J: + Jump(1, '#EndPath'); + break; + case KEYS.K: + Jump(0, '#Path1'); + break; + case KEYS.SLASH: + ShowHelp(); + break; + } +}; + +}()); Index: tools/scan-build/scan-build =================================================================== --- tools/scan-build/scan-build +++ tools/scan-build/scan-build @@ -459,28 +459,20 @@ ##----------------------------------------------------------------------------## sub CopyFiles { - my $Dir = shift; + my @Files = ("sorttable.js", "keyboard-shortcuts.js", "scanview.css"); - my $JS = Cwd::realpath("$RealBin/sorttable.js"); - - DieDiag("Cannot find 'sorttable.js'.\n") - if (! -r $JS); - - copy($JS, "$Dir"); + foreach my $FileName (@Files) { + my $File = Cwd::realpath("$RealBin/$FileName"); - DieDiag("Could not copy 'sorttable.js' to '$Dir'.\n") - if (! -r "$Dir/sorttable.js"); + DieDiag("Cannot find '$FileName'.\n") + if (! -r $File); - my $CSS = Cwd::realpath("$RealBin/scanview.css"); + copy($File, "$Dir"); - DieDiag("Cannot find 'scanview.css'.\n") - if (! -r $CSS); - - copy($CSS, "$Dir"); - - DieDiag("Could not copy 'scanview.css' to '$Dir'.\n") - if (! -r $CSS); + DieDiag("Could not copy '$FileName' to '$Dir'.\n") + if (! -r "$Dir/$FileName"); + } } ##----------------------------------------------------------------------------##