Skip to content

Commit e7a8dd9

Browse files
committed
[docs] [C++20] [Modules] Mentioning Module Initializer
Although we want to treat the module initializer as a transparent concept to users, but it shows that people need to understand the concept to understand how to understand and distribute modules. So it is better to mention this too.
1 parent 03e841c commit e7a8dd9

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

clang/docs/StandardCPlusPlusModules.rst

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,13 @@ violations with the flag enabled.
483483
ABI Impacts
484484
-----------
485485

486+
This section describes the new ABI changes brought by modules.
487+
488+
Only Itanium C++ ABI related change are mentioned
489+
490+
Mangling Names
491+
~~~~~~~~~~~~~~
492+
486493
The declarations in a module unit which are not in the global module fragment have new linkage names.
487494

488495
For example,
@@ -520,6 +527,23 @@ is attached to the global module fragments. For example:
520527

521528
Now the linkage name of ``NS::foo()`` will be ``_ZN2NS3fooEv``.
522529

530+
Module Initializers
531+
~~~~~~~~~~~~~~~~~~~
532+
533+
All the importable module units are required to emit an initializer function.
534+
The initializer function should contain calls to importing modules first and
535+
all the dynamic-initializers in the current module unit then.
536+
537+
Translation units explicitly or implicitly importing named modules must call
538+
the initializer functions of the imported named modules within the sequence of
539+
the dynamic-initializers in the TU. Initializations of entities at namespace
540+
scope are appearance-ordered. This (recursively) extends into imported modules
541+
at the point of appearance of the import declaration.
542+
543+
It is allowed to omit calls to importing modules if it is known empty.
544+
545+
It is allowed to omit calls to importing modules for which is known to be called.
546+
523547
Reduced BMI
524548
-----------
525549

0 commit comments

Comments
 (0)