/// The list of plugins to load.
std::vector<std::string> Plugins;
+ /// \brief The list of module map files to load before processing the input.
+ std::vector<std::string> ModuleMapFiles;
+
/// \brief The list of additional prebuilt module files to load before
/// processing the input.
std::vector<std::string> ModuleFiles;
/// of computing the module hash.
llvm::SetVector<std::string> ModulesIgnoreMacros;
- /// \brief The set of user-provided module-map-files.
- llvm::SetVector<std::string> ModuleMapFiles;
-
/// \brief The set of user-provided virtual filesystem overlay files.
std::vector<std::string> VFSOverlayFiles;
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
Opts.ASTDumpLookups = Args.hasArg(OPT_ast_dump_lookups);
Opts.UseGlobalModuleIndex = !Args.hasArg(OPT_fno_modules_global_index);
Opts.GenerateGlobalModuleIndex = Opts.UseGlobalModuleIndex;
+ Opts.ModuleMapFiles = Args.getAllArgValues(OPT_fmodule_map_file);
Opts.ModuleFiles = Args.getAllArgValues(OPT_fmodule_file);
Opts.CodeCompleteOpts.IncludeMacros
StringRef MacroDef = (*it)->getValue();
Opts.ModulesIgnoreMacros.insert(MacroDef.split('=').first);
}
- std::vector<std::string> ModuleMapFiles =
- Args.getAllArgValues(OPT_fmodule_map_file);
- Opts.ModuleMapFiles.insert(ModuleMapFiles.begin(), ModuleMapFiles.end());
// Add -I..., -F..., and -index-header-map options in order.
bool IsIndexHeaderMap = false;
ArrayRef<std::pair<const FileEntry *, const DirectoryEntry *>> Includers,
SmallVectorImpl<char> *SearchPath, SmallVectorImpl<char> *RelativePath,
ModuleMap::KnownHeader *SuggestedModule, bool SkipCache) {
- if (!HSOpts->ModuleMapFiles.empty()) {
- // Preload all explicitly specified module map files. This enables modules
- // map files lying in a directory structure separate from the header files
- // that they describe. These cannot be loaded lazily upon encountering a
- // header file, as there is no other known mapping from a header file to its
- // module map file.
- for (const auto &Filename : HSOpts->ModuleMapFiles)
- if (const FileEntry *File = FileMgr.getFile(Filename))
- loadModuleMapFile(File, /*IsSystem=*/false);
- HSOpts->ModuleMapFiles.clear();
- }
-
if (SuggestedModule)
*SuggestedModule = ModuleMap::KnownHeader();