[Modules] Change private modules rules and warnings
authorBruno Cardoso Lopes <bruno.cardoso@gmail.com>
Fri, 22 Dec 2017 02:53:30 +0000 (02:53 +0000)
committerBruno Cardoso Lopes <bruno.cardoso@gmail.com>
Fri, 22 Dec 2017 02:53:30 +0000 (02:53 +0000)
commit2972991969b6841b361085d8c0dd0b964ebfd04f
tree772acc3f7a74cae4e3732a2d5b0d62c7c1c7cfa5
parent67885f5d582ade8fc8ba8569e41666b2aeb81b5c
[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

llvm-svn: 321337
29 files changed:
clang/docs/Modules.rst
clang/include/clang/Basic/DiagnosticLexKinds.td
clang/lib/Lex/HeaderSearch.cpp
clang/lib/Lex/ModuleMap.cpp
clang/test/Modules/Inputs/implicit-private-canonical/A.framework/Headers/a.h [new file with mode: 0644]
clang/test/Modules/Inputs/implicit-private-canonical/A.framework/Headers/aprivate.h [moved from clang/test/Modules/Inputs/implicit-private-with-different-name/A.framework/Headers/aprivate.h with 100% similarity]
clang/test/Modules/Inputs/implicit-private-canonical/A.framework/Modules/module.modulemap [new file with mode: 0644]
clang/test/Modules/Inputs/implicit-private-canonical/A.framework/Modules/module.private.modulemap [new file with mode: 0644]
clang/test/Modules/Inputs/implicit-private-canonical/A.framework/PrivateHeaders/aprivate.h [new file with mode: 0644]
clang/test/Modules/Inputs/implicit-private-with-different-name/A.framework/PrivateHeaders/aprivate.h [new file with mode: 0644]
clang/test/Modules/Inputs/implicit-private-with-submodule/A.framework/Headers/a.h [new file with mode: 0644]
clang/test/Modules/Inputs/implicit-private-with-submodule/A.framework/Headers/aprivate.h [new file with mode: 0644]
clang/test/Modules/Inputs/implicit-private-with-submodule/A.framework/Modules/module.modulemap [new file with mode: 0644]
clang/test/Modules/Inputs/implicit-private-with-submodule/A.framework/Modules/module.private.modulemap [new file with mode: 0644]
clang/test/Modules/Inputs/implicit-private-with-submodule/A.framework/PrivateHeaders/aprivate.h [new file with mode: 0644]
clang/test/Modules/add-remove-private.m
clang/test/Modules/auto-module-import.m
clang/test/Modules/global_index.m
clang/test/Modules/implicit-private-canonical.m [new file with mode: 0644]
clang/test/Modules/implicit-private-with-different-name.m
clang/test/Modules/implicit-private-with-submodule.m [new file with mode: 0644]
clang/test/Modules/modulemap-locations.m
clang/test/Modules/prune.m
clang/test/Modules/redefinition-c-tagtypes.m
clang/test/Modules/requires-coroutines.mm
clang/test/Modules/requires.m
clang/test/Modules/requires.mm
clang/test/Modules/subframework-from-intermediate-path.m
clang/test/Modules/subframeworks.m