You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: clang/docs/StandardCPlusPlusModules.rst
+22-22Lines changed: 22 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -226,8 +226,8 @@ one-phase compilation model is simpler for build systems to implement while the
226
226
two-phase compilation has the potential to compile faster due to higher
227
227
parallelism. As an example, if there are two module units ``A`` and ``B``, and
228
228
``B`` depends on ``A``, the one-phase compilation model needs to compile them
229
-
serially, whereas the two-phase compilation model is able to be compiled as
230
-
soon as ``A.pcm`` is available, and thus can be compiled simultaneously as the
229
+
serially, whereas the two-phase compilation model can be compiled as
230
+
soon as ``A.pcm`` is available, and thus can be compiled simultaneously with the
231
231
``A.pcm`` to ``A.o`` compilation step.
232
232
233
233
File name requirements
@@ -391,7 +391,7 @@ And the compilation processes for module units are like:
391
391
As the diagrams show, we need to compile the BMI from module units to object
392
392
files and then link the object files. (However, this cannot be done for the BMI
393
393
from header units. See the section on :ref:`header units <header-units>` for
394
-
more details.
394
+
more details.)
395
395
396
396
BMIs cannot be shipped in an archive to create a module library. Instead, the
397
397
BMIs(``*.pcm``) are compiled into object files(``*.o``) and those object files
@@ -403,15 +403,15 @@ clang-cl
403
403
``clang-cl`` supports the same options as ``clang++`` for modules as detailed above;
404
404
there is no need to prefix these options with ``/clang:``. Note that ``cl.exe``
405
405
`options to emit/consume IFC files <https://devblogs.microsoft.com/cppblog/using-cpp-modules-in-msvc-from-the-command-line-part-1/>` are *not* supported.
406
-
The resultant precompiled modules are also not compatible for use with ``cl.exe``.
406
+
The resulting precompiled modules are also not compatible for use with ``cl.exe``.
407
407
408
408
We recommend that build system authors use the above-mentioned ``clang++`` options with ``clang-cl`` to build modules.
409
409
410
410
Consistency Requirements
411
411
~~~~~~~~~~~~~~~~~~~~~~~~
412
412
413
413
Modules can be viewed as a kind of cache to speed up compilation. Thus, like
414
-
other caching techniques, it is important to maintain cache consistency which
414
+
other caching techniques, it is important to maintain cache consistency, which
415
415
is why Clang does very strict checking for consistency.
416
416
417
417
Options consistency
@@ -472,8 +472,8 @@ To overcome these requirements and simplify cases like distributed builds and sa
472
472
builds, users can use the ``-fmodules-embed-all-files`` flag to embed all input files
473
473
into the BMI so that Clang does not need to open the corresponding file on disk.
474
474
475
-
When the ``-fmodules-embed-all-files`` flag are enabled, Clang explicitly emits the source
476
-
code into the BMI file, the contents of the BMI file contain a sufficiently verbose
475
+
When the ``-fmodules-embed-all-files`` flag is enabled, Clang explicitly emits the source
476
+
code into the BMI file; the BMI file contains a sufficiently verbose
477
477
representation to reproduce the original source file.
478
478
479
479
.. [1] Input files: The source files which took part in the compilation of the BMI.
@@ -578,7 +578,7 @@ handle the dynamic initialization of non-inline variables in the module unit.
578
578
The importable module unit has to emit the initializer even if there is no
579
579
dynamic initialization; otherwise, the importer may call a nonexistent
580
580
function. The initializer function emits calls to imported modules first
581
-
followed by calls to all to of the dynamic initializers in the current module
581
+
followed by calls to all of the dynamic initializers in the current module
582
582
unit.
583
583
584
584
Translation units that explicitly or implicitly import a named module must call
@@ -689,17 +689,17 @@ ensure it is reachable, e.g. ``using N::g;``.
689
689
690
690
As of Clang 22.x, the Reduced BMI is enabled by default. You may still want to
691
691
use Full BMI with ``-fno-modules-reduced-bmi`` in the following case:
692
-
1. Your build system uses two-phase compilation but it haven't adjusted the
692
+
1. Your build system uses two-phase compilation, but it hasn't adjusted the
693
693
implementation for reduced BMI.
694
-
2. You meet a regression with Reduced BMI that you cannot work around. Please
694
+
2. You encounter a regression with Reduced BMI that you cannot work around. Please
695
695
report an issue for this case.
696
696
697
697
Experimental Non-Cascading Changes
698
698
----------------------------------
699
699
700
700
This section is primarily for build system vendors. For end compiler users,
701
701
if you don't want to read it all, this is helpful to reduce recompilations.
702
-
We encourage build system vendors and end users try this out and bring feedback.
702
+
We encourage build system vendors and end users to try this out and bring feedback.
703
703
704
704
Before Clang 19, a change in BMI of any (transitive) dependency would cause the
705
705
outputs of the BMI to change. Starting with Clang 19, changes to non-direct
@@ -786,7 +786,7 @@ We encourage build systems to add an experimental mode that
786
786
reuses the cached BMI when **direct** dependencies did not change,
787
787
even if **transitive** dependencies did change.
788
788
789
-
Given there are potential compiler bugs, we recommend that build systems
789
+
Given that there are potential compiler bugs, we recommend that build systems
790
790
support this feature as a configurable option so that users
791
791
can go back to the transitive change mode safely at any time.
792
792
@@ -813,7 +813,7 @@ With reduced BMI, non-cascading changes can be more powerful. For example,
813
813
$ md5sum B.pcm
814
814
6c2bd452ca32ab418bf35cd141b060b9 B.pcm
815
815
816
-
And let's change the implementation for ``A.cppm`` into:
816
+
And let's change the implementation for ``A.cppm`` to:
817
817
818
818
.. code-block:: c++
819
819
@@ -830,7 +830,7 @@ and recompile the example:
830
830
$ md5sum B.pcm
831
831
6c2bd452ca32ab418bf35cd141b060b9 B.pcm
832
832
833
-
We should find the contents of ``B.pcm`` remains the same. In this case, the build system is
833
+
We should find the contents of ``B.pcm`` remain the same. In this case, the build system is
834
834
allowed to skip recompilations of TUs which solely and directly depend on module ``B``.
835
835
836
836
This only happens with a reduced BMI. With reduced BMIs, we won't record the function body
@@ -845,7 +845,7 @@ Reduce duplications
845
845
846
846
While it is valid to have duplicated declarations in the global module fragments
847
847
of different module units, it is not free for Clang to deal with the duplicated
848
-
declarations. A translation unit will compile more slowly if there is a lot of
848
+
declarations. A translation unit will compile more slowly if there are a lot of
849
849
duplicated declarations between the translation unit and modules it imports.
850
850
For example:
851
851
@@ -937,7 +937,7 @@ possible. However, it may be a breaking change for existing code or libraries
937
937
to switch to modules. As a result, many existing libraries need to provide
938
938
both headers and module interfaces for a while to not break existing users.
939
939
940
-
This section suggests some suggestions on how to ease the transition process
940
+
This section provides some suggestions on how to ease the transition process
941
941
for existing libraries. **Note that this information is only intended as
942
942
guidance, rather than as requirements to use modules in Clang.** It presumes
943
943
the project is starting with no module-based dependencies.
@@ -1140,7 +1140,7 @@ module unit which is internal to the module itself.
1140
1140
Providing a header to skip parsing redundant headers
0 commit comments