1 //===- SourceCoverageViewHTML.cpp - A html code coverage view -------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 /// \file This file implements the html coverage renderer.
11 //===----------------------------------------------------------------------===//
13 #include "CoverageReport.h"
14 #include "SourceCoverageViewHTML.h"
15 #include "llvm/ADT/SmallString.h"
16 #include "llvm/ADT/StringExtras.h"
17 #include "llvm/Support/Format.h"
18 #include "llvm/Support/Path.h"
25 // Return a string with the special characters in \p Str escaped.
26 std::string
escape(StringRef Str
, const CoverageViewOptions
&Opts
) {
27 std::string TabExpandedResult
;
28 unsigned ColNum
= 0; // Record the column number.
31 // Replace '\t' with up to TabSize spaces.
32 unsigned NumSpaces
= Opts
.TabSize
- (ColNum
% Opts
.TabSize
);
33 TabExpandedResult
.append(NumSpaces
, ' ');
36 TabExpandedResult
+= C
;
37 if (C
== '\n' || C
== '\r')
43 std::string EscapedHTML
;
45 raw_string_ostream OS
{EscapedHTML
};
46 printHTMLEscaped(TabExpandedResult
, OS
);
51 // Create a \p Name tag around \p Str, and optionally set its \p ClassName.
52 std::string
tag(const std::string
&Name
, const std::string
&Str
,
53 const std::string
&ClassName
= "") {
54 std::string Tag
= "<" + Name
;
55 if (!ClassName
.empty())
56 Tag
+= " class='" + ClassName
+ "'";
57 return Tag
+ ">" + Str
+ "</" + Name
+ ">";
60 // Create an anchor to \p Link with the label \p Str.
61 std::string
a(const std::string
&Link
, const std::string
&Str
,
62 const std::string
&TargetName
= "") {
63 std::string Name
= TargetName
.empty() ? "" : ("name='" + TargetName
+ "' ");
64 return "<a " + Name
+ "href='" + Link
+ "'>" + Str
+ "</a>";
67 const char *BeginHeader
=
69 "<meta name='viewport' content='width=device-width,initial-scale=1'>"
70 "<meta charset='UTF-8'>";
72 const char *CSSForCoverage
=
74 background-color: #ffd0d0;
77 background-color: cyan;
80 font-family: -apple-system, sans-serif;
83 margin-top: 0px !important;
84 margin-bottom: 0px !important;
88 border-bottom: 1px solid #dbdbdb;
89 background-color: #eee;
96 border: 1px solid #dbdbdb;
100 background-color: rgba(0, 0, 0, 0);
105 border: 1px solid #dbdbdb;
109 border-collapse: collapse;
113 border: 1px solid #dbdbdb;
117 border: 1px solid #dbdbdb;
127 .column-entry-yellow {
129 background-color: #ffffd0;
131 .column-entry-yellow:hover {
132 background-color: #fffff0;
136 background-color: #ffd0d0;
138 .column-entry-red:hover {
139 background-color: #fff0f0;
141 .column-entry-green {
143 background-color: #d0ffd0;
145 .column-entry-green:hover {
146 background-color: #f0fff0;
163 background-color: #b3e6ff;
164 text-decoration: none;
166 .tooltip span.tooltip-content {
178 .tooltip span.tooltip-content:after {
185 border-top: 8px solid #000000;
186 border-right: 8px solid transparent;
187 border-left: 8px solid transparent;
189 :hover.tooltip span.tooltip-content {
199 border-collapse: collapse;
200 border-right: solid 1px #eee;
201 border-left: solid 1px #eee;
205 display: inline-block;
214 background-color: #f0f0f0;
218 const char *EndHeader
= "</head>";
220 const char *BeginCenteredDiv
= "<div class='centered'>";
222 const char *EndCenteredDiv
= "</div>";
224 const char *BeginSourceNameDiv
= "<div class='source-name-title'>";
226 const char *EndSourceNameDiv
= "</div>";
228 const char *BeginCodeTD
= "<td class='code'>";
230 const char *EndCodeTD
= "</td>";
232 const char *BeginPre
= "<pre>";
234 const char *EndPre
= "</pre>";
236 const char *BeginExpansionDiv
= "<div class='expansion-view'>";
238 const char *EndExpansionDiv
= "</div>";
240 const char *BeginTable
= "<table>";
242 const char *EndTable
= "</table>";
244 const char *ProjectTitleTag
= "h1";
246 const char *ReportTitleTag
= "h2";
248 const char *CreatedTimeTag
= "h4";
250 std::string
getPathToStyle(StringRef ViewPath
) {
251 std::string PathToStyle
;
252 std::string PathSep
= std::string(sys::path::get_separator());
253 unsigned NumSeps
= ViewPath
.count(PathSep
);
254 for (unsigned I
= 0, E
= NumSeps
; I
< E
; ++I
)
255 PathToStyle
+= ".." + PathSep
;
256 return PathToStyle
+ "style.css";
259 void emitPrelude(raw_ostream
&OS
, const CoverageViewOptions
&Opts
,
260 const std::string
&PathToStyle
= "") {
261 OS
<< "<!doctype html>"
265 // Link to a stylesheet if one is available. Otherwise, use the default style.
266 if (PathToStyle
.empty())
267 OS
<< "<style>" << CSSForCoverage
<< "</style>";
269 OS
<< "<link rel='stylesheet' type='text/css' href='"
270 << escape(PathToStyle
, Opts
) << "'>";
272 OS
<< EndHeader
<< "<body>";
275 void emitEpilog(raw_ostream
&OS
) {
280 } // anonymous namespace
282 Expected
<CoveragePrinter::OwnedStream
>
283 CoveragePrinterHTML::createViewFile(StringRef Path
, bool InToplevel
) {
284 auto OSOrErr
= createOutputStream(Path
, "html", InToplevel
);
288 OwnedStream OS
= std::move(OSOrErr
.get());
290 if (!Opts
.hasOutputDirectory()) {
291 emitPrelude(*OS
.get(), Opts
);
293 std::string ViewPath
= getOutputPath(Path
, "html", InToplevel
);
294 emitPrelude(*OS
.get(), Opts
, getPathToStyle(ViewPath
));
297 return std::move(OS
);
300 void CoveragePrinterHTML::closeViewFile(OwnedStream OS
) {
301 emitEpilog(*OS
.get());
304 /// Emit column labels for the table in the index.
305 static void emitColumnLabelsForIndex(raw_ostream
&OS
,
306 const CoverageViewOptions
&Opts
) {
307 SmallVector
<std::string
, 4> Columns
;
308 Columns
.emplace_back(tag("td", "Filename", "column-entry-bold"));
309 Columns
.emplace_back(tag("td", "Function Coverage", "column-entry-bold"));
310 if (Opts
.ShowInstantiationSummary
)
311 Columns
.emplace_back(
312 tag("td", "Instantiation Coverage", "column-entry-bold"));
313 Columns
.emplace_back(tag("td", "Line Coverage", "column-entry-bold"));
314 if (Opts
.ShowRegionSummary
)
315 Columns
.emplace_back(tag("td", "Region Coverage", "column-entry-bold"));
316 if (Opts
.ShowBranchSummary
)
317 Columns
.emplace_back(tag("td", "Branch Coverage", "column-entry-bold"));
318 OS
<< tag("tr", join(Columns
.begin(), Columns
.end(), ""));
322 CoveragePrinterHTML::buildLinkToFile(StringRef SF
,
323 const FileCoverageSummary
&FCS
) const {
324 SmallString
<128> LinkTextStr(sys::path::relative_path(FCS
.Name
));
325 sys::path::remove_dots(LinkTextStr
, /*remove_dot_dot=*/true);
326 sys::path::native(LinkTextStr
);
327 std::string LinkText
= escape(LinkTextStr
, Opts
);
328 std::string LinkTarget
=
329 escape(getOutputPath(SF
, "html", /*InToplevel=*/false), Opts
);
330 return a(LinkTarget
, LinkText
);
333 /// Render a file coverage summary (\p FCS) in a table row. If \p IsTotals is
334 /// false, link the summary to \p SF.
335 void CoveragePrinterHTML::emitFileSummary(raw_ostream
&OS
, StringRef SF
,
336 const FileCoverageSummary
&FCS
,
337 bool IsTotals
) const {
338 SmallVector
<std::string
, 8> Columns
;
340 // Format a coverage triple and add the result to the list of columns.
341 auto AddCoverageTripleToColumn
=
342 [&Columns
, this](unsigned Hit
, unsigned Total
, float Pctg
) {
345 raw_string_ostream RSO
{S
};
347 RSO
<< format("%*.2f", 7, Pctg
) << "% ";
350 RSO
<< '(' << Hit
<< '/' << Total
<< ')';
352 const char *CellClass
= "column-entry-yellow";
353 if (Pctg
>= Opts
.HighCovWatermark
)
354 CellClass
= "column-entry-green";
355 else if (Pctg
< Opts
.LowCovWatermark
)
356 CellClass
= "column-entry-red";
357 Columns
.emplace_back(tag("td", tag("pre", S
), CellClass
));
360 // Simplify the display file path, and wrap it in a link if requested.
361 std::string Filename
;
363 Filename
= std::string(SF
);
365 Filename
= buildLinkToFile(SF
, FCS
);
368 Columns
.emplace_back(tag("td", tag("pre", Filename
)));
369 AddCoverageTripleToColumn(FCS
.FunctionCoverage
.getExecuted(),
370 FCS
.FunctionCoverage
.getNumFunctions(),
371 FCS
.FunctionCoverage
.getPercentCovered());
372 if (Opts
.ShowInstantiationSummary
)
373 AddCoverageTripleToColumn(FCS
.InstantiationCoverage
.getExecuted(),
374 FCS
.InstantiationCoverage
.getNumFunctions(),
375 FCS
.InstantiationCoverage
.getPercentCovered());
376 AddCoverageTripleToColumn(FCS
.LineCoverage
.getCovered(),
377 FCS
.LineCoverage
.getNumLines(),
378 FCS
.LineCoverage
.getPercentCovered());
379 if (Opts
.ShowRegionSummary
)
380 AddCoverageTripleToColumn(FCS
.RegionCoverage
.getCovered(),
381 FCS
.RegionCoverage
.getNumRegions(),
382 FCS
.RegionCoverage
.getPercentCovered());
383 if (Opts
.ShowBranchSummary
)
384 AddCoverageTripleToColumn(FCS
.BranchCoverage
.getCovered(),
385 FCS
.BranchCoverage
.getNumBranches(),
386 FCS
.BranchCoverage
.getPercentCovered());
389 OS
<< tag("tr", join(Columns
.begin(), Columns
.end(), ""), "light-row-bold");
391 OS
<< tag("tr", join(Columns
.begin(), Columns
.end(), ""), "light-row");
394 Error
CoveragePrinterHTML::createIndexFile(
395 ArrayRef
<std::string
> SourceFiles
, const CoverageMapping
&Coverage
,
396 const CoverageFiltersMatchAll
&Filters
) {
397 // Emit the default stylesheet.
398 auto CSSOrErr
= createOutputStream("style", "css", /*InToplevel=*/true);
399 if (Error E
= CSSOrErr
.takeError())
402 OwnedStream CSS
= std::move(CSSOrErr
.get());
403 CSS
->operator<<(CSSForCoverage
);
405 // Emit a file index along with some coverage statistics.
406 auto OSOrErr
= createOutputStream("index", "html", /*InToplevel=*/true);
407 if (Error E
= OSOrErr
.takeError())
409 auto OS
= std::move(OSOrErr
.get());
410 raw_ostream
&OSRef
= *OS
.get();
412 assert(Opts
.hasOutputDirectory() && "No output directory for index file");
413 emitPrelude(OSRef
, Opts
, getPathToStyle(""));
415 // Emit some basic information about the coverage report.
416 if (Opts
.hasProjectTitle())
417 OSRef
<< tag(ProjectTitleTag
, escape(Opts
.ProjectTitle
, Opts
));
418 OSRef
<< tag(ReportTitleTag
, "Coverage Report");
419 if (Opts
.hasCreatedTime())
420 OSRef
<< tag(CreatedTimeTag
, escape(Opts
.CreatedTimeStr
, Opts
));
422 // Emit a link to some documentation.
423 OSRef
<< tag("p", "Click " +
424 a("http://clang.llvm.org/docs/"
425 "SourceBasedCodeCoverage.html#interpreting-reports",
427 " for information about interpreting this report.");
429 // Emit a table containing links to reports for each file in the covmapping.
430 // Exclude files which don't contain any regions.
431 OSRef
<< BeginCenteredDiv
<< BeginTable
;
432 emitColumnLabelsForIndex(OSRef
, Opts
);
433 FileCoverageSummary
Totals("TOTALS");
434 auto FileReports
= CoverageReport::prepareFileReports(
435 Coverage
, Totals
, SourceFiles
, Opts
, Filters
);
436 bool EmptyFiles
= false;
437 for (unsigned I
= 0, E
= FileReports
.size(); I
< E
; ++I
) {
438 if (FileReports
[I
].FunctionCoverage
.getNumFunctions())
439 emitFileSummary(OSRef
, SourceFiles
[I
], FileReports
[I
]);
443 emitFileSummary(OSRef
, "Totals", Totals
, /*IsTotals=*/true);
444 OSRef
<< EndTable
<< EndCenteredDiv
;
446 // Emit links to files which don't contain any functions. These are normally
447 // not very useful, but could be relevant for code which abuses the
449 if (EmptyFiles
&& Filters
.empty()) {
450 OSRef
<< tag("p", "Files which contain no functions. (These "
451 "files contain code pulled into other files "
452 "by the preprocessor.)\n");
453 OSRef
<< BeginCenteredDiv
<< BeginTable
;
454 for (unsigned I
= 0, E
= FileReports
.size(); I
< E
; ++I
)
455 if (!FileReports
[I
].FunctionCoverage
.getNumFunctions()) {
456 std::string Link
= buildLinkToFile(SourceFiles
[I
], FileReports
[I
]);
457 OSRef
<< tag("tr", tag("td", tag("pre", Link
)), "light-row") << '\n';
459 OSRef
<< EndTable
<< EndCenteredDiv
;
462 OSRef
<< tag("h5", escape(Opts
.getLLVMVersionString(), Opts
));
465 return Error::success();
468 void SourceCoverageViewHTML::renderViewHeader(raw_ostream
&OS
) {
469 OS
<< BeginCenteredDiv
<< BeginTable
;
472 void SourceCoverageViewHTML::renderViewFooter(raw_ostream
&OS
) {
473 OS
<< EndTable
<< EndCenteredDiv
;
476 void SourceCoverageViewHTML::renderSourceName(raw_ostream
&OS
, bool WholeFile
) {
477 OS
<< BeginSourceNameDiv
<< tag("pre", escape(getSourceName(), getOptions()))
481 void SourceCoverageViewHTML::renderLinePrefix(raw_ostream
&OS
, unsigned) {
485 void SourceCoverageViewHTML::renderLineSuffix(raw_ostream
&OS
, unsigned) {
486 // If this view has sub-views, renderLine() cannot close the view's cell.
487 // Take care of it here, after all sub-views have been rendered.
493 void SourceCoverageViewHTML::renderViewDivider(raw_ostream
&, unsigned) {
494 // The table-based output makes view dividers unnecessary.
497 void SourceCoverageViewHTML::renderLine(raw_ostream
&OS
, LineRef L
,
498 const LineCoverageStats
&LCS
,
499 unsigned ExpansionCol
, unsigned) {
500 StringRef Line
= L
.Line
;
501 unsigned LineNo
= L
.LineNo
;
503 // Steps for handling text-escaping, highlighting, and tooltip creation:
505 // 1. Split the line into N+1 snippets, where N = |Segments|. The first
506 // snippet starts from Col=1 and ends at the start of the first segment.
507 // The last snippet starts at the last mapped column in the line and ends
508 // at the end of the line. Both are required but may be empty.
510 SmallVector
<std::string
, 8> Snippets
;
511 CoverageSegmentArray Segments
= LCS
.getLineSegments();
514 auto Snip
= [&](unsigned Start
, unsigned Len
) {
515 Snippets
.push_back(std::string(Line
.substr(Start
, Len
)));
519 Snip(LCol
- 1, Segments
.empty() ? 0 : (Segments
.front()->Col
- 1));
521 for (unsigned I
= 1, E
= Segments
.size(); I
< E
; ++I
)
522 Snip(LCol
- 1, Segments
[I
]->Col
- LCol
);
524 // |Line| + 1 is needed to avoid underflow when, e.g |Line| = 0 and LCol = 1.
525 Snip(LCol
- 1, Line
.size() + 1 - LCol
);
527 // 2. Escape all of the snippets.
529 for (unsigned I
= 0, E
= Snippets
.size(); I
< E
; ++I
)
530 Snippets
[I
] = escape(Snippets
[I
], getOptions());
532 // 3. Use \p WrappedSegment to set the highlight for snippet 0. Use segment
533 // 1 to set the highlight for snippet 2, segment 2 to set the highlight for
534 // snippet 3, and so on.
536 std::optional
<StringRef
> Color
;
537 SmallVector
<std::pair
<unsigned, unsigned>, 2> HighlightedRanges
;
538 auto Highlight
= [&](const std::string
&Snippet
, unsigned LC
, unsigned RC
) {
539 if (getOptions().Debug
)
540 HighlightedRanges
.emplace_back(LC
, RC
);
541 return tag("span", Snippet
, std::string(*Color
));
544 auto CheckIfUncovered
= [&](const CoverageSegment
*S
) {
545 return S
&& (!S
->IsGapRegion
|| (Color
&& *Color
== "red")) &&
546 S
->HasCount
&& S
->Count
== 0;
549 if (CheckIfUncovered(LCS
.getWrappedSegment())) {
551 if (!Snippets
[0].empty())
552 Snippets
[0] = Highlight(Snippets
[0], 1, 1 + Snippets
[0].size());
555 for (unsigned I
= 0, E
= Segments
.size(); I
< E
; ++I
) {
556 const auto *CurSeg
= Segments
[I
];
557 if (CheckIfUncovered(CurSeg
))
559 else if (CurSeg
->Col
== ExpansionCol
)
562 Color
= std::nullopt
;
565 Snippets
[I
+ 1] = Highlight(Snippets
[I
+ 1], CurSeg
->Col
,
566 CurSeg
->Col
+ Snippets
[I
+ 1].size());
569 if (Color
&& Segments
.empty())
570 Snippets
.back() = Highlight(Snippets
.back(), 1, 1 + Snippets
.back().size());
572 if (getOptions().Debug
) {
573 for (const auto &Range
: HighlightedRanges
) {
574 errs() << "Highlighted line " << LineNo
<< ", " << Range
.first
<< " -> ";
575 if (Range
.second
== 0)
578 errs() << Range
.second
;
583 // 4. Snippets[1:N+1] correspond to \p Segments[0:N]: use these to generate
584 // sub-line region count tooltips if needed.
586 if (shouldRenderRegionMarkers(LCS
)) {
587 // Just consider the segments which start *and* end on this line.
588 for (unsigned I
= 0, E
= Segments
.size() - 1; I
< E
; ++I
) {
589 const auto *CurSeg
= Segments
[I
];
590 if (!CurSeg
->IsRegionEntry
)
592 if (CurSeg
->Count
== LCS
.getExecutionCount())
596 tag("div", Snippets
[I
+ 1] + tag("span", formatCount(CurSeg
->Count
),
600 if (getOptions().Debug
)
601 errs() << "Marker at " << CurSeg
->Line
<< ":" << CurSeg
->Col
<< " = "
602 << formatCount(CurSeg
->Count
) << "\n";
608 for (const auto &Snippet
: Snippets
)
612 // If there are no sub-views left to attach to this cell, end the cell.
613 // Otherwise, end it after the sub-views are rendered (renderLineSuffix()).
618 void SourceCoverageViewHTML::renderLineCoverageColumn(
619 raw_ostream
&OS
, const LineCoverageStats
&Line
) {
622 Count
= tag("pre", formatCount(Line
.getExecutionCount()));
623 std::string CoverageClass
=
624 (Line
.getExecutionCount() > 0) ? "covered-line" : "uncovered-line";
625 OS
<< tag("td", Count
, CoverageClass
);
628 void SourceCoverageViewHTML::renderLineNumberColumn(raw_ostream
&OS
,
630 std::string LineNoStr
= utostr(uint64_t(LineNo
));
631 std::string TargetName
= "L" + LineNoStr
;
632 OS
<< tag("td", a("#" + TargetName
, tag("pre", LineNoStr
), TargetName
),
636 void SourceCoverageViewHTML::renderRegionMarkers(raw_ostream
&,
637 const LineCoverageStats
&Line
,
639 // Region markers are rendered in-line using tooltips.
642 void SourceCoverageViewHTML::renderExpansionSite(raw_ostream
&OS
, LineRef L
,
643 const LineCoverageStats
&LCS
,
644 unsigned ExpansionCol
,
645 unsigned ViewDepth
) {
646 // Render the line containing the expansion site. No extra formatting needed.
647 renderLine(OS
, L
, LCS
, ExpansionCol
, ViewDepth
);
650 void SourceCoverageViewHTML::renderExpansionView(raw_ostream
&OS
,
652 unsigned ViewDepth
) {
653 OS
<< BeginExpansionDiv
;
654 ESV
.View
->print(OS
, /*WholeFile=*/false, /*ShowSourceName=*/false,
655 /*ShowTitle=*/false, ViewDepth
+ 1);
656 OS
<< EndExpansionDiv
;
659 void SourceCoverageViewHTML::renderBranchView(raw_ostream
&OS
, BranchView
&BRV
,
660 unsigned ViewDepth
) {
661 // Render the child subview.
662 if (getOptions().Debug
)
663 errs() << "Branch at line " << BRV
.getLine() << '\n';
665 OS
<< BeginExpansionDiv
;
667 for (const auto &R
: BRV
.Regions
) {
668 // Calculate TruePercent and False Percent.
669 double TruePercent
= 0.0;
670 double FalsePercent
= 0.0;
671 unsigned Total
= R
.ExecutionCount
+ R
.FalseExecutionCount
;
673 if (!getOptions().ShowBranchCounts
&& Total
!= 0) {
674 TruePercent
= ((double)(R
.ExecutionCount
) / (double)Total
) * 100.0;
675 FalsePercent
= ((double)(R
.FalseExecutionCount
) / (double)Total
) * 100.0;
678 // Display Line + Column.
679 std::string LineNoStr
= utostr(uint64_t(R
.LineStart
));
680 std::string ColNoStr
= utostr(uint64_t(R
.ColumnStart
));
681 std::string TargetName
= "L" + LineNoStr
;
685 a("#" + TargetName
, tag("span", LineNoStr
+ ":" + ColNoStr
),
691 OS
<< "Folded - Ignored]\n";
695 // Display TrueCount or TruePercent.
696 std::string TrueColor
= R
.ExecutionCount
? "None" : "red";
697 std::string TrueCovClass
=
698 (R
.ExecutionCount
> 0) ? "covered-line" : "uncovered-line";
700 OS
<< tag("span", "True", TrueColor
);
702 if (getOptions().ShowBranchCounts
)
703 OS
<< tag("span", formatCount(R
.ExecutionCount
), TrueCovClass
) << ", ";
705 OS
<< format("%0.2f", TruePercent
) << "%, ";
707 // Display FalseCount or FalsePercent.
708 std::string FalseColor
= R
.FalseExecutionCount
? "None" : "red";
709 std::string FalseCovClass
=
710 (R
.FalseExecutionCount
> 0) ? "covered-line" : "uncovered-line";
712 OS
<< tag("span", "False", FalseColor
);
714 if (getOptions().ShowBranchCounts
)
715 OS
<< tag("span", formatCount(R
.FalseExecutionCount
), FalseCovClass
);
717 OS
<< format("%0.2f", FalsePercent
) << "%";
722 OS
<< EndExpansionDiv
;
725 void SourceCoverageViewHTML::renderInstantiationView(raw_ostream
&OS
,
726 InstantiationView
&ISV
,
727 unsigned ViewDepth
) {
728 OS
<< BeginExpansionDiv
;
730 OS
<< BeginSourceNameDiv
732 escape("Unexecuted instantiation: " + ISV
.FunctionName
.str(),
736 ISV
.View
->print(OS
, /*WholeFile=*/false, /*ShowSourceName=*/true,
737 /*ShowTitle=*/false, ViewDepth
);
738 OS
<< EndExpansionDiv
;
741 void SourceCoverageViewHTML::renderTitle(raw_ostream
&OS
, StringRef Title
) {
742 if (getOptions().hasProjectTitle())
743 OS
<< tag(ProjectTitleTag
, escape(getOptions().ProjectTitle
, getOptions()));
744 OS
<< tag(ReportTitleTag
, escape(Title
, getOptions()));
745 if (getOptions().hasCreatedTime())
746 OS
<< tag(CreatedTimeTag
,
747 escape(getOptions().CreatedTimeStr
, getOptions()));
750 void SourceCoverageViewHTML::renderTableHeader(raw_ostream
&OS
,
751 unsigned FirstUncoveredLineNo
,
752 unsigned ViewDepth
) {
753 std::string SourceLabel
;
754 if (FirstUncoveredLineNo
== 0) {
755 SourceLabel
= tag("td", tag("pre", "Source"));
757 std::string LinkTarget
= "#L" + utostr(uint64_t(FirstUncoveredLineNo
));
759 tag("td", tag("pre", "Source (" +
760 a(LinkTarget
, "jump to first uncovered line") +
764 renderLinePrefix(OS
, ViewDepth
);
765 OS
<< tag("td", tag("pre", "Line")) << tag("td", tag("pre", "Count"))
767 renderLineSuffix(OS
, ViewDepth
);