[PATCH] D130745: [llvm-cov][WIP] Add Per Directory coverage to llvm-cov

Ashutosh Pandey via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 28 23:07:27 PDT 2022


ashpande created this revision.
ashpande added reviewers: phosek, gulfem.
Herald added a project: All.
ashpande requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

**Per Directory Coverage:** by default, llvm-cov reports are generated on a per file basis. While this works for small applications with few executable files, it can become cumbersome for very large projects, such as LLVM itself. The resulting HTML file can be large, and it can be hard to find any file. Moreover, directory structure is not preserved, so it can be difficult to know the coverage of one particular directory in a large report (unless you build it selectively beforehand).

The gcov code coverage frontend lcov defaults to a per directory structure. An example is here. We would like to go one step further and default the report to output a report which preserves directory structure. For example, if a user builds LLVM with code coverage, the resulting report should replicate the llvm-monorepo. The user should be able to click on the directory and see the coverage for all the subdirectories, and so on until they can see the source files and their coverage info.

**Implementation Details:**
The function buildCoverageTree takes a vector of source files and builds the tree from it. 
This is called by createIndexFile when llvm-cov is run.
CreateIndexFile calls itself recursively for every node in the tree that is not a leaf node.

Note: This is a very rough draft. I have to get the HTML generation working. Will clean this up and send more updates over the next couple of days.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D130745

Files:
  llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp
  llvm/tools/llvm-cov/SourceCoverageViewHTML.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D130745.448518.patch
Type: text/x-patch
Size: 7978 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220729/8729a1ae/attachment.bin>


More information about the llvm-commits mailing list