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