Skip to content

Commit 95b6a7f

Browse files
authored
Backport 0bf4f82 to release/18.x (#82571)
Manually cherry-pick 0bf4f82 (#80952) and resolve conflicts Closes #82570
1 parent c65d48d commit 95b6a7f

File tree

5 files changed

+10
-8
lines changed

5 files changed

+10
-8
lines changed

llvm/test/tools/llvm-cov/mcdc-general-none.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
// Test html output.
5353
// RUN: llvm-cov show --show-mcdc-summary --show-mcdc %S/Inputs/mcdc-general.o -instr-profile %t.profdata -path-equivalence=/tmp,%S/Inputs %S/Inputs/mcdc-general.cpp -format html -o %t.html.dir
5454
// RUN: FileCheck -check-prefix=HTML -input-file=%t.html.dir/coverage/tmp/mcdc-general.cpp.html %s
55-
// HTML-COUNT-4: MC/DC Decision Region (<span class='line-number'><a name='L{{[0-9]+}}' href='#L{{[0-9]+}}'><span>
55+
// HTML-COUNT-4: MC/DC Decision Region (<span class='line-number'><a href='#L{{[0-9]+}}'><span>
5656

5757
// RUN: FileCheck -check-prefix HTML-INDEX -input-file %t.html.dir/index.html %s
5858
// HTML-INDEX-LABEL: <table>

llvm/test/tools/llvm-cov/mcdc-general.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@
118118
// Test html output.
119119
// RUN: llvm-cov show --show-mcdc-summary --show-mcdc %S/Inputs/mcdc-general.o -instr-profile %t.profdata -path-equivalence=/tmp,%S/Inputs %S/Inputs/mcdc-general.cpp -format html -o %t.html.dir
120120
// RUN: FileCheck -check-prefix=HTML -input-file=%t.html.dir/coverage/tmp/mcdc-general.cpp.html %s
121-
// HTML-COUNT-4: MC/DC Decision Region (<span class='line-number'><a name='L{{[0-9]+}}' href='#L{{[0-9]+}}'><span>
121+
// HTML-COUNT-4: MC/DC Decision Region (<span class='line-number'><a href='#L{{[0-9]+}}'><span>
122122

123123
// RUN: FileCheck -check-prefix HTML-INDEX -input-file %t.html.dir/index.html %s
124124
// HTML-INDEX-LABEL: <table>

llvm/tools/llvm-cov/SourceCoverageView.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ bool SourceCoverageView::shouldRenderRegionMarkers(
139139

140140
bool SourceCoverageView::hasSubViews() const {
141141
return !ExpansionSubViews.empty() || !InstantiationSubViews.empty() ||
142-
!BranchSubViews.empty();
142+
!BranchSubViews.empty() || !MCDCSubViews.empty();
143143
}
144144

145145
std::unique_ptr<SourceCoverageView>

llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,9 @@ tr:hover {
246246
tr:last-child {
247247
border-bottom: none;
248248
}
249+
tr:has(> td >a:target) > td.code > pre {
250+
background-color: #ffa;
251+
}
249252
)";
250253

251254
const char *EndHeader = "</head>";
@@ -990,15 +993,13 @@ void SourceCoverageViewHTML::renderMCDCView(raw_ostream &OS, MCDCView &MRV,
990993
std::string ColNoStr = Twine(DecisionRegion.ColumnStart).str();
991994
std::string TargetName = "L" + LineNoStr;
992995
OS << tag("span",
993-
a("#" + TargetName, tag("span", LineNoStr + ":" + ColNoStr),
994-
TargetName),
996+
a("#" + TargetName, tag("span", LineNoStr + ":" + ColNoStr)),
995997
"line-number") +
996998
") to (";
997999
LineNoStr = utostr(uint64_t(DecisionRegion.LineEnd));
9981000
ColNoStr = utostr(uint64_t(DecisionRegion.ColumnEnd));
9991001
OS << tag("span",
1000-
a("#" + TargetName, tag("span", LineNoStr + ":" + ColNoStr),
1001-
TargetName),
1002+
a("#" + TargetName, tag("span", LineNoStr + ":" + ColNoStr)),
10021003
"line-number") +
10031004
")\n\n";
10041005

llvm/tools/llvm-cov/SourceCoverageViewText.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,8 @@ void SourceCoverageViewText::renderMCDCView(raw_ostream &OS, MCDCView &MRV,
382382
colored_ostream(OS, raw_ostream::RED,
383383
getOptions().Colors && Record.getPercentCovered() < 100.0,
384384
/*Bold=*/false, /*BG=*/true)
385-
<< format("%0.2f", Record.getPercentCovered()) << "%\n";
385+
<< format("%0.2f", Record.getPercentCovered()) << "%";
386+
OS << "\n";
386387
renderLinePrefix(OS, ViewDepth);
387388
OS << "\n";
388389
}

0 commit comments

Comments
 (0)