Skip to content
This repository was archived by the owner on Nov 1, 2021. It is now read-only.

Commit 1390807

Browse files
committed
[llvm-cov] Demangle names for hidden instantiation views
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282020 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 163ac62 commit 1390807

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

test/tools/llvm-cov/demangle.test

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
// RUN: llvm-cov show %S/Inputs/templateInstantiations.covmapping -instr-profile %S/Inputs/templateInstantiations.profdata -Xdemangler sed -Xdemangler 's/_/X/g' -filename-equivalence %S/showTemplateInstantiations.cpp | FileCheck %s
1+
RUN: llvm-cov show %S/Inputs/templateInstantiations.covmapping -instr-profile %S/Inputs/templateInstantiations.profdata -Xdemangler sed -Xdemangler 's/_/X/g' -filename-equivalence %S/showTemplateInstantiations.cpp | FileCheck %s
22

3-
// CHECK-DAG: XZ4funcIbEiTX
4-
// CHECK-DAG: XZ4funcIiEiTX
3+
// Check that we demangle names even if the sub-view will be hidden.
4+
RUN: llvm-profdata merge %S/Inputs/hideUnexecutedSubviews.proftext -o %t.profdata
5+
RUN: llvm-cov show %S/Inputs/templateInstantiations.covmapping -instr-profile %t.profdata -Xdemangler sed -Xdemangler 's/_/X/g' -filename-equivalence %S/showTemplateInstantiations.cpp | FileCheck %s
6+
7+
CHECK-DAG: XZ4funcIbEiTX
8+
CHECK-DAG: XZ4funcIiEiTX

tools/llvm-cov/CodeCoverage.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,12 +236,13 @@ CodeCoverageTool::createSourceFileView(StringRef SourceFile,
236236
for (const auto *Function : Coverage.getInstantiations(SourceFile)) {
237237
std::unique_ptr<SourceCoverageView> SubView{nullptr};
238238

239+
StringRef Funcname = getSymbolForHumans(Function->Name);
240+
239241
if (Function->ExecutionCount > 0) {
240242
auto SubViewCoverage = Coverage.getCoverageForFunction(*Function);
241243
auto SubViewExpansions = SubViewCoverage.getExpansions();
242244
SubView = SourceCoverageView::create(
243-
getSymbolForHumans(Function->Name), SourceBuffer.get(), ViewOpts,
244-
std::move(SubViewCoverage));
245+
Funcname, SourceBuffer.get(), ViewOpts, std::move(SubViewCoverage));
245246
attachExpansionSubViews(*SubView, SubViewExpansions, Coverage);
246247
}
247248

@@ -250,7 +251,7 @@ CodeCoverageTool::createSourceFileView(StringRef SourceFile,
250251
for (const auto &CR : Function->CountedRegions)
251252
if (CR.FileID == FileID)
252253
Line = std::max(CR.LineEnd, Line);
253-
View->addInstantiation(Function->Name, Line, std::move(SubView));
254+
View->addInstantiation(Funcname, Line, std::move(SubView));
254255
}
255256
return View;
256257
}

0 commit comments

Comments
 (0)