[Modules] Change private modules rules and warningsWe used to advertise private modules to be declared as submodules(Foo.Private). This has proven to not scale well since private headersmight car
[Modules] Change private modules rules and warningsWe used to advertise private modules to be declared as submodules(Foo.Private). This has proven to not scale well since private headersmight carry several dependencies, introducing unwanted content into themain module and often causing dep cycles.Change the canonical way to name it to Foo_Private, forcing privatemodules as top level ones, and provide warnings under -Wprivate-moduleto suggest fixes for other private naming. Update documentation toreflect that.rdar://problem/31173501llvm-svn: 321337
show more ...
[modules] Handle modules with nonstandard names in module.private.modulemapsSummary:The module system supports accompanying a primary module (say Foo) withan auxiliary "private" module (defined i
[modules] Handle modules with nonstandard names in module.private.modulemapsSummary:The module system supports accompanying a primary module (say Foo) withan auxiliary "private" module (defined in an adjacent module.private.modulemapfile) that augments the primary module when associated private headers areavailable. The feature is intended to be used to augment the primarymodule with a submodule (say Foo.Private), however some users in the wildare choosing to augment the primary module with an additional top-level modulewith a "similar" name (in all cases so far: FooPrivate).This "works" when a user of the module initially imports a private header,such as '#import "Foo/something_private.h"' since the Foo import winds upimporting FooPrivate in passing. But if the import is subsequently recordedin a PCH file, reloading the PCH will fail to validate because of a cross-checkthat attempts to find the module.modulemap (or module.private.modulemap) usingHeaderSearch algorithm, applied to the "FooPrivate" name. Since it's stored inFoo.framework/Modules, not FooPrivate.framework/Modules, the check fails andthe PCH is rejected.This patch adds a compensatory workaround in the HeaderSearch algorithmwhen searching (and failing to find) a module of the form FooPrivate: thename used to derive filesystem paths is decoupled from the module namebeing searched for, and if the initial search fails and the module isnamed "FooPrivate", the filesystem search name is altered to remove the"Private" suffix, and the algorithm is run a second time (still looking fora module named FooPrivate, but looking in directories derived from Foo).Accompanying this change is a new warning that triggers when a user loadsa module.private.modulemap that defines a top-level module with a differentname from the top-level module defined in its adjacent module.modulemap.Reviewers: doug.gregor, manmanren, brunoSubscribers: bruno, cfe-commitsDifferential Revision: https://reviews.llvm.org/D27852llvm-svn: 290219