From: Richard Smith Date: Thu, 24 Jul 2014 03:42:38 +0000 (+0000) Subject: [modules] Slightly expand module semantics documentation. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b9ea932f3ff955a1c3e9efd4ae23b492fc303077;p=clang [modules] Slightly expand module semantics documentation. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@213838 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/docs/Modules.rst b/docs/Modules.rst index ce1e717bc2..112ad4f039 100644 --- a/docs/Modules.rst +++ b/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 ------