Skip to content

Commit c834120

Browse files
kazutakahiratagithub-actions[bot]
authored andcommitted
Automerge: [clang] Proofread LanguageExtensions.rst (#165082)
2 parents afdc557 + 5113ca0 commit c834120

File tree

1 file changed

+38
-38
lines changed

1 file changed

+38
-38
lines changed

clang/docs/LanguageExtensions.rst

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Feature Checking Macros
3232
=======================
3333

3434
Language extensions can be very useful, but only if you know you can depend on
35-
them. In order to allow fine-grain features checks, we support three builtin
35+
them. In order to allow fine-grained feature checks, we support three builtin
3636
function-like macros. This allows you to directly test for a feature in your
3737
code without having to resort to something like autoconf or fragile "compiler
3838
version checks".
@@ -137,7 +137,7 @@ feature) or 0 if not. They can be used like this:
137137
.. _langext-has-feature-back-compat:
138138

139139
For backward compatibility, ``__has_feature`` can also be used to test
140-
for support for non-standardized features, i.e. features not prefixed ``c_``,
140+
for support for non-standardized features, i.e., features not prefixed ``c_``,
141141
``cxx_`` or ``objc_``.
142142

143143
Another use of ``__has_feature`` is to check for compiler features not related
@@ -159,7 +159,7 @@ of ``cxx_rvalue_references``.
159159

160160
This function-like macro is available in C++20 by default, and is provided as an
161161
extension in earlier language standards. It takes a single argument that is the
162-
name of a double-square-bracket-style attribute. The argument can either be a
162+
name of a double-square-bracket-style attribute. The argument can be either a
163163
single identifier or a scoped identifier. If the attribute is supported, a
164164
nonzero value is returned. If the attribute is a standards-based attribute, this
165165
macro returns a nonzero value based on the year and month in which the attribute
@@ -320,7 +320,7 @@ To test for this feature, use ``#if defined(__has_include)``:
320320

321321
.. code-block:: c++
322322

323-
// To avoid problem with non-clang compilers not having this macro.
323+
// To avoid problems with non-clang compilers not having this macro.
324324
#if defined(__has_include)
325325
#if __has_include("myinclude.h")
326326
# include "myinclude.h"
@@ -345,7 +345,7 @@ or 0 otherwise:
345345
# include_next "myinclude.h"
346346
#endif
347347

348-
// To avoid problem with non-clang compilers not having this macro.
348+
// To avoid problems with non-clang compilers not having this macro.
349349
#if defined(__has_include_next)
350350
#if __has_include_next("myinclude.h")
351351
# include_next "myinclude.h"
@@ -361,7 +361,7 @@ absolute path is used in the file argument.
361361
-----------------
362362

363363
This function-like macro takes a string literal that represents a command line
364-
option for a warning and returns true if that is a valid warning option.
364+
option for a warning and returns ``true`` if that is a valid warning option.
365365

366366
.. code-block:: c++
367367

@@ -396,7 +396,7 @@ Builtin Macros
396396
file.
397397

398398
``__clang__``
399-
Defined when compiling with Clang
399+
Defined when compiling with Clang.
400400

401401
``__clang_major__``
402402
Defined to the major marketing version number of Clang (e.g., the 2 in
@@ -599,7 +599,7 @@ NEON vector types are created using ``neon_vector_type`` and
599599

600600
GCC vector types are created using the ``vector_size(N)`` attribute. The
601601
argument ``N`` specifies the number of bytes that will be allocated for an
602-
object of this type. The size has to be multiple of the size of the vector
602+
object of this type. The size has to be a multiple of the size of the vector
603603
element type. For example:
604604

605605
.. code-block:: c++
@@ -620,7 +620,7 @@ element type. For example:
620620
Boolean Vectors
621621
---------------
622622

623-
Clang also supports the ext_vector_type attribute with boolean element types in
623+
Clang also supports the ``ext_vector_type`` attribute with boolean element types in
624624
C and C++. For example:
625625

626626
.. code-block:: c++
@@ -674,7 +674,7 @@ Vector Literals
674674

675675
Vector literals can be used to create vectors from a set of scalars, or
676676
vectors. Either parentheses or braces form can be used. In the parentheses
677-
form the number of literal values specified must be one, i.e. referring to a
677+
form the number of literal values specified must be one, i.e., referring to a
678678
scalar value, or must match the size of the vector type being created. If a
679679
single scalar literal value is specified, the scalar literal value will be
680680
replicated to all the components of the vector type. In the brackets form any
@@ -725,12 +725,12 @@ address &v[i] no no no [#]_ no no
725725

726726
See also :ref:`langext-__builtin_shufflevector`, :ref:`langext-__builtin_convertvector`.
727727

728-
.. [#] ternary operator(?:) has different behaviors depending on condition
729-
operand's vector type. If the condition is a GNU vector (i.e. __vector_size__),
728+
.. [#] ternary operator(?:) has different behaviors depending on the condition
729+
operand's vector type. If the condition is a GNU vector (i.e., ``__vector_size__``),
730730
a NEON vector or an SVE vector, it's only available in C++ and uses normal bool
731731
conversions (that is, != 0).
732732
If it's an extension (OpenCL) vector, it's only available in C and OpenCL C.
733-
And it selects based on signedness of the condition operands (OpenCL v1.1 s6.3.9).
733+
And it selects based on the signedness of the condition operands (OpenCL v1.1 s6.3.9).
734734
.. [#] sizeof can only be used on vector length specific SVE types.
735735
.. [#] Clang does not allow the address of an element to be taken while GCC
736736
allows this. This is intentional for vectors with a boolean element type and
@@ -747,7 +747,7 @@ to perform additional operations on certain scalar and vector types.
747747
Let ``T`` be one of the following types:
748748

749749
* an integer type (as in C23 6.2.5p22), but excluding enumerated types and ``bool``
750-
* the standard floating types float or double
750+
* the standard floating types ``float`` or ``double``
751751
* a half-precision floating point type, if one is supported on the target
752752
* a vector type.
753753

@@ -833,7 +833,7 @@ of different sizes and signs is forbidden in binary and ternary builtins.
833833
T __builtin_elementwise_canonicalize(T x) return the platform specific canonical encoding floating point types
834834
of a floating-point number
835835
T __builtin_elementwise_copysign(T x, T y) return the magnitude of x with the sign of y. floating point types
836-
T __builtin_elementwise_fmod(T x, T y) return The floating-point remainder of (x/y) whose sign floating point types
836+
T __builtin_elementwise_fmod(T x, T y) return the floating-point remainder of (x/y) whose sign floating point types
837837
matches the sign of x.
838838
T __builtin_elementwise_max(T x, T y) return x or y, whichever is larger integer and floating point types
839839
For floating point types, follows semantics of maxNum
@@ -948,7 +948,7 @@ Let ``VT`` be a vector type and ``ET`` the element type of ``VT``.
948948

949949
Each builtin accesses memory according to a provided boolean mask. These are
950950
provided as ``__builtin_masked_load`` and ``__builtin_masked_store``. The first
951-
argument is always boolean mask vector. The ``__builtin_masked_load`` builtin
951+
argument is always a boolean mask vector. The ``__builtin_masked_load`` builtin
952952
takes an optional third vector argument that will be used for the result of the
953953
masked-off lanes. These builtins assume the memory is unaligned, use
954954
``__builtin_assume_aligned`` if alignment is desired.
@@ -1109,7 +1109,7 @@ to ``float``; see below for more information on this emulation.
11091109

11101110
``__fp16`` and ``_Float16`` both use the binary16 format from IEEE
11111111
754-2008, which provides a 5-bit exponent and an 11-bit significand
1112-
(counting the implicit leading 1). ``__bf16`` uses the `bfloat16
1112+
(including the implicit leading 1). ``__bf16`` uses the `bfloat16
11131113
<https://en.wikipedia.org/wiki/Bfloat16_floating-point_format>`_ format,
11141114
which provides an 8-bit exponent and an 8-bit significand; this is the same
11151115
exponent range as `float`, just with greatly reduced precision.
@@ -1143,7 +1143,7 @@ types with the ``-ffloat16-excess-precision=`` and
11431143

11441144
* ``none``: meaning to perform strict operation-by-operation emulation
11451145
* ``standard``: meaning that excess precision is permitted under the rules
1146-
described in the standard, i.e. never across explicit casts or statements
1146+
described in the standard, i.e., never across explicit casts or statements
11471147
* ``fast``: meaning that excess precision is permitted whenever the
11481148
optimizer sees an opportunity to avoid truncations; currently this has no
11491149
effect beyond ``standard``
@@ -1899,7 +1899,7 @@ Type Trait Primitives
18991899

19001900
Type trait primitives are special builtin constant expressions that can be used
19011901
by the standard C++ library to facilitate or simplify the implementation of
1902-
user-facing type traits in the <type_traits> header.
1902+
user-facing type traits in the ``<type_traits>`` header.
19031903

19041904
They are not intended to be used directly by user code because they are
19051905
implementation-defined and subject to change -- as such they're tied closely to
@@ -2054,7 +2054,7 @@ The following type trait primitives are supported by Clang. Those traits marked
20542054
* ``__is_volatile`` (C++, Embarcadero)
20552055
* ``__reference_binds_to_temporary(T, U)`` (Clang): Determines whether a
20562056
reference of type ``T`` bound to an expression of type ``U`` would bind to a
2057-
materialized temporary object. If ``T`` is not a reference type the result
2057+
materialized temporary object. If ``T`` is not a reference type, the result
20582058
is false. Note this trait will also return false when the initialization of
20592059
``T`` from ``U`` is ill-formed.
20602060
Deprecated, use ``__reference_constructs_from_temporary``.
@@ -2182,7 +2182,7 @@ Prior to clang-16, the output may only be used safely when the indirect
21822182
branches are not taken. Query for this difference with
21832183
``__has_extension(gnu_asm_goto_with_outputs_full)``.
21842184

2185-
When using tied-outputs (i.e. outputs that are inputs and outputs, not just
2185+
When using tied-outputs (i.e., outputs that are inputs and outputs, not just
21862186
outputs) with the `+r` constraint, there is a hidden input that's created
21872187
before the label, so numeric references to operands must account for that.
21882188

@@ -2361,7 +2361,7 @@ Loading from a ``__weak`` variable always implicitly retains the
23612361
loaded value. In non-ARC modes, this retain is normally balanced
23622362
by an implicit autorelease. This autorelease can be suppressed
23632363
by performing the load in the receiver position of a ``-retain``
2364-
message send (e.g. ``[weakReference retain]``); note that this performs
2364+
message send (e.g., ``[weakReference retain]``); note that this performs
23652365
only a single retain (the retain done when primitively loading from
23662366
the weak reference).
23672367
@@ -2562,7 +2562,7 @@ When a method that's introduced in the OS newer than the target OS is called, a
25622562
.. code-block:: objc
25632563
25642564
void my_fun(NSSomeClass* var) {
2565-
// If fancyNewMethod was added in e.g. macOS 10.12, but the code is
2565+
// If fancyNewMethod was added in e.g., macOS 10.12, but the code is
25662566
// built with -mmacos-version-min=10.11, then this unconditional call
25672567
// will emit a -Wunguarded-availability warning:
25682568
[var fancyNewMethod];
@@ -2725,7 +2725,7 @@ correctly in any circumstances. It can be used if:
27252725
metaprogramming algorithms to be able to specify/detect types generically.
27262726
27272727
- the generated kernel binary does not contain indirect calls because they
2728-
are eliminated using compiler optimizations e.g. devirtualization.
2728+
are eliminated using compiler optimizations e.g., devirtualization.
27292729
27302730
- the selected target supports the function pointer like functionality e.g.
27312731
most CPU targets.
@@ -2755,12 +2755,12 @@ Extension Specification, section 1.2
27552755
<https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_Ext.html#extensions-overview>`_.
27562756
27572757
This is not conformant behavior and it can only be used portably when the
2758-
functions with variadic prototypes do not get generated in binary e.g. the
2758+
functions with variadic prototypes do not get generated in binary e.g., the
27592759
variadic prototype is used to specify a function type with any number of
27602760
arguments in metaprogramming algorithms in C++ for OpenCL.
27612761
27622762
This extension can also be used when the kernel code is intended for targets
2763-
supporting the variadic arguments e.g. majority of CPU targets.
2763+
supporting the variadic arguments e.g., majority of CPU targets.
27642764
27652765
**Example of Use**:
27662766
@@ -5170,8 +5170,8 @@ __builtin_amdgcn_fence
51705170
51715171
``__builtin_amdgcn_fence`` emits a fence.
51725172
5173-
* ``unsigned`` atomic ordering, e.g. ``__ATOMIC_ACQUIRE``
5174-
* ``const char *`` synchronization scope, e.g. ``workgroup``
5173+
* ``unsigned`` atomic ordering, e.g., ``__ATOMIC_ACQUIRE``
5174+
* ``const char *`` synchronization scope, e.g., ``workgroup``
51755175
* Zero or more ``const char *`` address spaces names.
51765176
51775177
The address spaces arguments must be one of the following string literals:
@@ -5205,7 +5205,7 @@ boolean argument as a bit for every lane of the current wave that is currently
52055205
active (i.e., that is converged with the executing thread), and a 0 bit for
52065206
every lane that is not active.
52075207
5208-
The result is uniform, i.e. it is the same in every active thread of the wave.
5208+
The result is uniform, i.e., it is the same in every active thread of the wave.
52095209
52105210
__builtin_amdgcn_inverse_ballot_w{32,64}
52115211
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -5374,7 +5374,7 @@ followed by ``off`` or ``on``.
53745374
53755375
All function definitions in the region between an ``off`` and the following
53765376
``on`` will be decorated with the ``optnone`` attribute unless doing so would
5377-
conflict with explicit attributes already present on the function (e.g. the
5377+
conflict with explicit attributes already present on the function (e.g., the
53785378
ones that control inlining).
53795379
53805380
.. code-block:: c++
@@ -5472,12 +5472,12 @@ provides options for vectorization, interleaving, predication, unrolling and
54725472
distribution. Loop hints can be specified before any loop and will be ignored if
54735473
the optimization is not safe to apply.
54745474
5475-
There are loop hints that control transformations (e.g. vectorization, loop
5475+
There are loop hints that control transformations (e.g., vectorization, loop
54765476
unrolling) and there are loop hints that set transformation options (e.g.
54775477
``vectorize_width``, ``unroll_count``). Pragmas setting transformation options
5478-
imply the transformation is enabled, as if it was enabled via the corresponding
5479-
transformation pragma (e.g. ``vectorize(enable)``). If the transformation is
5480-
disabled (e.g. ``vectorize(disable)``), that takes precedence over
5478+
imply the transformation is enabled, as if it were enabled via the corresponding
5479+
transformation pragma (e.g., ``vectorize(enable)``). If the transformation is
5480+
disabled (e.g., ``vectorize(disable)``), that takes precedence over
54815481
transformations option pragmas implying that transformation.
54825482
54835483
Vectorization, Interleaving, and Predication
@@ -5704,7 +5704,7 @@ operation when supported by the target.
57045704
The pragma can take three values: ``on``, ``fast`` and ``off``. The ``on``
57055705
option is identical to using ``#pragma STDC FP_CONTRACT(ON)`` and it allows
57065706
fusion as specified the language standard. The ``fast`` option allows fusion
5707-
in cases when the language standard does not make this possible (e.g. across
5707+
in cases when the language standard does not make this possible (e.g., across
57085708
statements in C).
57095709
57105710
.. code-block:: c++
@@ -5859,14 +5859,14 @@ and ``ignore_denormal_mode``, each optionally prefixed with ``no_``. The meaning
58595859
are as follows:
58605860
58615861
- ``remote_memory`` means atomic operations may be performed on remote
5862-
memory, i.e. memory accessed through off-chip interconnects (e.g., PCIe).
5862+
memory, i.e., memory accessed through off-chip interconnects (e.g., PCIe).
58635863
On ROCm platforms using HIP, remote memory refers to memory accessed via
58645864
PCIe and is subject to specific atomic operation support. See
58655865
`ROCm PCIe Atomics <https://rocm.docs.amd.com/en/latest/conceptual/
58665866
pcie-atomics.html>`_ for further details. Prefixing with ``no_remote_memory`` indicates that
58675867
atomic operations should not be performed on remote memory.
58685868
- ``fine_grained_memory`` means atomic operations may be performed on fine-grained
5869-
memory, i.e. memory regions that support fine-grained coherence, where updates to
5869+
memory, i.e., memory regions that support fine-grained coherence, where updates to
58705870
memory are visible to other parts of the system even while modifications are ongoing.
58715871
For example, in HIP, fine-grained coherence ensures that host and device share
58725872
up-to-date data without explicit synchronization (see
@@ -6088,7 +6088,7 @@ match rules are specified after the attribute. The compiler expects an
60886088
identifier that corresponds to the subject set specifier. The ``apply_to``
60896089
specifier is currently the only supported subject set specifier. It allows you
60906090
to specify match rules that form a subset of the attribute's allowed subject
6091-
set, i.e. the compiler doesn't require all of the attribute's subjects. For
6091+
set, i.e., the compiler doesn't require all of the attribute's subjects. For
60926092
example, an attribute like ``[[nodiscard]]`` whose subject set includes
60936093
``enum``, ``record`` and ``hasType(functionType)``, requires the presence of at
60946094
least one of these rules after ``apply_to``:

0 commit comments

Comments
 (0)