AttachHeaderIncludeGen(*PP, /*ShowAllHeaders=*/false, /*OutputPath=*/"",
/*ShowDepth=*/true, /*MSStyle=*/true);
}
-
- // Load all explictly-specified module map files.
- for (const auto &Filename : getFrontendOpts().ModuleMapFiles) {
- if (auto *File = getFileManager().getFile(Filename))
- PP->getHeaderSearchInfo().loadModuleMapFile(File, /*IsSystem*/false);
- else
- getDiagnostics().Report(diag::err_module_map_not_found) << Filename;
- }
}
// ASTContext
"doesn't support modules");
}
+ // If we were asked to load any module map files, do so now.
+ for (const auto &Filename : CI.getFrontendOpts().ModuleMapFiles) {
+ if (auto *File = CI.getFileManager().getFile(Filename))
+ CI.getPreprocessor().getHeaderSearchInfo().loadModuleMapFile(
+ File, /*IsSystem*/false);
+ else
+ CI.getDiagnostics().Report(diag::err_module_map_not_found) << Filename;
+ }
+
// If we were asked to load any module files, do so now.
for (const auto &ModuleFile : CI.getFrontendOpts().ModuleFiles)
if (!CI.loadModuleFile(ModuleFile))
--- /dev/null
+// RUN: cp %s %t-duplicate.modulemap
+// RUN: not %clang_cc1 -fmodules -fmodules-cache-path=%t -fmodule-map-file=%s -fmodule-map-file=%t-duplicate.modulemap -fsyntax-only -x c++ /dev/null 2>&1 | FileCheck --check-prefix=CHECK-DUPLICATE %s
+
+// PR22299: Ensure we can produce diagnostics for duplicate modules from -fmodule-map-file=.
+//
+// CHECK-DUPLICATE: duplicate.modulemap:[[@LINE+2]]:8: error: redefinition of module 'foo'
+// CHECK-DUPLICATE: diagnostics.modulemap:[[@LINE+1]]:8: note: previously defined here
+module foo {}