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

Volodymyr Sapsai via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 21 15:32:18 PDT 2025


================
@@ -3311,12 +3314,11 @@ ASTReader::ReadControlBlock(ModuleFile &F,
                                                    SignatureBytes.end());
         Blob = Blob.substr(ASTFileSignature::size);
 
-        if (ImportedFile.empty()) {
-          // Use BaseDirectoryAsWritten to ensure we use the same path in the
-          // ModuleCache as when writing.
-          ImportedFile =
-              ReadPathBlob(BaseDirectoryAsWritten, Record, Idx, Blob);
-        }
+        // Use BaseDirectoryAsWritten to ensure we use the same path in the
+        // ModuleCache as when writing.
+        StoredFile = ReadPathBlob(BaseDirectoryAsWritten, Record, Idx, Blob);
----------------
vsapsai wrote:

Looks like we are writing the path blob unconditionally
https://github.com/llvm/llvm-project/blob/7810d8484413ae64029c93f8dfc43f77b0ba98c3/clang/lib/Serialization/ASTWriter.cpp#L1610

So it should be OK to read it unconditionally too.

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


More information about the cfe-commits mailing list