From f89e492349b569614a1ddfbc40f85bc6434c1c65 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Thu, 24 Jul 2014 03:42:38 +0000 Subject: [PATCH] [modules] Slightly expand module semantics documentation. llvm-svn: 213838 --- clang/docs/Modules.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/clang/docs/Modules.rst b/clang/docs/Modules.rst index ce1e717..112ad4f 100644 --- a/clang/docs/Modules.rst +++ b/clang/docs/Modules.rst @@ -208,7 +208,7 @@ Modules are modeled as if each submodule were a separate translation unit, and a .. note:: - This behavior is currently only approximated when building a module. Entities within a submodule that has already been built are visible when building later submodules in that module. This can lead to fragile modules that depend on the build order used for the submodules of the module, and should not be relied upon. + This behavior is currently only approximated when building a module with submodules. Entities within a submodule that has already been built are visible when building later submodules in that module. This can lead to fragile modules that depend on the build order used for the submodules of the module, and should not be relied upon. This behavior is subject to change. As an example, in C, this implies that if two structs are defined in different submodules with the same name, those two types are distinct types (but may be *compatible* types if their definitions match. In C++, two structs defined with the same name in different submodules are the *same* type, and must be equivalent under C++'s One Definition Rule. @@ -216,6 +216,8 @@ As an example, in C, this implies that if two structs are defined in different s Clang currently only performs minimal checking for violations of the One Definition Rule. +If any submodule of a module is imported into any part of a program, the entire top-level module is considered to be part of the program. As a consequence of this, Clang may diagnose conflicts between an entity declared in an unimported submodule and an entity declared in the current translation unit, and Clang may inline or devirtualize based on knowledge from unimported submodules. + Macros ------ -- 2.7.4