When Clang encounters @import M.Private during implicit build, it precompiles module M and looks through its submodules. If the Private submodule is not found, Clang assumes @import M_Private. In the dependency scanner, we don't capture the dependency on M, since it's not imported. It's an affecting module, though: compilation of the import statement will fail when implicit modules are disabled and M is not precompiled and explicitly provided. This patch fixes that.
Depends on D132430.
Not sure if this is a good idea, but have you considered having the scanner provide the module with Foo.Private= syntax instead? It would be nice to keep this hack contained to implicit builds if we can.