This is an archive of the discontinued LLVM Phabricator instance.

[llvm-cov] Create HTML directory structure when filtering using -name*= options
ClosedPublic

Authored by seaneveson on Sep 26 2017, 8:24 AM.

Details

Summary

Before this change using any of the -name*= command line options with an output directory would result in a single file (functions.txt/functions.html) containing the coverage for those specific functions.

After this change you get the same directory structure you get when not using any -name*= options.

Diff Detail

Repository
rL LLVM

Event Timeline

seaneveson created this revision.Sep 26 2017, 8:24 AM
vsk edited edge metadata.Sep 26 2017, 4:15 PM

Thanks. Could you update the textual coverage logic as well and re-upload the diff with context lines (e.g git diff -U10000)?

Also, it would help if you could split out the NFC const-correcting changes (feel free to commit these right away).

tools/llvm-cov/CodeCoverage.cpp
859 ↗(On Diff #116669)

The key type can be StringRef. Filenames are owned by FunctionRecord, which are in turn owned by the CoverageMapping.

862 ↗(On Diff #116669)

This isn't quite right because it means that the same function can be rendered more than once. I think you can loop over SourceFiles and use getCoveredFunctions(SourceFileName) instead.

863 ↗(On Diff #116669)

Stylistic nit: you can use llvm::find(SourceFiles, File)

seaneveson edited the summary of this revision. (Show Details)
  • Make the changes to text as well as HTML
  • Address review comments
  • Upload the right diff ...
vsk accepted this revision.Sep 27 2017, 8:03 AM

LGTM with two changes. Thanks!

tools/llvm-cov/CodeCoverage.cpp
874 ↗(On Diff #116808)

Could you write this as 'FilenameFunctionMap[SourceFile].push_back(&Function)'? It's a bit clearer to me.

881 ↗(On Diff #116808)

Just StringRef

This revision is now accepted and ready to land.Sep 27 2017, 8:03 AM
This revision was automatically updated to reflect the committed changes.