https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87442
Bug ID: 87442 Summary: Add options to filter files we want to instrument for code coverage Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: gcov-profile Assignee: unassigned at gcc dot gnu.org Reporter: cdenizet at mozilla dot com CC: marxin at gcc dot gnu.org Target Milestone: --- The idea is to add two options to easily include/exclude some files from being instrumented. Here are two use cases: 1) -coverage-exclude=/usr/include/*: typically we remove the data for such files when post-processing the gcno/gcda so we don't need to instrument them and so we could reduce the overhead due to instrumentation. 2) -coverage-filter=.*/foo.cpp:.*/bar.cpp: here we want to only instrument these two files (for example, to display code coverage data for files appearing in a patch at review phase) These options could take regular expressions separated by colon to give more flexibility in the choice of the files. When the user is using both options only the files which match a regex in filter and don't match all of the regex in exclude are instrumented. I already proposed such a feature for clang: https://reviews.llvm.org/D52033 https://reviews.llvm.org/D52034 It would be nice to have the same feature for gcc (if it doesn't exist off course) with the same option names. What do you think ?