[clang] [clang][modules] Support every import syntax in single-module-parse-mode (PR #179610)

Abhishek Kaushik via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 13 00:36:51 PST 2026


================
@@ -1988,6 +1988,23 @@ CompilerInstance::loadModule(SourceLocation ImportLoc,
     // * `Preprocessor::HandleHeaderIncludeOrImport` will never call this
     //   function as the `#include` or `#import` is textual.
 
+    MM.cacheModuleLoad(*Path[0].getIdentifierInfo(), Module);
+  } else if (getPreprocessorOpts().SingleModuleParseMode) {
+    // This mimics how findOrCompileModuleAndReadAST() finds the module.
+    Module = getPreprocessor().getHeaderSearchInfo().lookupModule(
+        ModuleName, ImportLoc, true, !IsInclusionDirective);
+    if (Module) {
+      // Mark the module and its submodules as if they were loaded from a PCM.
+      // This prevents emission of the "missing submodule" diagnostic below.
+      std::vector Worklist{Module};
----------------
abhishek-kaushik22 wrote:

Thanks :)

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


More information about the cfe-commits mailing list