[clang] [clang][Modules] Handle relocated modules during implicit module builds (PR #181836)

Jan Svoboda via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 17 09:06:04 PST 2026


================
@@ -1590,6 +1590,13 @@ class ASTReader
   void ParseLineTable(ModuleFile &F, const RecordData &Record);
   llvm::Error ReadSourceManagerBlock(ModuleFile &F);
   SourceLocation getImportLocation(ModuleFile *F);
+
+  /// If a relocation check happened, the optional holds a pointer to the
+  /// discovered Module. The second element determines whether to emit related
+  /// validation errors.
+  using RelocationCheckResult = std::pair<std::optional<Module *>, bool>;
+  RelocationCheckResult checkIfModuleRelocated(ModuleFile &F,
----------------
jansvoboda11 wrote:

This doesn't actually check if a module has been relocated, right? Maybe we should call this something like `getModuleForRelocationChecks()`? It might also be worth explaining the difference between `std::nullopt` and `std::optional(nullptr)` of the first member in the result.

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


More information about the cfe-commits mailing list