[clang] 7adf384 - [docs] [C++20] [Modules] Remove the section 'Source content consistency'

Chuanqi Xu via cfe-commits cfe-commits at lists.llvm.org
Tue May 9 19:01:49 PDT 2023


Author: Chuanqi Xu
Date: 2023-05-10T09:59:50+08:00
New Revision: 7adf3849e40e0b9faa3512874e2a1dc4cf86387a

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

LOG: [docs] [C++20] [Modules] Remove the section 'Source content consistency'

Since the C++20 named modules won't check source files consistency after
5b388f8, it would be better to remove this section in the document.

Added: 
    

Modified: 
    clang/docs/StandardCPlusPlusModules.rst

Removed: 
    


################################################################################
diff  --git a/clang/docs/StandardCPlusPlusModules.rst b/clang/docs/StandardCPlusPlusModules.rst
index a59a3edbbbac..ee8ffe9ec8c9 100644
--- a/clang/docs/StandardCPlusPlusModules.rst
+++ b/clang/docs/StandardCPlusPlusModules.rst
@@ -461,109 +461,6 @@ Note that **currently** the compiler doesn't consider inconsistent macro definit
 Currently Clang would accept the above example. But it may produce surprising results if the
 debugging code depends on consistent use of ``NDEBUG`` also in other translation units.
 
-Source content consistency
-^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-When the compiler reads a BMI, the compiler will check the consistency of the corresponding
-source files. For example:
-
-.. code-block:: c++
-
-  // M.cppm
-  export module M;
-  export template <class T>
-  T foo(T t) {
-    return t;
-  }
-
-  // Use.cpp
-  import M;
-  void bar() {
-    foo(5);
-  }
-
-.. code-block:: console
-
-  $ clang++ -std=c++20 M.cppm --precompile -o M.pcm
-  $ rm M.cppm
-  $ clang++ -std=c++20 Use.cpp -fmodule-file=M=M.pcm
-
-The compiler would reject the example since the compiler failed to find the source file to check the consistency.
-So the following example would be rejected too.
-
-.. code-block:: console
-
-  $ clang++ -std=c++20 M.cppm --precompile -o M.pcm
-  $ echo "int i=0;" >> M.cppm
-  $ clang++ -std=c++20 Use.cpp -fmodule-file=M=M.pcm
-
-The compiler would reject it too since the compiler detected the file was changed.
-
-But it is OK to move the BMI as long as the source files remain:
-
-.. code-block:: console
-
-  $ clang++ -std=c++20 M.cppm --precompile -o M.pcm
-  $ mkdir -p tmp
-  $ mv M.pcm tmp/M.pcm
-  $ clang++ -std=c++20 Use.cpp -fmodule-file=M=tmp/M.pcm
-
-The above example would be accepted.
-
-If the user doesn't want to follow the consistency requirement due to some reasons (e.g., distributing BMI),
-the user could try to use ``-Xclang -fmodules-embed-all-files`` when producing BMI. For example:
-
-.. code-block:: console
-
-  $ clang++ -std=c++20 M.cppm --precompile -Xclang -fmodules-embed-all-files -o M.pcm
-  $ rm M.cppm
-  $ clang++ -std=c++20 Use.cpp -fmodule-file=M=M.pcm
-
-Now the compiler would accept the above example.
-Important note: Xclang options are intended to be used by compiler internally and its semantics
-are not guaranteed to be preserved in future versions.
-
-Also the compiler will record the path to the header files included in the global module fragment and compare the
-headers when imported. For example,
-
-.. code-block:: c++
-
-  // foo.h
-  #include <iostream>
-  void Hello() {
-    std::cout << "Hello World.\n";
-  }
-
-  // foo.cppm
-  module;
-  #include "foo.h"
-  export module foo;
-  export using ::Hello;
-
-  // Use.cpp
-  import foo;
-  int main() {
-    Hello();
-  }
-
-Then it is problematic if we remove ``foo.h`` before import `foo` module.
-
-.. code-block:: console
-
-  $ clang++ -std=c++20 foo.cppm --precompile  -o foo.pcm
-  $ mv foo.h foo.orig.h
-  # The following one is rejected
-  $ clang++ -std=c++20 Use.cpp -fmodule-file=foo=foo.pcm -c
-
-The above case will rejected. And we're still able to workaround it by ``-Xclang -fmodules-embed-all-files`` option:
-
-.. code-block:: console
-
-  $ clang++ -std=c++20 foo.cppm --precompile  -Xclang -fmodules-embed-all-files -o foo.pcm
-  $ mv foo.h foo.orig.h
-  $ clang++ -std=c++20 Use.cpp -fmodule-file=foo=foo.pcm -c -o Use.o
-  $ clang++ Use.o foo.pcm
-
 ABI Impacts
 -----------
 


        


More information about the cfe-commits mailing list