Skip to content

Commit 4b9c828

Browse files
[llvm] Proofread CodingStandards.rst (llvm#154892)
1 parent 3248fba commit 4b9c828

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

llvm/docs/CodingStandards.rst

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ Languages, Libraries, and Standards
4646
Most source code in LLVM and other LLVM projects using these coding standards
4747
is C++ code. There are some places where C code is used either due to
4848
environment restrictions, historical restrictions, or due to third-party source
49-
code imported into the tree. Generally, our preference is for standards
50-
conforming, modern, and portable C++ code as the implementation language of
49+
code imported into the tree. Generally, our preference is for
50+
standards-conforming, modern, and portable C++ code as the implementation language of
5151
choice.
5252

53-
For automation, build-systems, and utility scripts, Python is preferred and
53+
For automation, build systems, and utility scripts, Python is preferred and
5454
is widely used in the LLVM repository already.
5555

5656
C++ Standard Versions
@@ -236,7 +236,7 @@ Comment Formatting
236236

237237
In general, prefer C++-style comments (``//`` for normal comments, ``///`` for
238238
``doxygen`` documentation comments). There are a few cases when it is
239-
useful to use C-style (``/* */``) comments however:
239+
useful to use C-style (``/* */``) comments, however:
240240

241241
#. When writing C code to be compatible with C89.
242242

@@ -263,7 +263,7 @@ useful to use C-style (``/* */``) comments however:
263263
Commenting out large blocks of code is discouraged, but if you really have to do
264264
this (for documentation purposes or as a suggestion for debug printing), use
265265
``#if 0`` and ``#endif``. These nest properly and are better behaved in general
266-
than C style comments.
266+
than C-style comments.
267267

268268
Doxygen Use in Documentation Comments
269269
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -365,7 +365,7 @@ Clear diagnostic messages are important to help users identify and fix issues in
365365
their inputs. Use succinct but correct English prose that gives the user the
366366
context needed to understand what went wrong. Also, to match error message
367367
styles commonly produced by other tools, start the first sentence with a
368-
lower-case letter, and finish the last sentence without a period, if it would
368+
lowercase letter, and finish the last sentence without a period, if it would
369369
end in one otherwise. Sentences which end with different punctuation, such as
370370
"did you forget ';'?", should still do so.
371371

@@ -703,7 +703,7 @@ uses a more moderate stance. Use ``auto`` if and only if it makes the code more
703703
readable or easier to maintain. Don't "almost always" use ``auto``, but do use
704704
``auto`` with initializers like ``cast<Foo>(...)`` or other places where the
705705
type is already obvious from the context. Another time when ``auto`` works well
706-
for these purposes is when the type would have been abstracted away anyways,
706+
for these purposes is when the type would have been abstracted away anyway,
707707
often behind a container's typedef such as ``std::vector<T>::iterator``.
708708

709709
Similarly, C++14 adds generic lambda expressions where parameter types can be
@@ -754,7 +754,7 @@ Beware of non-deterministic sorting order of equal elements
754754
elements is not guaranteed to be preserved. Thus using ``std::sort`` for a
755755
container having equal elements may result in non-deterministic behavior.
756756
To uncover such instances of non-determinism, LLVM has introduced a new
757-
llvm::sort wrapper function. For an EXPENSIVE_CHECKS build this will randomly
757+
``llvm::sort`` wrapper function. For an ``EXPENSIVE_CHECKS`` build this will randomly
758758
shuffle the container before sorting. Default to using ``llvm::sort`` instead
759759
of ``std::sort``.
760760

@@ -829,7 +829,7 @@ prototyped function or method, you don't need it. In fact, for most cases, you
829829
simply don't need the definition of a class. And not ``#include``\ing speeds up
830830
compilation.
831831

832-
It is easy to try to go too overboard on this recommendation, however. You
832+
It is easy to try to go overboard on this recommendation, however. You
833833
**must** include all of the header files that you are using --- you can include
834834
them either directly or indirectly through another header file. To make sure
835835
that you don't accidentally forget to include a header file in your module
@@ -857,7 +857,7 @@ your private interface remains private and undisturbed by outsiders.
857857
Use Namespace Qualifiers to Implement Previously Declared Functions
858858
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
859859

860-
When providing an out of line implementation of a function in a source file, do
860+
When providing an out-of-line implementation of a function in a source file, do
861861
not open namespace blocks in the source file. Instead, use namespace qualifiers
862862
to help ensure that your definition matches an existing declaration. Do this:
863863

@@ -1154,7 +1154,7 @@ In general, names should be in camel case (e.g. ``TextFileReader`` and
11541154

11551155
* **Function names** should be verb phrases (as they represent actions), and
11561156
command-like function should be imperative. The name should be camel case,
1157-
and start with a lower-case letter (e.g. ``openFile()`` or ``isFoo()``).
1157+
and start with a lowercase letter (e.g. ``openFile()`` or ``isFoo()``).
11581158

11591159
* **Enum declarations** (e.g. ``enum Foo {...}``) are types, so they should
11601160
follow the naming conventions for types. A common use for enums is as a
@@ -1179,7 +1179,7 @@ In general, names should be in camel case (e.g. ``TextFileReader`` and
11791179
};
11801180

11811181
As an exception, classes that mimic STL classes can have member names in STL's
1182-
style of lower-case words separated by underscores (e.g. ``begin()``,
1182+
style of lowercase words separated by underscores (e.g. ``begin()``,
11831183
``push_back()``, and ``empty()``). Classes that provide multiple
11841184
iterators should add a singular prefix to ``begin()`` and ``end()``
11851185
(e.g. ``global_begin()`` and ``use_begin()``).
@@ -1417,7 +1417,7 @@ please write the loop in the first form and add a comment indicating that you
14171417
did it intentionally.
14181418

14191419
Why do we prefer the second form (when correct)? Writing the loop in the first
1420-
form has two problems. First it may be less efficient than evaluating it at the
1420+
form has two problems. First, it may be less efficient than evaluating it at the
14211421
start of the loop. In this case, the cost is probably minor --- a few extra
14221422
loads every time through the loop. However, if the base expression is more
14231423
complex, then the cost can rise quickly. I've seen loops where the end

0 commit comments

Comments
 (0)