[analyzer] [NFC] Move methods for dumping the coverage in HTMLDiagnostics into the class

Differential Revision: https://reviews.llvm.org/D51513

llvm-svn: 341724
This commit is contained in:
George Karpenkov 2018-09-07 22:13:35 +00:00
parent e4707e7a4a
commit 3310893288
1 changed files with 12 additions and 5 deletions

View File

@ -122,6 +122,15 @@ private:
/// \return Javascript for navigating the HTML report using j/k keys.
StringRef generateKeyboardNavigationJavascript();
/// \return JavaScript for an option to only show relevant lines.
std::string showRelevantLinesJavascript(
const PathDiagnostic &D, const PathPieces &path);
/// Write executed lines from \p D in JSON format into \p os.
void dumpCoverageData(const PathDiagnostic &D,
const PathPieces &path,
llvm::raw_string_ostream &os);
};
} // namespace
@ -333,8 +342,7 @@ std::string HTMLDiagnostics::GenerateHTML(const PathDiagnostic& D, Rewriter &R,
return os.str();
}
/// Write executed lines from \p D in JSON format into \p os.
static void serializeExecutedLines(
void HTMLDiagnostics::dumpCoverageData(
const PathDiagnostic &D,
const PathPieces &path,
llvm::raw_string_ostream &os) {
@ -360,13 +368,12 @@ static void serializeExecutedLines(
os << "};";
}
/// \return JavaScript for an option to only show relevant lines.
static std::string showRelevantLinesJavascript(
std::string HTMLDiagnostics::showRelevantLinesJavascript(
const PathDiagnostic &D, const PathPieces &path) {
std::string s;
llvm::raw_string_ostream os(s);
os << "<script type='text/javascript'>\n";
serializeExecutedLines(D, path, os);
dumpCoverageData(D, path, os);
os << R"<<<(
var filterCounterexample = function (hide) {