================
@@ -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, when I read the PR I was wondering what is "HasFileInfo" until I read the
current position. If the name is `IsCXX20ModuleOrHeaderUnit ` or anything like
that , I think I can understand this more easily as a code reader. The reason
why I want it is, the major reason we did that (omit the PCM file info for
C++20 modules) is because we decide it in the high level. It is not because
other reasons so that we have to do it. It is just our decision for C++20
modules. So I want it.
So I prefer a name like `IsCXX20ModuleOrHeaderUnit`
https://github.com/llvm/llvm-project/pull/235597
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits