[llvm-bugs] [Bug 31980] llvm-cov show -format html: index says 0/0 lines covered for a source file with some non-0 line counts

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Feb 23 18:26:00 PST 2017


http://bugs.llvm.org/show_bug.cgi?id=31980

Vedant Kumar <vsk at apple.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |WONTFIX
             Status|NEW                         |RESOLVED
                 CC|                            |vsk at apple.com

--- Comment #1 from Vedant Kumar <vsk at apple.com> ---
llvm-cov attributes the coverage for each function to a single file. We'd need
to break this policy to report additional coverage for cov.h, resulting in
double-counting in the coverage totals.

If you don't mind the double-counting, here's a patch you can use to see
additional statistics for cov.h:

diff --git a/lib/ProfileData/Coverage/CoverageMapping.cpp
b/lib/ProfileData/Coverage/CoverageMapping.cpp
index 6d907c7098e..d28b8b153a3 100644
--- a/lib/ProfileData/Coverage/CoverageMapping.cpp
+++ b/lib/ProfileData/Coverage/CoverageMapping.cpp
@@ -176,8 +176,13 @@ Expected<int64_t> CounterMappingContext::evaluate(const
Counter &C) const {
 }

 void FunctionRecordIterator::skipOtherFiles() {
+  auto ContainsFilename = [this](const FunctionRecord &FR) {
+    return std::find(FR.Filenames.begin(), FR.Filenames.end(), Filename) !=
+           FR.Filenames.end();
+  };
+
   while (Current != Records.end() && !Filename.empty() &&
-         Filename != Current->Filenames[0])
+         !ContainsFilename(*Current))
     ++Current;
   if (Current == Records.end())
     *this = FunctionRecordIterator();

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170224/4abfc6e8/attachment-0001.html>


More information about the llvm-bugs mailing list