[PATCH] D63571: [llvm-cov[ Fix lcov coverage report contains functions from other compilation units.

Max Moroz via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 28 08:39:51 PDT 2019


Dor1s updated this revision to Diff 207072.
Dor1s added a comment.

Getting ready to commit.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63571/new/

https://reviews.llvm.org/D63571

Files:
  test/tools/llvm-cov/multiple-files.test
  tools/llvm-cov/CoverageExporterLcov.cpp


Index: tools/llvm-cov/CoverageExporterLcov.cpp
===================================================================
--- tools/llvm-cov/CoverageExporterLcov.cpp
+++ tools/llvm-cov/CoverageExporterLcov.cpp
@@ -82,7 +82,7 @@
   OS << "SF:" << Filename << '\n';
 
   if (!ExportSummaryOnly) {
-    renderFunctions(OS, Coverage.getCoveredFunctions());
+    renderFunctions(OS, Coverage.getCoveredFunctions(Filename));
   }
   renderFunctionSummary(OS, FileReport);
 
Index: test/tools/llvm-cov/multiple-files.test
===================================================================
--- test/tools/llvm-cov/multiple-files.test
+++ test/tools/llvm-cov/multiple-files.test
@@ -1,6 +1,7 @@
 // RUN: llvm-profdata merge %S/Inputs/multiple-files.proftext -o %t.profdata
 // RUN: llvm-cov report %S/Inputs/multiple-files.covmapping -instr-profile %t.profdata | FileCheck %s -check-prefix=MANY_COMPONENTS
 // RUN: llvm-cov report %S/Inputs/multiple-files2.covmapping -instr-profile %t.profdata | FileCheck %s -check-prefix=ONE_COMPONENT
+// RUN: llvm-cov export %S/Inputs/multiple-files.covmapping -instr-profile %t.profdata -format=lcov | FileCheck %s -check-prefix=LCOV
 
 // MANY_COMPONENTS: Filename
 // MANY_COMPONENTS-NEXT: ---
@@ -13,3 +14,14 @@
 // ONE_COMPONENT-NEXT: ---
 // ONE_COMPONENT-NEXT: {{^}}cov.c
 // ONE_COMPONENT-NEXT: {{^}}cov.h
+
+// LCOV-LABEL: SF:{{.*}}a{{[/\\]}}f2.c
+// LCOV: FN:1,f2
+// No extra funcs
+// LCOV-NOT: FN:
+// LCOV-LABEL: SF:{{.*}}b{{[/\\]}}c{{[/\\]}}f4.c
+// LCOV: FN:1,f4
+// LCOV-LABEL: SF:{{.*}}b{{[/\\]}}f3.c
+// LCOV: FN:1,f3
+// LCOV-LABEL: SF:{{.*}}f1.c
+// LCOV: FN:1,f1


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63571.207072.patch
Type: text/x-patch
Size: 1608 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190628/0228e19f/attachment.bin>


More information about the llvm-commits mailing list