When building a module consisting of submodules, the preprocessor keeps a "global" state that for each header file tracks (amongst other things) the number of times it was included/imported. This information is serialized into the PCM file.
When importing anything from such module (either the top-level module or any of its submodules), this number is merged into the state of the importing preprocessor.
This can incorrectly prevent imports of textual headers (see attached tests). This patch fixes this bug by making the number of times a header was included more fine-grained and tracks it on per-submodule basis. This information is lazily deserialized when first importing each (sub)module.
(This patch is an alternative approach to the same issue addressed in D104344.)
Depends on D114095.
Looks like this is already dead code? If so, please separate out and commit ahead of time (e.g., now).