]> granicus.if.org Git - llvm/commitdiff
[llvm-cov] Demangle names for hidden instantiation views
authorVedant Kumar <vsk@apple.com>
Tue, 20 Sep 2016 21:27:48 +0000 (21:27 +0000)
committerVedant Kumar <vsk@apple.com>
Tue, 20 Sep 2016 21:27:48 +0000 (21:27 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282020 91177308-0d34-0410-b5e6-96231b3b80d8

test/tools/llvm-cov/demangle.test
tools/llvm-cov/CodeCoverage.cpp

index f9a0f9183ebfff1093efcb4784d8512fbe545eda..90a26b734067240a9ad8d64f293ec2ff7fe3e6f9 100644 (file)
@@ -1,4 +1,8 @@
-// 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
+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
 
-// CHECK-DAG: XZ4funcIbEiTX
-// CHECK-DAG: XZ4funcIiEiTX
+// Check that we demangle names even if the sub-view will be hidden.
+RUN: llvm-profdata merge %S/Inputs/hideUnexecutedSubviews.proftext -o %t.profdata
+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
+
+CHECK-DAG: XZ4funcIbEiTX
+CHECK-DAG: XZ4funcIiEiTX
index 9eacbcad5ce889e6b1b5a67cd72bbaca63b9e839..8c9da116b968754dc99802c1b362f9326648cc17 100644 (file)
@@ -236,12 +236,13 @@ CodeCoverageTool::createSourceFileView(StringRef SourceFile,
   for (const auto *Function : Coverage.getInstantiations(SourceFile)) {
     std::unique_ptr<SourceCoverageView> SubView{nullptr};
 
+    StringRef Funcname = getSymbolForHumans(Function->Name);
+
     if (Function->ExecutionCount > 0) {
       auto SubViewCoverage = Coverage.getCoverageForFunction(*Function);
       auto SubViewExpansions = SubViewCoverage.getExpansions();
       SubView = SourceCoverageView::create(
-          getSymbolForHumans(Function->Name), SourceBuffer.get(), ViewOpts,
-          std::move(SubViewCoverage));
+          Funcname, SourceBuffer.get(), ViewOpts, std::move(SubViewCoverage));
       attachExpansionSubViews(*SubView, SubViewExpansions, Coverage);
     }
 
@@ -250,7 +251,7 @@ CodeCoverageTool::createSourceFileView(StringRef SourceFile,
     for (const auto &CR : Function->CountedRegions)
       if (CR.FileID == FileID)
         Line = std::max(CR.LineEnd, Line);
-    View->addInstantiation(Function->Name, Line, std::move(SubView));
+    View->addInstantiation(Funcname, Line, std::move(SubView));
   }
   return View;
 }