Skip to content

Commit c48ec7f

Browse files
[clang] Proofread SourceBasedCodeCoverage.rst (#154050)
1 parent 07eb7b7 commit c48ec7f

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

clang/docs/SourceBasedCodeCoverage.rst

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -66,17 +66,17 @@ supported. Uninstrumented code simply won't be accounted for in reports.
6666

6767
To compile code with Modified Condition/Decision Coverage (MC/DC) enabled,
6868
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
7070
space.
7171

7272
Running the instrumented program
7373
================================
7474

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
7676
will write a **raw profile** to the path specified by the ``LLVM_PROFILE_FILE``
7777
environment variable. If that variable does not exist, the profile is written
7878
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
8080
directory structure will be created. Additionally, the following special
8181
**pattern strings** are rewritten:
8282

@@ -97,7 +97,7 @@ directory structure will be created. Additionally, the following special
9797
* "%b" expands out to the binary ID (build ID). It can be used with "%Nm" to
9898
avoid binary signature collisions. To use it, the program should be compiled
9999
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.
101101

102102
* "%c" expands out to nothing, but enables a mode in which profile counter
103103
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,
128128
at which point every subsequent counter access will be to the new location,
129129
which allows updating profile directly akin to the continuous mode.
130130

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.
132132
The disadvantage is the extra overhead due to additional instructions required
133133
for each counter access (overhead both in terms of binary size and performance)
134134
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
137137
backend during compilation.
138138

139139
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
141141
``LLVM_PROFILE_FILE`` for each invocation. The pattern strings "%p" or "%Nm"
142142
may help to avoid corruption due to concurrency. Note that "%p" is also a Lit
143143
token and needs to be escaped as "%%p".
@@ -149,7 +149,7 @@ token and needs to be escaped as "%%p".
149149
Creating coverage reports
150150
=========================
151151

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
153153
coverage reports. This is done using the "merge" tool in ``llvm-profdata``
154154
(which can combine multiple raw profiles and index them at the same time):
155155

@@ -240,13 +240,13 @@ line-oriented report, try:
240240
TOTAL 13 0 100.00% 3 0 100.00% 13 0 100.00% 12 2 83.33%
241241
242242
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
244244
list of options, please refer to the `command guide
245245
<https://llvm.org/docs/CommandGuide/llvm-cov.html>`_.
246246

247247
A few final notes:
248248

249-
* The ``-sparse`` flag is optional but can result in dramatically smaller
249+
* The ``-sparse`` flag is optional but can produce dramatically smaller
250250
indexed profiles. This option should not be used if the indexed profile will
251251
be reused for PGO.
252252

@@ -255,7 +255,7 @@ A few final notes:
255255
information directly into an existing raw profile on disk. The details are
256256
out of scope.
257257

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
259259
indexed profiles. To combine profiling data from multiple runs of a program,
260260
try e.g:
261261

@@ -299,7 +299,7 @@ There are six statistics tracked in a coverage summary:
299299
source code that may each evaluate to either "true" or "false". These
300300
conditions may comprise larger boolean expressions linked by boolean logical
301301
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
303303
either true or false, producing four total branch outcomes.
304304

305305
* Modified Condition/Decision Coverage (MC/DC) is the percentage of individual
@@ -316,7 +316,7 @@ There are six statistics tracked in a coverage summary:
316316
``-show-mcdc-summary`` option as long as code was also compiled using the
317317
clang option ``-fcoverage-mcdc``.
318318

319-
* Boolean expressions that are only comprised of one condition (and therefore
319+
* Boolean expressions comprised of only one condition (and therefore
320320
have no logical operators) are not included in MC/DC analysis and are
321321
trivially deducible using branch coverage.
322322

@@ -366,7 +366,7 @@ By default the compiler runtime uses a static initializer to determine the
366366
profile output path and to register a writer function. To collect profiles
367367
without using static initializers, do this manually:
368368

369-
* Export a ``int __llvm_profile_runtime`` symbol from each instrumented shared
369+
* Export an ``int __llvm_profile_runtime`` symbol from each instrumented shared
370370
library and executable. When the linker finds a definition of this symbol, it
371371
knows to skip loading the object which contains the profiling runtime's
372372
static initializer.
@@ -380,7 +380,7 @@ without using static initializers, do this manually:
380380
to ``__llvm_profile_write_file``.
381381

382382
* 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
384384
otherwise. Calling this function multiple times appends profile data to an
385385
existing on-disk raw profile.
386386

@@ -418,7 +418,7 @@ Collecting coverage reports for the llvm project
418418
================================================
419419

420420
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
422422
profiles will be written to ``$BUILD_DIR/profiles/``. To prepare an html
423423
report, run ``llvm/utils/prepare-code-coverage-artifact.py``.
424424

@@ -429,7 +429,7 @@ To specify an alternate directory for raw profiles, use
429429
Drawbacks and limitations
430430
=========================
431431

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
433433
compiled with ``-fcoverage-mapping`` in its ``--gc-sections`` mode. Possible
434434
workarounds include disabling ``--gc-sections``, upgrading to a newer version
435435
of BFD, or using the Gold linker.

0 commit comments

Comments
 (0)