diff options
author | Calixte Denizet <cdenizet@mozilla.com> | 2018-11-17 19:41:39 +0000 |
---|---|---|
committer | Calixte Denizet <cdenizet@mozilla.com> | 2018-11-17 19:41:39 +0000 |
commit | f4bf671af75854f2459ad6ac2b0551efb6811b88 (patch) | |
tree | 5a218978a666099774c1274b2fa33ad41209b2df /clang/docs | |
parent | 0438d791fada47ebce3f9af78955ff1ac0bff081 (diff) |
[Clang] Add options -fprofile-filter-files and -fprofile-exclude-files to filter the files to instrument with gcov (after revert https://reviews.llvm.org/rL346659)
Summary:
the previous patch (https://reviews.llvm.org/rC346642) has been reverted because of test failure under windows.
So this patch fix the test cfe/trunk/test/CodeGen/code-coverage-filter.c.
Reviewers: marco-c
Reviewed By: marco-c
Subscribers: cfe-commits, sylvestre.ledru
Differential Revision: https://reviews.llvm.org/D54600
llvm-svn: 347144
Diffstat (limited to 'clang/docs')
-rw-r--r-- | clang/docs/ReleaseNotes.rst | 6 | ||||
-rw-r--r-- | clang/docs/UsersManual.rst | 49 |
2 files changed, 55 insertions, 0 deletions
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 09f656815d43..72b043f28d03 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -64,6 +64,12 @@ Non-comprehensive list of changes in this release New Compiler Flags ------------------ +- ``-fprofile-filter-files=[regexes]`` and ``-fprofile-exclude-files=[regexes]``. + + Clang has now options to filter or exclude some files when + instrumenting for gcov-based profiling. + See the :doc:`UsersManual` for details. + - ... Deprecated Compiler Flags diff --git a/clang/docs/UsersManual.rst b/clang/docs/UsersManual.rst index 9317815efca6..b24cedc5bf74 100644 --- a/clang/docs/UsersManual.rst +++ b/clang/docs/UsersManual.rst @@ -1871,6 +1871,55 @@ using the ``llvm-cxxmap`` and ``llvm-profdata merge`` tools. following the Itanium C++ ABI mangling scheme. This covers all C++ targets supported by Clang other than Windows. +GCOV-based Profiling +-------------------- + +GCOV is a test coverage program, it helps to know how often a line of code +is executed. When instrumenting the code with ``--coverage`` option, some +counters are added for each edge linking basic blocks. + +At compile time, gcno files are generated containing information about +blocks and edges between them. At runtime the counters are incremented and at +exit the counters are dumped in gcda files. + +The tool ``llvm-cov gcov`` will parse gcno, gcda and source files to generate +a report ``.c.gcov``. + +.. option:: -fprofile-filter-files=[regexes] + + Define a list of regexes separated by a semi-colon. + If a file name matches any of the regexes then the file is instrumented. + + .. code-block:: console + + $ clang --coverage -fprofile-filter-files=".*\.c$" foo.c + + For example, this will only instrument files finishing with ``.c``, skipping ``.h`` files. + +.. option:: -fprofile-exclude-files=[regexes] + + Define a list of regexes separated by a semi-colon. + If a file name doesn't match all the regexes then the file is instrumented. + + .. code-block:: console + + $ clang --coverage -fprofile-exclude-files="^/usr/include/.*$" foo.c + + For example, this will instrument all the files except the ones in ``/usr/include``. + +If both options are used then a file is instrumented if its name matches any +of the regexes from ``-fprofile-filter-list`` and doesn't match all the regexes +from ``-fprofile-exclude-list``. + +.. code-block:: console + + $ clang --coverage -fprofile-exclude-files="^/usr/include/.*$" \ + -fprofile-filter-files="^/usr/.*$" + +In that case ``/usr/foo/oof.h`` is instrumented since it matches the filter regex and +doesn't match the exclude regex, but ``/usr/include/foo.h`` doesn't since it matches +the exclude regex. + Controlling Debug Information ----------------------------- |