================
@@ -1607,9 +1609,19 @@ void ASTWriter::WriteControlBlock(Preprocessor &PP, 
StringRef isysroot) {
       AddStringBlob(M.ModuleName, Record, Blob);
       Record.push_back(M.StandardCXXModule);
 
-      // We don't want to hard code the information about imported modules
-      // in the C++20 named modules.
-      if (M.StandardCXXModule) {
+      // We don't want to hard code file information for C++20 Modules
+      // (including explicitly mapped header units).
+      const Module *ImportedModule =
+          PP.getHeaderSearchInfo().getModuleMap().findModule(M.ModuleName);
+      bool IsPrebuiltHeaderUnit =
+          ImportedModule && ImportedModule->isHeaderUnit() &&
+          M.Kind == MK_PrebuiltModule &&
+          HSOpts.PrebuiltModuleFiles.count(M.ModuleName);
+
+      bool HasFileInfo = !M.StandardCXXModule && !IsPrebuiltHeaderUnit;
----------------
mpark wrote:

I see. Okay, I'm going to update this PR to use 
`IsCXX20ModuleOrPrebuiltHeaderUnit`.

> And it is not the official mechanism for header units. If you're talking 
> about the doc, I've mentioned the interfaces for HU is experimental.

Ah, gotcha. Okay. I'm planning to give that some more thought. We have a very 
unnecessarily convoluted setup internally to workaround this, and agree that it 
could/should be much simpler/cleaner.

https://github.com/llvm/llvm-project/pull/235597
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to