If ReadASTBlock does not find the main module, there's something wrong
the with the PCM. Error in that case, to avoid hitting problems further
from the source.
Note that the Swift compiler sometimes finds in
CompilerInstance::loadModule that the main module mysteriously does not
have Module::IsFromModuleFile set. That will emit a confusing
warn_missing_submodule, which was never intended for a top-level module.
The recent audit of error-handling in ReadAST may have rooted out the
real problem. If not, this commit will help to clarify the real
problem, and replace a confusing warning with an error pointing at the
malformed PCM file.
Is this enough? Because this is done at the end of SUBMODULE_DEFINITION, could it be that only some of the submodules were read (top level or not) and this is still going to be true? I wonder if marking this true at the end of successful SUBMODULE_BLOCK instead wouldn't be a better option.