aboutsummaryrefslogtreecommitdiff
path: root/lib/Frontend
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Frontend')
-rw-r--r--lib/Frontend/CompilerInstance.cpp8
-rw-r--r--lib/Frontend/CompilerInvocation.cpp9
-rw-r--r--lib/Frontend/InitHeaderSearch.cpp2
3 files changed, 10 insertions, 9 deletions
diff --git a/lib/Frontend/CompilerInstance.cpp b/lib/Frontend/CompilerInstance.cpp
index bd019e0cf2..1106e48e91 100644
--- a/lib/Frontend/CompilerInstance.cpp
+++ b/lib/Frontend/CompilerInstance.cpp
@@ -636,14 +636,8 @@ ModuleKey CompilerInstance::loadModule(SourceLocation ImportLoc,
CurFile = SourceMgr.getFileEntryForID(SourceMgr.getMainFileID());
// Search for a module with the given name.
- std::string Filename = ModuleName.getName().str();
- Filename += ".pcm";
- const DirectoryLookup *CurDir = 0;
const FileEntry *ModuleFile
- = PP->getHeaderSearchInfo().LookupFile(Filename, /*isAngled=*/false,
- /*FromDir=*/0, CurDir, CurFile,
- /*SearchPath=*/0,
- /*RelativePath=*/0);
+ = PP->getHeaderSearchInfo().lookupModule(ModuleName.getName());
if (!ModuleFile) {
getDiagnostics().Report(ModuleNameLoc, diag::err_module_not_found)
<< ModuleName.getName()
diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp
index 7ea31613bd..e7b8854224 100644
--- a/lib/Frontend/CompilerInvocation.cpp
+++ b/lib/Frontend/CompilerInvocation.cpp
@@ -576,6 +576,10 @@ static void HeaderSearchOptsToArgs(const HeaderSearchOptions &Opts,
Res.push_back("-resource-dir");
Res.push_back(Opts.ResourceDir);
}
+ if (!Opts.ModuleCachePath.empty()) {
+ Res.push_back("-fmodule-cache-path");
+ Res.push_back(Opts.ModuleCachePath);
+ }
if (!Opts.UseStandardIncludes)
Res.push_back("-nostdinc");
if (!Opts.UseStandardCXXIncludes)
@@ -1378,7 +1382,8 @@ static void ParseHeaderSearchArgs(HeaderSearchOptions &Opts, ArgList &Args) {
if (const Arg *A = Args.getLastArg(OPT_stdlib_EQ))
Opts.UseLibcxx = (strcmp(A->getValue(Args), "libc++") == 0);
Opts.ResourceDir = Args.getLastArgValue(OPT_resource_dir);
-
+ Opts.ModuleCachePath = Args.getLastArgValue(OPT_fmodule_cache_path);
+
// Add -I..., -F..., and -index-header-map options in order.
bool IsIndexHeaderMap = false;
for (arg_iterator it = Args.filtered_begin(OPT_I, OPT_F,
@@ -1426,7 +1431,7 @@ static void ParseHeaderSearchArgs(HeaderSearchOptions &Opts, ArgList &Args) {
((*it)->getOption().matches(OPT_cxx_isystem) ?
frontend::CXXSystem : frontend::System),
true, false, !(*it)->getOption().matches(OPT_iwithsysroot));
-
+
// FIXME: Need options for the various environment variables!
}
diff --git a/lib/Frontend/InitHeaderSearch.cpp b/lib/Frontend/InitHeaderSearch.cpp
index 08af532267..05152a77b2 100644
--- a/lib/Frontend/InitHeaderSearch.cpp
+++ b/lib/Frontend/InitHeaderSearch.cpp
@@ -1161,5 +1161,7 @@ void clang::ApplyHeaderSearchOptions(HeaderSearch &HS,
if (HSOpts.UseStandardIncludes)
Init.AddDefaultSystemIncludePaths(Lang, Triple, HSOpts);
+ HS.setModuleCachePath(HSOpts.ModuleCachePath);
+
Init.Realize(Lang);
}