[clang] [clang][modules] Minor improvements to diagnosing `out of date` errors (PR #136612)

Cyndy Ishida via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 21 16:32:43 PDT 2025


================
@@ -3349,9 +3351,14 @@ ASTReader::ReadControlBlock(ModuleFile &F,
                                       .getModuleCache()
                                       .getInMemoryModuleCache()
                                       .isPCMFinal(F.FileName);
-      if (isDiagnosedResult(Result, Capabilities) || recompilingFinalized)
+      if (isDiagnosedResult(Result, Capabilities) || recompilingFinalized) {
         Diag(diag::note_module_file_imported_by)
             << F.FileName << !F.ModuleName.empty() << F.ModuleName;
+        if (UseFilemap && !F.ModuleName.empty() && !StoredFile.empty() &&
+            StoredFile != ImportedFile)
----------------
cyndyishida wrote:

It's intentional, but I don't know that I understand why one is better than the other. What's the guideline or expectation here?

I think the note should still be reported if `StoredFile` doesn't exist. Are you thinking that creating a `FileEntry` would handle cases where different paths point to the same file?

https://github.com/llvm/llvm-project/pull/136612


More information about the cfe-commits mailing list