================
@@ -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;
----------------
ChuanqiXu9 wrote:

Yeah, what i want is an explicit name. `IsCXX20ModuleOrPrebuiltHeaderUnit` 
looks good.

And for `-fmodule-file=<pcm>`, I don't feel it is good. 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.

We don't have a good model for header units right now. If possible, we should 
just ban that. 

> has eager loading behavior so not really usable in practice

I think you can update the wording in the doc and banning -fmodule-file=<pcm> 
for header units. 

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