diff options
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 a7f2f8145e87..5c28517bebb0 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 ----------------------------- |