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