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

Cyndy Ishida via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 27 12:02:56 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));
----------------
cyndyishida wrote:

It's techincally different since it's checking if the PCM was built in the session, not validated, but I agree it should be folded together generally. I can look into that in a different patch. 

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


More information about the cfe-commits mailing list