diff options
author | Bruno Cardoso Lopes <bruno.cardoso@gmail.com> | 2017-12-22 02:53:30 +0000 |
---|---|---|
committer | Bruno Cardoso Lopes <bruno.cardoso@gmail.com> | 2017-12-22 02:53:30 +0000 |
commit | aea3aa183d985a708064e1d60e0353c993ada5f0 (patch) | |
tree | 933eb98209698af0bed49e7c6cd3f8239d4fb72a /docs | |
parent | a7a99b6b14f3d75a330e0443cedcedda3f948ed8 (diff) |
[Modules] Change private modules rules and warnings
We used to advertise private modules to be declared as submodules
(Foo.Private). This has proven to not scale well since private headers
might carry several dependencies, introducing unwanted content into the
main module and often causing dep cycles.
Change the canonical way to name it to Foo_Private, forcing private
modules as top level ones, and provide warnings under -Wprivate-module
to suggest fixes for other private naming. Update documentation to
reflect that.
rdar://problem/31173501
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@321337 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'docs')
-rw-r--r-- | docs/Modules.rst | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/docs/Modules.rst b/docs/Modules.rst index 757be61913..2fa38be6f4 100644 --- a/docs/Modules.rst +++ b/docs/Modules.rst @@ -859,10 +859,12 @@ express this with a single module map file in the library: module Foo { header "Foo.h" - - explicit module Private { - header "Foo_Private.h" - } + ... + } + + module Foo_Private { + header "Foo_Private.h" + ... } @@ -873,7 +875,7 @@ build machinery. Private module map files, which are named ``module.private.modulemap`` (or, for backward compatibility, ``module_private.map``), allow one to -augment the primary module map file with an additional submodule. For +augment the primary module map file with an additional modules. For example, we would split the module map file above into two module map files: @@ -883,9 +885,9 @@ files: module Foo { header "Foo.h" } - + /* module.private.modulemap */ - explicit module Foo.Private { + module Foo_Private { header "Foo_Private.h" } @@ -899,13 +901,12 @@ boundaries. When writing a private module as part of a *framework*, it's recommended that: -* Headers for this module are present in the ``PrivateHeaders`` - framework subdirectory. -* The private module is defined as a *submodule* of the public framework (if - there's one), similar to how ``Foo.Private`` is defined in the example above. -* The ``explicit`` keyword should be used to guarantee that its content will - only be available when the submodule itself is explicitly named (through a - ``@import`` for example). +* Headers for this module are present in the ``PrivateHeaders`` framework + subdirectory. +* The private module is defined as a *top level module* with the name of the + public framework prefixed, like ``Foo_Private`` above. Clang has extra logic + to work with this naming, using ``FooPrivate`` or ``Foo.Private`` (submodule) + trigger warnings and might not work as expected. Modularizing a Platform ======================= |