Keep a set of already-included pragma-once files for mods.
Script: -- : 'RUN: at line 1'; rm -rf /mnt/disks/ssd0/agent/workspace/amd64_debian_testing_clang8/build/tools/clang/test/Modules/Output/header-in-imported-module.c.tmp
Script: -- : 'RUN: at line 4'; mkdir -p /mnt/disks/ssd0/agent/workspace/amd64_debian_testing_clang8/build/tools/clang/test/PCH/Output/include-timestamp.cpp.tmp-dir
I suspect we also need to support saving/loading some of this information in the serialized AST, e.g. clang/lib/Serialization/ASTWriter.cpp has code to save the HeaderInfo data, around line 1650. And around line 2174, code to save the macros per submodule. We'll also need to save the pragma-once-header-state per-submodule too, I think.
I don't think whether the header you're trying to include is modular or not (isModuleHeader) should matter here, just whether we have a current module M or not.
I wonder if this should be just using the CurSubmoduleState. Actually, is "M" even needed in this function at all -- why isn't everything just using CurSubmoduleState? (It's very likely I'm just confused about what the semantics of this are...).
Yes - I think so because if we're looking at Module header, then I *think* the header's content will/should be visible to the submods in it.
On the other hand (ie., the else branch), if we're looking a "regular" header, then it should not be visible to the submods