diff options
Diffstat (limited to 'lib/Driver/Tools.cpp')
-rw-r--r-- | lib/Driver/Tools.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 691e96cb11..28a14a2970 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -375,6 +375,21 @@ void Clang::AddPreprocessingOptions(const Driver &D, CmdArgs.push_back(A->getValue(Args)); } } + + // If a module path was provided, pass it along. Otherwise, use a temporary + // directory. + if (Arg *A = Args.getLastArg(options::OPT_fmodule_cache_path)) { + CmdArgs.push_back(A->getValue(Args)); + A->claim(); + A->render(Args, CmdArgs); + } else { + llvm::SmallString<128> DefaultModuleCache; + llvm::sys::path::system_temp_directory(/*erasedOnReboot=*/false, + DefaultModuleCache); + llvm::sys::path::append(DefaultModuleCache, "clang-module-cache"); + CmdArgs.push_back("-fmodule-cache-path"); + CmdArgs.push_back(Args.MakeArgString(DefaultModuleCache)); + } } /// getARMTargetCPU - Get the (LLVM) name of the ARM cpu we are targeting. |