Page MenuHomePhabricator

[llvm-cov] Read in function names for filtering from a text file.
ClosedPublic

Authored by seaneveson on Aug 24 2017, 7:59 AM.

Details

Summary

Add a -name-whitelist option, which behaves in the same way as -name, but it reads in multiple function names from the given input file(s).

Event Timeline

seaneveson created this revision.Aug 24 2017, 7:59 AM
vsk added inline comments.Aug 24 2017, 10:28 AM
test/tools/llvm-cov/Inputs/name_whitelist.cpp
19

Just a reminder: please make sure that name_whitelist.covmapping is derived from an object built with -mllvm -enable-name-compression=false. I've been bitten by that before :) (not all the bots have zlib installed).

tools/llvm-cov/CodeCoverage.cpp
656

In the future, we might benefit from the flexibility offered by llvm::SpecialCaseList. Could you use that to parse the whitelist?

seaneveson marked an inline comment as done.Aug 25 2017, 2:53 AM
seaneveson added inline comments.
tools/llvm-cov/CodeCoverage.cpp
656

Thanks for the review!

Having to specify a section for each item seems redundant for an option that only filters on function names, e.g.

fun:foo
fun:bar

Are you considering having a more general -whitelist rather than a -name-whitelist? Otherwise I'm not sure what other sections there would be. The wildcard handling would be useful though.

vsk added inline comments.Aug 25 2017, 10:39 AM
tools/llvm-cov/CodeCoverage.cpp
656

I agree that it's a little redundant, but think that it shouldn't be too onerous. E.g the section names can be added in by a quick shell one-liner. The potential benefit is that you can have one file for {white, black}listing {functions, files, directories}. To that end, I suggest using more specific section names like "whitelist_fun:".

vsk edited edge metadata.Aug 25 2017, 10:39 AM

Change to use SpecialCaseList and add documentation of new option.

vsk accepted this revision.Aug 30 2017, 10:35 AM

Thanks!

tools/llvm-cov/CoverageFilters.h
64

nitpick: Can this method be marked const?

This revision is now accepted and ready to land.Aug 30 2017, 10:35 AM
seaneveson closed this revision.Aug 31 2017, 2:12 AM