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: LCOV LLVM Report. 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.
This looks like an unrelated change.