@@ -66,17 +66,17 @@ supported. Uninstrumented code simply won't be accounted for in reports.
66
66
67
67
To compile code with Modified Condition/Decision Coverage (MC/DC) enabled,
68
68
pass ``-fcoverage-mcdc `` in addition to the clang options specified above.
69
- MC/DC is an advanced form of code coverage most applicable in the embedded
69
+ MC/DC is an advanced form of code coverage most applicable to the embedded
70
70
space.
71
71
72
72
Running the instrumented program
73
73
================================
74
74
75
- The next step is to run the instrumented program. When the program exits it
75
+ The next step is to run the instrumented program. When the program exits, it
76
76
will write a **raw profile ** to the path specified by the ``LLVM_PROFILE_FILE ``
77
77
environment variable. If that variable does not exist, the profile is written
78
78
to ``default.profraw `` in the current directory of the program. If
79
- ``LLVM_PROFILE_FILE `` contains a path to a non-existent directory, the missing
79
+ ``LLVM_PROFILE_FILE `` specifies a path to a non-existent directory, the missing
80
80
directory structure will be created. Additionally, the following special
81
81
**pattern strings ** are rewritten:
82
82
@@ -97,7 +97,7 @@ directory structure will be created. Additionally, the following special
97
97
* "%b" expands out to the binary ID (build ID). It can be used with "%Nm" to
98
98
avoid binary signature collisions. To use it, the program should be compiled
99
99
with the build ID linker option (``--build-id `` for GNU ld or LLD,
100
- ``/build-id `` for lld-link on Windows). Linux, Windows and AIX are supported.
100
+ ``/build-id `` for lld-link on Windows). Linux, Windows, and AIX are supported.
101
101
102
102
* "%c" expands out to nothing, but enables a mode in which profile counter
103
103
updates are continuously synced to a file. This means that if the
@@ -128,7 +128,7 @@ and set bias to the offset between the original and the new counter location,
128
128
at which point every subsequent counter access will be to the new location,
129
129
which allows updating profile directly akin to the continuous mode.
130
130
131
- The advantage of this approach is that doesn't require any special OS support.
131
+ The advantage of this approach is that it doesn't require any special OS support.
132
132
The disadvantage is the extra overhead due to additional instructions required
133
133
for each counter access (overhead both in terms of binary size and performance)
134
134
plus duplication of counters (i.e. one copy in the binary itself and another
@@ -137,7 +137,7 @@ other platforms by passing the ``-runtime-counter-relocation`` option to the
137
137
backend during compilation.
138
138
139
139
For a program such as the `Lit <https://llvm.org/docs/CommandGuide/lit.html >`_
140
- testing tool which invokes other programs, it may be necessary to set
140
+ testing tool, which invokes other programs, it may be necessary to set
141
141
``LLVM_PROFILE_FILE `` for each invocation. The pattern strings "%p" or "%Nm"
142
142
may help to avoid corruption due to concurrency. Note that "%p" is also a Lit
143
143
token and needs to be escaped as "%%p".
@@ -149,7 +149,7 @@ token and needs to be escaped as "%%p".
149
149
Creating coverage reports
150
150
=========================
151
151
152
- Raw profiles have to be **indexed ** before they can be used to generate
152
+ Raw profiles must be **indexed ** before they can be used to generate
153
153
coverage reports. This is done using the "merge" tool in ``llvm-profdata ``
154
154
(which can combine multiple raw profiles and index them at the same time):
155
155
@@ -240,13 +240,13 @@ line-oriented report, try:
240
240
TOTAL 13 0 100.00% 3 0 100.00% 13 0 100.00% 12 2 83.33%
241
241
242
242
The ``llvm-cov `` tool supports specifying a custom demangler, writing out
243
- reports in a directory structure, and generating html reports. For the full
243
+ reports in a directory structure, and generating HTML reports. For the full
244
244
list of options, please refer to the `command guide
245
245
<https://llvm.org/docs/CommandGuide/llvm-cov.html> `_.
246
246
247
247
A few final notes:
248
248
249
- * The ``-sparse `` flag is optional but can result in dramatically smaller
249
+ * The ``-sparse `` flag is optional but can produce dramatically smaller
250
250
indexed profiles. This option should not be used if the indexed profile will
251
251
be reused for PGO.
252
252
@@ -255,7 +255,7 @@ A few final notes:
255
255
information directly into an existing raw profile on disk. The details are
256
256
out of scope.
257
257
258
- * The ``llvm-profdata `` tool can be used to merge together multiple raw or
258
+ * The ``llvm-profdata `` tool can be used to merge multiple raw or
259
259
indexed profiles. To combine profiling data from multiple runs of a program,
260
260
try e.g:
261
261
@@ -299,7 +299,7 @@ There are six statistics tracked in a coverage summary:
299
299
source code that may each evaluate to either "true" or "false". These
300
300
conditions may comprise larger boolean expressions linked by boolean logical
301
301
operators. For example, "x = (y == 2) || (z < 10)" is a boolean expression
302
- that is comprised of two individual conditions, each of which evaluates to
302
+ comprised of two individual conditions, each of which evaluates to
303
303
either true or false, producing four total branch outcomes.
304
304
305
305
* Modified Condition/Decision Coverage (MC/DC) is the percentage of individual
@@ -316,7 +316,7 @@ There are six statistics tracked in a coverage summary:
316
316
``-show-mcdc-summary `` option as long as code was also compiled using the
317
317
clang option ``-fcoverage-mcdc ``.
318
318
319
- * Boolean expressions that are only comprised of one condition (and therefore
319
+ * Boolean expressions comprised of only one condition (and therefore
320
320
have no logical operators) are not included in MC/DC analysis and are
321
321
trivially deducible using branch coverage.
322
322
@@ -366,7 +366,7 @@ By default the compiler runtime uses a static initializer to determine the
366
366
profile output path and to register a writer function. To collect profiles
367
367
without using static initializers, do this manually:
368
368
369
- * Export a ``int __llvm_profile_runtime `` symbol from each instrumented shared
369
+ * Export an ``int __llvm_profile_runtime `` symbol from each instrumented shared
370
370
library and executable. When the linker finds a definition of this symbol, it
371
371
knows to skip loading the object which contains the profiling runtime's
372
372
static initializer.
@@ -380,7 +380,7 @@ without using static initializers, do this manually:
380
380
to ``__llvm_profile_write_file ``.
381
381
382
382
* Forward-declare ``int __llvm_profile_write_file(void) `` and call it to write
383
- out a profile. This function returns 0 when it succeeds , and a non-zero value
383
+ out a profile. This function returns 0 on success , and a non-zero value
384
384
otherwise. Calling this function multiple times appends profile data to an
385
385
existing on-disk raw profile.
386
386
@@ -418,7 +418,7 @@ Collecting coverage reports for the llvm project
418
418
================================================
419
419
420
420
To prepare a coverage report for llvm (and any of its sub-projects), add
421
- ``-DLLVM_BUILD_INSTRUMENTED_COVERAGE=On `` to the cmake configuration. Raw
421
+ ``-DLLVM_BUILD_INSTRUMENTED_COVERAGE=On `` to the CMake configuration. Raw
422
422
profiles will be written to ``$BUILD_DIR/profiles/ ``. To prepare an html
423
423
report, run ``llvm/utils/prepare-code-coverage-artifact.py ``.
424
424
@@ -429,7 +429,7 @@ To specify an alternate directory for raw profiles, use
429
429
Drawbacks and limitations
430
430
=========================
431
431
432
- * Prior to version 2.26, the GNU binutils BFD linker is not able link programs
432
+ * Prior to version 2.26, the GNU binutils BFD linker cannot link programs
433
433
compiled with ``-fcoverage-mapping `` in its ``--gc-sections `` mode. Possible
434
434
workarounds include disabling ``--gc-sections ``, upgrading to a newer version
435
435
of BFD, or using the Gold linker.
0 commit comments