| Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 1 | llvm-cov - emit coverage information | 
|  | 2 | ==================================== | 
|  | 3 |  | 
| James Henderson | a056684 | 2019-06-27 13:24:46 +0000 | [diff] [blame] | 4 | .. program:: llvm-cov | 
|  | 5 |  | 
| Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 6 | SYNOPSIS | 
|  | 7 | -------- | 
|  | 8 |  | 
| Justin Bogner | 92f4739 | 2015-03-12 04:18:21 +0000 | [diff] [blame] | 9 | :program:`llvm-cov` *command* [*args...*] | 
| Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 10 |  | 
|  | 11 | DESCRIPTION | 
|  | 12 | ----------- | 
|  | 13 |  | 
| Justin Bogner | 92f4739 | 2015-03-12 04:18:21 +0000 | [diff] [blame] | 14 | The :program:`llvm-cov` tool shows code coverage information for | 
|  | 15 | programs that are instrumented to emit profile data. It can be used to | 
|  | 16 | work with ``gcov``\-style coverage or with ``clang``\'s instrumentation | 
|  | 17 | based profiling. | 
| Bob Wilson | c16b704 | 2014-05-06 15:58:06 +0000 | [diff] [blame] | 18 |  | 
| Justin Bogner | 92f4739 | 2015-03-12 04:18:21 +0000 | [diff] [blame] | 19 | If the program is invoked with a base name of ``gcov``, it will behave as if | 
|  | 20 | the :program:`llvm-cov gcov` command were called. Otherwise, a command should | 
|  | 21 | be provided. | 
|  | 22 |  | 
|  | 23 | COMMANDS | 
|  | 24 | -------- | 
|  | 25 |  | 
|  | 26 | * :ref:`gcov <llvm-cov-gcov>` | 
|  | 27 | * :ref:`show <llvm-cov-show>` | 
|  | 28 | * :ref:`report <llvm-cov-report>` | 
| Vedant Kumar | 7101d73 | 2016-07-26 22:50:58 +0000 | [diff] [blame] | 29 | * :ref:`export <llvm-cov-export>` | 
| Justin Bogner | 92f4739 | 2015-03-12 04:18:21 +0000 | [diff] [blame] | 30 |  | 
|  | 31 | .. program:: llvm-cov gcov | 
|  | 32 |  | 
|  | 33 | .. _llvm-cov-gcov: | 
|  | 34 |  | 
|  | 35 | GCOV COMMAND | 
|  | 36 | ------------ | 
|  | 37 |  | 
|  | 38 | SYNOPSIS | 
|  | 39 | ^^^^^^^^ | 
|  | 40 |  | 
|  | 41 | :program:`llvm-cov gcov` [*options*] *SOURCEFILE* | 
|  | 42 |  | 
|  | 43 | DESCRIPTION | 
|  | 44 | ^^^^^^^^^^^ | 
|  | 45 |  | 
|  | 46 | The :program:`llvm-cov gcov` tool reads code coverage data files and displays | 
|  | 47 | the coverage information for a specified source file. It is compatible with the | 
|  | 48 | ``gcov`` tool from version 4.2 of ``GCC`` and may also be compatible with some | 
|  | 49 | later versions of ``gcov``. | 
|  | 50 |  | 
|  | 51 | To use :program:`llvm-cov gcov`, you must first build an instrumented version | 
|  | 52 | of your application that collects coverage data as it runs. Compile with the | 
| Bob Wilson | c16b704 | 2014-05-06 15:58:06 +0000 | [diff] [blame] | 53 | ``-fprofile-arcs`` and ``-ftest-coverage`` options to add the | 
|  | 54 | instrumentation. (Alternatively, you can use the ``--coverage`` option, which | 
|  | 55 | includes both of those other options.) You should compile with debugging | 
|  | 56 | information (``-g``) and without optimization (``-O0``); otherwise, the | 
|  | 57 | coverage data cannot be accurately mapped back to the source code. | 
|  | 58 |  | 
|  | 59 | At the time you compile the instrumented code, a ``.gcno`` data file will be | 
|  | 60 | generated for each object file. These ``.gcno`` files contain half of the | 
|  | 61 | coverage data. The other half of the data comes from ``.gcda`` files that are | 
|  | 62 | generated when you run the instrumented program, with a separate ``.gcda`` | 
|  | 63 | file for each object file. Each time you run the program, the execution counts | 
|  | 64 | are summed into any existing ``.gcda`` files, so be sure to remove any old | 
|  | 65 | files if you do not want their contents to be included. | 
|  | 66 |  | 
|  | 67 | By default, the ``.gcda`` files are written into the same directory as the | 
|  | 68 | object files, but you can override that by setting the ``GCOV_PREFIX`` and | 
|  | 69 | ``GCOV_PREFIX_STRIP`` environment variables. The ``GCOV_PREFIX_STRIP`` | 
|  | 70 | variable specifies a number of directory components to be removed from the | 
|  | 71 | start of the absolute path to the object file directory. After stripping those | 
|  | 72 | directories, the prefix from the ``GCOV_PREFIX`` variable is added. These | 
|  | 73 | environment variables allow you to run the instrumented program on a machine | 
|  | 74 | where the original object file directories are not accessible, but you will | 
|  | 75 | then need to copy the ``.gcda`` files back to the object file directories | 
| Justin Bogner | 92f4739 | 2015-03-12 04:18:21 +0000 | [diff] [blame] | 76 | where :program:`llvm-cov gcov` expects to find them. | 
| Bob Wilson | c16b704 | 2014-05-06 15:58:06 +0000 | [diff] [blame] | 77 |  | 
| Justin Bogner | 92f4739 | 2015-03-12 04:18:21 +0000 | [diff] [blame] | 78 | Once you have generated the coverage data files, run :program:`llvm-cov gcov` | 
|  | 79 | for each main source file where you want to examine the coverage results. This | 
|  | 80 | should be run from the same directory where you previously ran the | 
|  | 81 | compiler. The results for the specified source file are written to a file named | 
|  | 82 | by appending a ``.gcov`` suffix. A separate output file is also created for | 
|  | 83 | each file included by the main source file, also with a ``.gcov`` suffix added. | 
| Bob Wilson | c16b704 | 2014-05-06 15:58:06 +0000 | [diff] [blame] | 84 |  | 
| Justin Bogner | 92f4739 | 2015-03-12 04:18:21 +0000 | [diff] [blame] | 85 | The basic content of an ``.gcov`` output file is a copy of the source file with | 
| Bob Wilson | c16b704 | 2014-05-06 15:58:06 +0000 | [diff] [blame] | 86 | an execution count and line number prepended to every line. The execution | 
|  | 87 | count is shown as ``-`` if a line does not contain any executable code. If | 
|  | 88 | a line contains code but that code was never executed, the count is displayed | 
|  | 89 | as ``#####``. | 
|  | 90 |  | 
| Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 91 | OPTIONS | 
| Justin Bogner | 92f4739 | 2015-03-12 04:18:21 +0000 | [diff] [blame] | 92 | ^^^^^^^ | 
| Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 93 |  | 
| Bob Wilson | c16b704 | 2014-05-06 15:58:06 +0000 | [diff] [blame] | 94 | .. option:: -a, --all-blocks | 
| Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 95 |  | 
| Bob Wilson | c16b704 | 2014-05-06 15:58:06 +0000 | [diff] [blame] | 96 | Display all basic blocks. If there are multiple blocks for a single line of | 
|  | 97 | source code, this option causes llvm-cov to show the count for each block | 
|  | 98 | instead of just one count for the entire line. | 
| Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 99 |  | 
| Bob Wilson | c16b704 | 2014-05-06 15:58:06 +0000 | [diff] [blame] | 100 | .. option:: -b, --branch-probabilities | 
| Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 101 |  | 
| Justin Bogner | 92f4739 | 2015-03-12 04:18:21 +0000 | [diff] [blame] | 102 | Display conditional branch probabilities and a summary of branch information. | 
| Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 103 |  | 
| Bob Wilson | c16b704 | 2014-05-06 15:58:06 +0000 | [diff] [blame] | 104 | .. option:: -c, --branch-counts | 
| Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 105 |  | 
| Bob Wilson | c16b704 | 2014-05-06 15:58:06 +0000 | [diff] [blame] | 106 | Display branch counts instead of probabilities (requires -b). | 
|  | 107 |  | 
|  | 108 | .. option:: -f, --function-summaries | 
|  | 109 |  | 
|  | 110 | Show a summary of coverage for each function instead of just one summary for | 
|  | 111 | an entire source file. | 
|  | 112 |  | 
|  | 113 | .. option:: --help | 
|  | 114 |  | 
|  | 115 | Display available options (--help-hidden for more). | 
|  | 116 |  | 
|  | 117 | .. option:: -l, --long-file-names | 
|  | 118 |  | 
|  | 119 | For coverage output of files included from the main source file, add the | 
|  | 120 | main file name followed by ``##`` as a prefix to the output file names. This | 
|  | 121 | can be combined with the --preserve-paths option to use complete paths for | 
|  | 122 | both the main file and the included file. | 
|  | 123 |  | 
| Justin Bogner | d968717 | 2014-05-07 02:33:58 +0000 | [diff] [blame] | 124 | .. option:: -n, --no-output | 
|  | 125 |  | 
|  | 126 | Do not output any ``.gcov`` files. Summary information is still | 
|  | 127 | displayed. | 
|  | 128 |  | 
| Bob Wilson | c16b704 | 2014-05-06 15:58:06 +0000 | [diff] [blame] | 129 | .. option:: -o=<DIR|FILE>, --object-directory=<DIR>, --object-file=<FILE> | 
|  | 130 |  | 
|  | 131 | Find objects in DIR or based on FILE's path. If you specify a particular | 
|  | 132 | object file, the coverage data files are expected to have the same base name | 
|  | 133 | with ``.gcno`` and ``.gcda`` extensions. If you specify a directory, the | 
|  | 134 | files are expected in that directory with the same base name as the source | 
|  | 135 | file. | 
|  | 136 |  | 
|  | 137 | .. option:: -p, --preserve-paths | 
|  | 138 |  | 
|  | 139 | Preserve path components when naming the coverage output files. In addition | 
|  | 140 | to the source file name, include the directories from the path to that | 
|  | 141 | file. The directories are separate by ``#`` characters, with ``.`` directories | 
|  | 142 | removed and ``..`` directories replaced by ``^`` characters. When used with | 
|  | 143 | the --long-file-names option, this applies to both the main file name and the | 
|  | 144 | included file name. | 
|  | 145 |  | 
|  | 146 | .. option:: -u, --unconditional-branches | 
|  | 147 |  | 
|  | 148 | Include unconditional branches in the output for the --branch-probabilities | 
|  | 149 | option. | 
|  | 150 |  | 
|  | 151 | .. option:: -version | 
|  | 152 |  | 
|  | 153 | Display the version of llvm-cov. | 
| Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 154 |  | 
| Vedant Kumar | a0b9725 | 2019-02-19 20:45:00 +0000 | [diff] [blame] | 155 | .. option:: -x, --hash-filenames | 
|  | 156 |  | 
|  | 157 | Use md5 hash of file name when naming the coverage output files. The source | 
|  | 158 | file name will be suffixed by ``##`` followed by MD5 hash calculated for it. | 
|  | 159 |  | 
| Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 160 | EXIT STATUS | 
| Justin Bogner | 92f4739 | 2015-03-12 04:18:21 +0000 | [diff] [blame] | 161 | ^^^^^^^^^^^ | 
| Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 162 |  | 
| Justin Bogner | 92f4739 | 2015-03-12 04:18:21 +0000 | [diff] [blame] | 163 | :program:`llvm-cov gcov` returns 1 if it cannot read input files.  Otherwise, | 
|  | 164 | it exits with zero. | 
| Daniel Dunbar | 8f4a8a6 | 2012-05-08 16:50:35 +0000 | [diff] [blame] | 165 |  | 
| Justin Bogner | 92f4739 | 2015-03-12 04:18:21 +0000 | [diff] [blame] | 166 | .. program:: llvm-cov show | 
|  | 167 |  | 
|  | 168 | .. _llvm-cov-show: | 
|  | 169 |  | 
|  | 170 | SHOW COMMAND | 
|  | 171 | ------------ | 
|  | 172 |  | 
|  | 173 | SYNOPSIS | 
|  | 174 | ^^^^^^^^ | 
|  | 175 |  | 
| Vedant Kumar | a3661ef | 2016-10-25 17:40:55 +0000 | [diff] [blame] | 176 | :program:`llvm-cov show` [*options*] -instr-profile *PROFILE* *BIN* [*-object BIN,...*] [[*-object BIN*]] [*SOURCES*] | 
| Justin Bogner | 92f4739 | 2015-03-12 04:18:21 +0000 | [diff] [blame] | 177 |  | 
|  | 178 | DESCRIPTION | 
|  | 179 | ^^^^^^^^^^^ | 
|  | 180 |  | 
| Vedant Kumar | a3661ef | 2016-10-25 17:40:55 +0000 | [diff] [blame] | 181 | The :program:`llvm-cov show` command shows line by line coverage of the | 
|  | 182 | binaries *BIN*,...  using the profile data *PROFILE*. It can optionally be | 
|  | 183 | filtered to only show the coverage for the files listed in *SOURCES*. | 
| Justin Bogner | 92f4739 | 2015-03-12 04:18:21 +0000 | [diff] [blame] | 184 |  | 
| Vedant Kumar | 901d04f | 2019-06-13 20:48:57 +0000 | [diff] [blame] | 185 | *BIN* may be an executable, object file, dynamic library, or archive (thin or | 
|  | 186 | otherwise). | 
|  | 187 |  | 
| Bob Wilson | 9810588 | 2015-04-21 16:32:02 +0000 | [diff] [blame] | 188 | To use :program:`llvm-cov show`, you need a program that is compiled with | 
| Justin Bogner | 92f4739 | 2015-03-12 04:18:21 +0000 | [diff] [blame] | 189 | instrumentation to emit profile and coverage data. To build such a program with | 
|  | 190 | ``clang`` use the ``-fprofile-instr-generate`` and ``-fcoverage-mapping`` | 
|  | 191 | flags. If linking with the ``clang`` driver, pass ``-fprofile-instr-generate`` | 
|  | 192 | to the link stage to make sure the necessary runtime libraries are linked in. | 
|  | 193 |  | 
|  | 194 | The coverage information is stored in the built executable or library itself, | 
| Vedant Kumar | a3661ef | 2016-10-25 17:40:55 +0000 | [diff] [blame] | 195 | and this is what you should pass to :program:`llvm-cov show` as a *BIN* | 
| Justin Bogner | 92f4739 | 2015-03-12 04:18:21 +0000 | [diff] [blame] | 196 | argument. The profile data is generated by running this instrumented program | 
|  | 197 | normally. When the program exits it will write out a raw profile file, | 
|  | 198 | typically called ``default.profraw``, which can be converted to a format that | 
|  | 199 | is suitable for the *PROFILE* argument using the :program:`llvm-profdata merge` | 
|  | 200 | tool. | 
|  | 201 |  | 
|  | 202 | OPTIONS | 
|  | 203 | ^^^^^^^ | 
|  | 204 |  | 
|  | 205 | .. option:: -show-line-counts | 
|  | 206 |  | 
| Vedant Kumar | 305e1b5 | 2017-09-25 23:10:04 +0000 | [diff] [blame] | 207 | Show the execution counts for each line. Defaults to true, unless another | 
|  | 208 | ``-show`` option is used. | 
| Justin Bogner | 92f4739 | 2015-03-12 04:18:21 +0000 | [diff] [blame] | 209 |  | 
|  | 210 | .. option:: -show-expansions | 
|  | 211 |  | 
|  | 212 | Expand inclusions, such as preprocessor macros or textual inclusions, inline | 
| Vedant Kumar | 305e1b5 | 2017-09-25 23:10:04 +0000 | [diff] [blame] | 213 | in the display of the source file. Defaults to false. | 
| Justin Bogner | 92f4739 | 2015-03-12 04:18:21 +0000 | [diff] [blame] | 214 |  | 
|  | 215 | .. option:: -show-instantiations | 
|  | 216 |  | 
|  | 217 | For source regions that are instantiated multiple times, such as templates in | 
|  | 218 | ``C++``, show each instantiation separately as well as the combined summary. | 
| Vedant Kumar | 305e1b5 | 2017-09-25 23:10:04 +0000 | [diff] [blame] | 219 | Defaults to true. | 
| Justin Bogner | 92f4739 | 2015-03-12 04:18:21 +0000 | [diff] [blame] | 220 |  | 
|  | 221 | .. option:: -show-regions | 
|  | 222 |  | 
|  | 223 | Show the execution counts for each region by displaying a caret that points to | 
| Vedant Kumar | 305e1b5 | 2017-09-25 23:10:04 +0000 | [diff] [blame] | 224 | the character where the region starts. Defaults to false. | 
| Justin Bogner | 92f4739 | 2015-03-12 04:18:21 +0000 | [diff] [blame] | 225 |  | 
|  | 226 | .. option:: -show-line-counts-or-regions | 
|  | 227 |  | 
|  | 228 | Show the execution counts for each line if there is only one region on the | 
|  | 229 | line, but show the individual regions if there are multiple on the line. | 
| Vedant Kumar | 305e1b5 | 2017-09-25 23:10:04 +0000 | [diff] [blame] | 230 | Defaults to false. | 
| Justin Bogner | 92f4739 | 2015-03-12 04:18:21 +0000 | [diff] [blame] | 231 |  | 
| Vedant Kumar | 305e1b5 | 2017-09-25 23:10:04 +0000 | [diff] [blame] | 232 | .. option:: -use-color | 
| Justin Bogner | 92f4739 | 2015-03-12 04:18:21 +0000 | [diff] [blame] | 233 |  | 
| Justin Bogner | 7bf61d3 | 2015-03-19 18:22:46 +0000 | [diff] [blame] | 234 | Enable or disable color output. By default this is autodetected. | 
| Justin Bogner | 92f4739 | 2015-03-12 04:18:21 +0000 | [diff] [blame] | 235 |  | 
| Vedant Kumar | 4b102c3 | 2017-08-01 21:23:26 +0000 | [diff] [blame] | 236 | .. option:: -arch=[*NAMES*] | 
| Justin Bogner | 92f4739 | 2015-03-12 04:18:21 +0000 | [diff] [blame] | 237 |  | 
| Vedant Kumar | 4b102c3 | 2017-08-01 21:23:26 +0000 | [diff] [blame] | 238 | Specify a list of architectures such that the Nth entry in the list | 
|  | 239 | corresponds to the Nth specified binary. If the covered object is a universal | 
|  | 240 | binary, this specifies the architecture to use. It is an error to specify an | 
|  | 241 | architecture that is not included in the universal binary or to use an | 
|  | 242 | architecture that does not match a non-universal binary. | 
| Justin Bogner | 92f4739 | 2015-03-12 04:18:21 +0000 | [diff] [blame] | 243 |  | 
|  | 244 | .. option:: -name=<NAME> | 
|  | 245 |  | 
|  | 246 | Show code coverage only for functions with the given name. | 
|  | 247 |  | 
| Sean Eveson | e15300e | 2017-08-31 09:11:31 +0000 | [diff] [blame] | 248 | .. option:: -name-whitelist=<FILE> | 
|  | 249 |  | 
|  | 250 | Show code coverage only for functions listed in the given file. Each line in | 
|  | 251 | the file should start with `whitelist_fun:`, immediately followed by the name | 
|  | 252 | of the function to accept. This name can be a wildcard expression. | 
|  | 253 |  | 
| Justin Bogner | 92f4739 | 2015-03-12 04:18:21 +0000 | [diff] [blame] | 254 | .. option:: -name-regex=<PATTERN> | 
|  | 255 |  | 
|  | 256 | Show code coverage only for functions that match the given regular expression. | 
|  | 257 |  | 
| Max Moroz | 4220f89 | 2018-04-09 15:20:35 +0000 | [diff] [blame] | 258 | .. option:: -ignore-filename-regex=<PATTERN> | 
|  | 259 |  | 
|  | 260 | Skip source code files with file paths that match the given regular expression. | 
|  | 261 |  | 
| Vedant Kumar | 635c83c | 2016-06-28 00:15:54 +0000 | [diff] [blame] | 262 | .. option:: -format=<FORMAT> | 
|  | 263 |  | 
| Vedant Kumar | 4c01092 | 2016-07-06 21:44:05 +0000 | [diff] [blame] | 264 | Use the specified output format. The supported formats are: "text", "html". | 
| Vedant Kumar | 635c83c | 2016-06-28 00:15:54 +0000 | [diff] [blame] | 265 |  | 
| Vedant Kumar | ad547d3 | 2016-08-04 18:00:42 +0000 | [diff] [blame] | 266 | .. option:: -tab-size=<TABSIZE> | 
|  | 267 |  | 
|  | 268 | Replace tabs with <TABSIZE> spaces when preparing reports. Currently, this is | 
|  | 269 | only supported for the html format. | 
|  | 270 |  | 
| Vedant Kumar | 7937ef3 | 2016-06-28 02:09:39 +0000 | [diff] [blame] | 271 | .. option:: -output-dir=PATH | 
|  | 272 |  | 
|  | 273 | Specify a directory to write coverage reports into. If the directory does not | 
|  | 274 | exist, it is created. When used in function view mode (i.e when -name or | 
|  | 275 | -name-regex are used to select specific functions), the report is written to | 
|  | 276 | PATH/functions.EXTENSION. When used in file view mode, a report for each file | 
|  | 277 | is written to PATH/REL_PATH_TO_FILE.EXTENSION. | 
|  | 278 |  | 
| Vedant Kumar | 424f51b | 2016-07-15 22:44:57 +0000 | [diff] [blame] | 279 | .. option:: -Xdemangler=<TOOL>|<TOOL-OPTION> | 
|  | 280 |  | 
|  | 281 | Specify a symbol demangler. This can be used to make reports more | 
|  | 282 | human-readable. This option can be specified multiple times to supply | 
|  | 283 | arguments to the demangler (e.g `-Xdemangler c++filt -Xdemangler -n` for C++). | 
|  | 284 | The demangler is expected to read a newline-separated list of symbols from | 
|  | 285 | stdin and write a newline-separated list of the same length to stdout. | 
|  | 286 |  | 
| Vedant Kumar | 7fa7510 | 2017-07-11 01:23:29 +0000 | [diff] [blame] | 287 | .. option:: -num-threads=N, -j=N | 
|  | 288 |  | 
|  | 289 | Use N threads to write file reports (only applicable when -output-dir is | 
|  | 290 | specified). When N=0, llvm-cov auto-detects an appropriate number of threads to | 
|  | 291 | use. This is the default. | 
|  | 292 |  | 
| Justin Bogner | 92f4739 | 2015-03-12 04:18:21 +0000 | [diff] [blame] | 293 | .. option:: -line-coverage-gt=<N> | 
|  | 294 |  | 
|  | 295 | Show code coverage only for functions with line coverage greater than the | 
|  | 296 | given threshold. | 
|  | 297 |  | 
|  | 298 | .. option:: -line-coverage-lt=<N> | 
|  | 299 |  | 
|  | 300 | Show code coverage only for functions with line coverage less than the given | 
|  | 301 | threshold. | 
|  | 302 |  | 
|  | 303 | .. option:: -region-coverage-gt=<N> | 
|  | 304 |  | 
|  | 305 | Show code coverage only for functions with region coverage greater than the | 
|  | 306 | given threshold. | 
|  | 307 |  | 
|  | 308 | .. option:: -region-coverage-lt=<N> | 
|  | 309 |  | 
|  | 310 | Show code coverage only for functions with region coverage less than the given | 
|  | 311 | threshold. | 
|  | 312 |  | 
| Sean Eveson | 9edfeac | 2017-08-14 10:20:12 +0000 | [diff] [blame] | 313 | .. option:: -path-equivalence=<from>,<to> | 
|  | 314 |  | 
|  | 315 | Map the paths in the coverage data to local source file paths. This allows you | 
|  | 316 | to generate the coverage data on one machine, and then use llvm-cov on a | 
|  | 317 | different machine where you have the same files on a different path. | 
|  | 318 |  | 
| Justin Bogner | 92f4739 | 2015-03-12 04:18:21 +0000 | [diff] [blame] | 319 | .. program:: llvm-cov report | 
|  | 320 |  | 
|  | 321 | .. _llvm-cov-report: | 
|  | 322 |  | 
|  | 323 | REPORT COMMAND | 
|  | 324 | -------------- | 
|  | 325 |  | 
|  | 326 | SYNOPSIS | 
|  | 327 | ^^^^^^^^ | 
|  | 328 |  | 
| Vedant Kumar | a3661ef | 2016-10-25 17:40:55 +0000 | [diff] [blame] | 329 | :program:`llvm-cov report` [*options*] -instr-profile *PROFILE* *BIN* [*-object BIN,...*] [[*-object BIN*]] [*SOURCES*] | 
| Justin Bogner | 92f4739 | 2015-03-12 04:18:21 +0000 | [diff] [blame] | 330 |  | 
|  | 331 | DESCRIPTION | 
|  | 332 | ^^^^^^^^^^^ | 
|  | 333 |  | 
| Vedant Kumar | a3661ef | 2016-10-25 17:40:55 +0000 | [diff] [blame] | 334 | The :program:`llvm-cov report` command displays a summary of the coverage of | 
|  | 335 | the binaries *BIN*,... using the profile data *PROFILE*. It can optionally be | 
|  | 336 | filtered to only show the coverage for the files listed in *SOURCES*. | 
| Justin Bogner | 92f4739 | 2015-03-12 04:18:21 +0000 | [diff] [blame] | 337 |  | 
| Vedant Kumar | 901d04f | 2019-06-13 20:48:57 +0000 | [diff] [blame] | 338 | *BIN* may be an executable, object file, dynamic library, or archive (thin or | 
|  | 339 | otherwise). | 
|  | 340 |  | 
| Justin Bogner | 92f4739 | 2015-03-12 04:18:21 +0000 | [diff] [blame] | 341 | If no source files are provided, a summary line is printed for each file in the | 
| Vedant Kumar | 899692e | 2018-07-13 22:39:31 +0000 | [diff] [blame] | 342 | coverage data. If any files are provided, summaries can be shown for each | 
|  | 343 | function in the listed files if the ``-show-functions`` option is enabled. | 
| Justin Bogner | 92f4739 | 2015-03-12 04:18:21 +0000 | [diff] [blame] | 344 |  | 
|  | 345 | For information on compiling programs for coverage and generating profile data, | 
| Justin Bogner | 0ea61e9 | 2015-03-12 04:43:01 +0000 | [diff] [blame] | 346 | see :ref:`llvm-cov-show`. | 
| Justin Bogner | 92f4739 | 2015-03-12 04:18:21 +0000 | [diff] [blame] | 347 |  | 
|  | 348 | OPTIONS | 
|  | 349 | ^^^^^^^ | 
|  | 350 |  | 
| Justin Bogner | 7bf61d3 | 2015-03-19 18:22:46 +0000 | [diff] [blame] | 351 | .. option:: -use-color[=VALUE] | 
| Justin Bogner | 92f4739 | 2015-03-12 04:18:21 +0000 | [diff] [blame] | 352 |  | 
| Justin Bogner | 7bf61d3 | 2015-03-19 18:22:46 +0000 | [diff] [blame] | 353 | Enable or disable color output. By default this is autodetected. | 
| Justin Bogner | 92f4739 | 2015-03-12 04:18:21 +0000 | [diff] [blame] | 354 |  | 
|  | 355 | .. option:: -arch=<name> | 
|  | 356 |  | 
| Bob Wilson | 9810588 | 2015-04-21 16:32:02 +0000 | [diff] [blame] | 357 | If the covered binary is a universal binary, select the architecture to use. | 
|  | 358 | It is an error to specify an architecture that is not included in the | 
|  | 359 | universal binary or to use an architecture that does not match a | 
|  | 360 | non-universal binary. | 
| Vedant Kumar | 7101d73 | 2016-07-26 22:50:58 +0000 | [diff] [blame] | 361 |  | 
| Vedant Kumar | 62eb0fd | 2017-02-05 20:11:08 +0000 | [diff] [blame] | 362 | .. option:: -show-functions | 
|  | 363 |  | 
| Vedant Kumar | 305e1b5 | 2017-09-25 23:10:04 +0000 | [diff] [blame] | 364 | Show coverage summaries for each function. Defaults to false. | 
| Vedant Kumar | 62eb0fd | 2017-02-05 20:11:08 +0000 | [diff] [blame] | 365 |  | 
| Vedant Kumar | 305e1b5 | 2017-09-25 23:10:04 +0000 | [diff] [blame] | 366 | .. option:: -show-instantiation-summary | 
| Vedant Kumar | 047cbee | 2017-09-20 21:52:09 +0000 | [diff] [blame] | 367 |  | 
|  | 368 | Show statistics for all function instantiations. Defaults to false. | 
|  | 369 |  | 
| Max Moroz | 4220f89 | 2018-04-09 15:20:35 +0000 | [diff] [blame] | 370 | .. option:: -ignore-filename-regex=<PATTERN> | 
|  | 371 |  | 
|  | 372 | Skip source code files with file paths that match the given regular expression. | 
|  | 373 |  | 
| Vedant Kumar | 90f1b82 | 2016-07-26 23:09:57 +0000 | [diff] [blame] | 374 | .. program:: llvm-cov export | 
|  | 375 |  | 
|  | 376 | .. _llvm-cov-export: | 
|  | 377 |  | 
| Vedant Kumar | 7101d73 | 2016-07-26 22:50:58 +0000 | [diff] [blame] | 378 | EXPORT COMMAND | 
|  | 379 | -------------- | 
|  | 380 |  | 
|  | 381 | SYNOPSIS | 
|  | 382 | ^^^^^^^^ | 
|  | 383 |  | 
| Max Moroz | 1ef3a77 | 2018-01-04 19:33:29 +0000 | [diff] [blame] | 384 | :program:`llvm-cov export` [*options*] -instr-profile *PROFILE* *BIN* [*-object BIN,...*] [[*-object BIN*]] [*SOURCES*] | 
| Vedant Kumar | 7101d73 | 2016-07-26 22:50:58 +0000 | [diff] [blame] | 385 |  | 
|  | 386 | DESCRIPTION | 
|  | 387 | ^^^^^^^^^^^ | 
|  | 388 |  | 
| Max Moroz | b2091c9 | 2018-11-09 16:10:44 +0000 | [diff] [blame] | 389 | The :program:`llvm-cov export` command exports coverage data of the binaries | 
|  | 390 | *BIN*,... using the profile data *PROFILE* in either JSON or lcov trace file | 
|  | 391 | format. | 
|  | 392 |  | 
|  | 393 | When exporting JSON, the regions, functions, expansions, and summaries of the | 
|  | 394 | coverage data will be exported. When exporting an lcov trace file, the | 
|  | 395 | line-based coverage and summaries will be exported. | 
|  | 396 |  | 
|  | 397 | The exported data can optionally be filtered to only export the coverage | 
| Max Moroz | 1ef3a77 | 2018-01-04 19:33:29 +0000 | [diff] [blame] | 398 | for the files listed in *SOURCES*. | 
| Vedant Kumar | 7101d73 | 2016-07-26 22:50:58 +0000 | [diff] [blame] | 399 |  | 
|  | 400 | For information on compiling programs for coverage and generating profile data, | 
|  | 401 | see :ref:`llvm-cov-show`. | 
|  | 402 |  | 
|  | 403 | OPTIONS | 
|  | 404 | ^^^^^^^ | 
|  | 405 |  | 
|  | 406 | .. option:: -arch=<name> | 
|  | 407 |  | 
|  | 408 | If the covered binary is a universal binary, select the architecture to use. | 
|  | 409 | It is an error to specify an architecture that is not included in the | 
|  | 410 | universal binary or to use an architecture that does not match a | 
|  | 411 | non-universal binary. | 
| Max Moroz | fe4d904 | 2017-12-11 23:17:46 +0000 | [diff] [blame] | 412 |  | 
| Max Moroz | b2091c9 | 2018-11-09 16:10:44 +0000 | [diff] [blame] | 413 | .. option:: -format=<FORMAT> | 
|  | 414 |  | 
|  | 415 | Use the specified output format. The supported formats are: "text" (JSON), | 
|  | 416 | "lcov". | 
|  | 417 |  | 
| Max Moroz | fe4d904 | 2017-12-11 23:17:46 +0000 | [diff] [blame] | 418 | .. option:: -summary-only | 
|  | 419 |  | 
|  | 420 | Export only summary information for each file in the coverage data. This mode | 
|  | 421 | will not export coverage information for smaller units such as individual | 
| Max Moroz | b2091c9 | 2018-11-09 16:10:44 +0000 | [diff] [blame] | 422 | functions or regions. The result will contain the same information as produced | 
|  | 423 | by the :program:`llvm-cov report` command, but presented in JSON or lcov | 
|  | 424 | format rather than text. | 
| Max Moroz | 4220f89 | 2018-04-09 15:20:35 +0000 | [diff] [blame] | 425 |  | 
|  | 426 | .. option:: -ignore-filename-regex=<PATTERN> | 
|  | 427 |  | 
|  | 428 | Skip source code files with file paths that match the given regular expression. | 
| Max Moroz | a80d9ce | 2019-03-14 17:49:27 +0000 | [diff] [blame] | 429 |  | 
|  | 430 | .. option:: -skip-expansions | 
|  | 431 |  | 
|  | 432 | Skip exporting macro expansion coverage data. | 
|  | 433 |  | 
|  | 434 | .. option:: -skip-functions | 
|  | 435 |  | 
|  | 436 | Skip exporting per-function coverage data. | 
|  | 437 |  | 
|  | 438 | .. option:: -num-threads=N, -j=N | 
|  | 439 |  | 
|  | 440 | Use N threads to export coverage data. When N=0, llvm-cov auto-detects an | 
|  | 441 | appropriate number of threads to use. This is the default. |