[clang] e7a8dd9 - [docs] [C++20] [Modules] Mentioning Module Initializer

Chuanqi Xu via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 18 01:12:48 PDT 2024


Author: Chuanqi Xu
Date: 2024-04-18T16:12:14+08:00
New Revision: e7a8dd9b0d419403fe1d8adeb177a4ec78e036cc

URL: https://github.com/llvm/llvm-project/commit/e7a8dd9b0d419403fe1d8adeb177a4ec78e036cc
DIFF: https://github.com/llvm/llvm-project/commit/e7a8dd9b0d419403fe1d8adeb177a4ec78e036cc.diff

LOG: [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.

Added: 
    

Modified: 
    clang/docs/StandardCPlusPlusModules.rst

Removed: 
    


################################################################################
diff  --git a/clang/docs/StandardCPlusPlusModules.rst b/clang/docs/StandardCPlusPlusModules.rst
index 8d5529d5d37db5..ee57fb5da64857 100644
--- a/clang/docs/StandardCPlusPlusModules.rst
+++ b/clang/docs/StandardCPlusPlusModules.rst
@@ -483,6 +483,13 @@ violations with the flag enabled.
 ABI Impacts
 -----------
 
+This section describes the new ABI changes brought by modules.
+
+Only Itanium C++ ABI related change are mentioned
+
+Mangling Names
+~~~~~~~~~~~~~~
+
 The declarations in a module unit which are not in the global module fragment have new linkage names.
 
 For example,
@@ -520,6 +527,23 @@ is attached to the global module fragments. For example:
 
 Now the linkage name of ``NS::foo()`` will be ``_ZN2NS3fooEv``.
 
+Module Initializers
+~~~~~~~~~~~~~~~~~~~
+
+All the importable module units are required to emit an initializer function.
+The initializer function should contain calls to importing modules first and
+all the dynamic-initializers in the current module unit then.
+
+Translation units explicitly or implicitly importing named modules must call
+the initializer functions of the imported named modules within the sequence of
+the dynamic-initializers in the TU. Initializations of entities at namespace
+scope are appearance-ordered. This (recursively) extends into imported modules
+at the point of appearance of the import declaration.
+
+It is allowed to omit calls to importing modules if it is known empty.
+
+It is allowed to omit calls to importing modules for which is known to be called.
+
 Reduced BMI
 -----------
 


        


More information about the cfe-commits mailing list