This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug gcov-profile/87442] Add options to filter files we want to instrument for code coverage
- From: "marxin at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 08 Nov 2018 13:43:43 +0000
- Subject: [Bug gcov-profile/87442] Add options to filter files we want to instrument for code coverage
- Auto-submitted: auto-generated
- References: <bug-87442-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87442
--- Comment #10 from Martin Liška <marxin at gcc dot gnu.org> ---
>
> Few things:
> i) I use ';' as regex separator (to avoid issues under windows with C:\...)
> ii) if exclude is empty and filename is matching any of the regexes in
> filter then instrument it.
> iii) if filter is empty and filename is not matching any of the regexes in
> exclude then instrument it.
> iv) if both are not empty and filename is matching any of the regexes in
> filter AND is not matching any of the regexes in exclude then instrument it.
>
> Few examples:
> i) exclude="^/usr/include/;^/usr/local/include/" => a file is instrumented
> if and only if it isn't in /usr/include/ nor in /usr/local/include/
> ii) filter="^/home/foo/dev/.*\.cpp;^/home/foo/ved/.*\.cpp" => a file is
> instrumented if and only if it's a cpp file somewhere under /home/foo/dev/
> or /home/foo/ved/
> iii) exclude="^/usr/include/.*$" and filter="^/usr/.*$" => a file is
> instrumented if and only if it's somewhere under /usr/ but not under
> /usr/include
>
> My patch for llvm is here:
> https://reviews.llvm.org/D52033
>
> If you see something wrong or have idea to improve, please ping me.
Looks good to me, I've just sent patch candidate:
https://gcc.gnu.org/ml/gcc-patches/2018-11/msg00568.html