Currently in a PCM file we are storing HeaderSearch state from
building an entire module. This is too coarse because for a non-modular
header isImport == true means it was imported by *some* header in the
module but doesn't capture if this module header is reachable itself. In
practice it can cause code
#import <Framework/Header.h> #import <Unmodularized/Unmodularized.h>
to skip "Unmodularized.h" header because another "Framework/Invisible.h"
imported it. As the result declarations from "Unmodularized.h" aren't
accessible despite direct import.
Fix it by tracking isImport and NumIncludes per submodule including
a header. And on reading AST use the values only for visible submodules.
rdar://64773328
This seems like a very expensive thing to include in HeaderFileInfo, which we may have many thousands of in some compilations. (I have similar concerns about Aliases FWIW.)