[PATCH] D46478: [Coverage] Do not skip functions with the same name when loading CoverageMapping.

Max Moroz via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 7 15:22:57 PDT 2018


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

Added an example of test that would fail without the change and pass with it.


Repository:
  rL LLVM

https://reviews.llvm.org/D46478

Files:
  lib/ProfileData/Coverage/CoverageMapping.cpp
  test/tools/llvm-cov/multiple-objects.test


Index: test/tools/llvm-cov/multiple-objects.test
===================================================================
--- test/tools/llvm-cov/multiple-objects.test
+++ test/tools/llvm-cov/multiple-objects.test
@@ -6,6 +6,11 @@
 REPORT-NEXT: ---
 REPORT-NEXT: header.h{{ +}}25{{ +}}14{{ +}}44.00%
 
+# Make sure that both use_1.cc and use_2.cc have coverage reported.
+# Before https://reviews.llvm.org/D46478, only on of them used to be reported.
+REPORT-NEXT: use_1.cc{{ +}}1{{ +}}0{{ +}}100.00%
+REPORT-NEXT: use_2.cc{{ +}}2{{ +}}0{{ +}}100.00%
+
 Instructions for regenerating the test:
 
 clang -std=c++11 -mllvm -enable-name-compression=false -fprofile-instr-generate -fcoverage-mapping use_1.cc -o use_1
Index: lib/ProfileData/Coverage/CoverageMapping.cpp
===================================================================
--- lib/ProfileData/Coverage/CoverageMapping.cpp
+++ lib/ProfileData/Coverage/CoverageMapping.cpp
@@ -207,10 +207,6 @@
   else
     OrigFuncName = getFuncNameWithoutPrefix(OrigFuncName, Record.Filenames[0]);
 
-  // Don't load records for functions we've already seen.
-  if (!FunctionNames.insert(OrigFuncName).second)
-    return Error::success();
-
   CounterMappingContext Ctx(Record.Expressions);
 
   std::vector<uint64_t> Counts;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46478.145566.patch
Type: text/x-patch
Size: 1266 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180507/33995666/attachment.bin>


More information about the llvm-commits mailing list