[clang] [clang][modules] Introduce a flag to keep redundant module lookups on relocation checks (PR #219107)

Volodymyr Sapsai via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 27 10:58:24 PDT 2026


================
@@ -3230,10 +3225,13 @@ ASTReader::getModuleForRelocationChecks(ModuleFile &F, bool DirectoryCheck) {
   // session.
   auto [EnablesBSValidation, WasValidated] =
       wasValidatedInBuildSession(F, HSOpts);
-  if (WasValidated)
-    return {std::nullopt, IgnoreError};
-  if (EnablesBSValidation &&
-      static_cast<uint64_t>(F.ModTime) >= HSOpts.BuildSessionTimestamp)
+  const bool SkipModuleLookup =
+      !PP.getPreprocessorOpts().ModulesForceRedundantLookup &&
+      (WasValidated ||
+       (EnablesBSValidation &&
+        static_cast<uint64_t>(F.ModTime) >= HSOpts.BuildSessionTimestamp));
----------------
vsapsai wrote:

Unrelated: I would expect this check to happen in `wasValidatedInBuildSession` based on the naming. But that's not the point of your change, so it's not blocking, merely a drive-by comment.

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


More information about the cfe-commits mailing list