diff options
Diffstat (limited to 'clang/lib/Frontend')
-rw-r--r-- | clang/lib/Frontend/CompilerInstance.cpp | 17 | ||||
-rw-r--r-- | clang/lib/Frontend/CompilerInvocation.cpp | 22 | ||||
-rw-r--r-- | clang/lib/Frontend/FrontendActions.cpp | 4 |
3 files changed, 10 insertions, 33 deletions
diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp index 9a4bcc2722e..84d837d4883 100644 --- a/clang/lib/Frontend/CompilerInstance.cpp +++ b/clang/lib/Frontend/CompilerInstance.cpp @@ -1641,14 +1641,6 @@ CompilerInstance::loadModule(SourceLocation ImportLoc, } else if (ModuleName == getLangOpts().CurrentModule) { // This is the module we're building. Module = PP->getHeaderSearchInfo().lookupModule(ModuleName); - /// FIXME: perhaps we should (a) look for a module using the module name - // to file map (PrebuiltModuleFiles) and (b) diagnose if still not found? - //if (Module == nullptr) { - // getDiagnostics().Report(ModuleNameLoc, diag::err_module_not_found) - // << ModuleName; - // ModuleBuildFailed = true; - // return ModuleLoadResult(); - //} Known = KnownModules.insert(std::make_pair(Path[0].first, Module)).first; } else { // Search for a module with the given name. @@ -1670,17 +1662,16 @@ CompilerInstance::loadModule(SourceLocation ImportLoc, } // Try to load the module from the prebuilt module path. - if (Source == ModuleNotFound && (!HSOpts.PrebuiltModuleFiles.empty() || - !HSOpts.PrebuiltModulePaths.empty())) { - ModuleFileName = - PP->getHeaderSearchInfo().getPrebuiltModuleFileName(ModuleName); + if (Source == ModuleNotFound && !HSOpts.PrebuiltModulePaths.empty()) { + ModuleFileName = PP->getHeaderSearchInfo().getModuleFileName( + ModuleName, "", /*UsePrebuiltPath*/ true); if (!ModuleFileName.empty()) Source = PrebuiltModulePath; } // Try to load the module from the module cache. if (Source == ModuleNotFound && Module) { - ModuleFileName = PP->getHeaderSearchInfo().getCachedModuleFileName(Module); + ModuleFileName = PP->getHeaderSearchInfo().getModuleFileName(Module); Source = ModuleCache; } diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index f9dafbb88ea..2cc93c1f13d 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -1009,12 +1009,9 @@ static void ParseDependencyOutputArgs(DependencyOutputOptions &Opts, // They won't be discovered by the regular preprocessor, so // we let make / ninja to know about this implicit dependency. Opts.ExtraDeps = Args.getAllArgValues(OPT_fdepfile_entry); - // Only the -fmodule-file=<file> form. - for (const Arg *A : Args.filtered(OPT_fmodule_file)) { - StringRef Val = A->getValue(); - if (Val.find('=') == StringRef::npos) - Opts.ExtraDeps.push_back(Val); - } + auto ModuleFiles = Args.getAllArgValues(OPT_fmodule_file); + Opts.ExtraDeps.insert(Opts.ExtraDeps.end(), ModuleFiles.begin(), + ModuleFiles.end()); } static bool parseShowColorsArgs(const ArgList &Args, bool DefaultColor) { @@ -1343,12 +1340,7 @@ static InputKind ParseFrontendArgs(FrontendOptions &Opts, ArgList &Args, Opts.UseGlobalModuleIndex = !Args.hasArg(OPT_fno_modules_global_index); Opts.GenerateGlobalModuleIndex = Opts.UseGlobalModuleIndex; Opts.ModuleMapFiles = Args.getAllArgValues(OPT_fmodule_map_file); - // Only the -fmodule-file=<file> form. - for (const Arg *A : Args.filtered(OPT_fmodule_file)) { - StringRef Val = A->getValue(); - if (Val.find('=') == StringRef::npos) - Opts.ModuleFiles.push_back(Val); - } + Opts.ModuleFiles = Args.getAllArgValues(OPT_fmodule_file); Opts.ModulesEmbedFiles = Args.getAllArgValues(OPT_fmodules_embed_file_EQ); Opts.ModulesEmbedAllFiles = Args.hasArg(OPT_fmodules_embed_all_files); Opts.IncludeTimestamps = !Args.hasArg(OPT_fno_pch_timestamp); @@ -1552,12 +1544,6 @@ static void ParseHeaderSearchArgs(HeaderSearchOptions &Opts, ArgList &Args, Opts.ModuleCachePath = P.str(); Opts.ModuleUserBuildPath = Args.getLastArgValue(OPT_fmodules_user_build_path); - // Only the -fmodule-file=<name>=<file> form. - for (const Arg *A : Args.filtered(OPT_fmodule_file)) { - StringRef Val = A->getValue(); - if (Val.find('=') != StringRef::npos) - Opts.PrebuiltModuleFiles.insert(Val.split('=')); - } for (const Arg *A : Args.filtered(OPT_fprebuilt_module_path)) Opts.AddPrebuiltModulePath(A->getValue()); Opts.DisableModuleHash = Args.hasArg(OPT_fdisable_module_hash); diff --git a/clang/lib/Frontend/FrontendActions.cpp b/clang/lib/Frontend/FrontendActions.cpp index 3e3483d2c6b..d42400183a4 100644 --- a/clang/lib/Frontend/FrontendActions.cpp +++ b/clang/lib/Frontend/FrontendActions.cpp @@ -185,8 +185,8 @@ GenerateModuleFromModuleMapAction::CreateOutputFile(CompilerInstance &CI, HeaderSearch &HS = CI.getPreprocessor().getHeaderSearchInfo(); CI.getFrontendOpts().OutputFile = - HS.getCachedModuleFileName(CI.getLangOpts().CurrentModule, - ModuleMapFile); + HS.getModuleFileName(CI.getLangOpts().CurrentModule, ModuleMapFile, + /*UsePrebuiltPath=*/false); } // We use createOutputFile here because this is exposed via libclang, and we |