diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-09-14 20:28:46 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-09-14 20:28:46 +0000 |
commit | 8ee51ef211bfed9ce04bc93835e19aee014f2fae (patch) | |
tree | 71fcd9134def49dd14c7d8e8e225eb939ef2a643 /lib/Driver/Tools.cpp | |
parent | df8327c28d293cf7c6952b86dba26863235dcc0f (diff) |
Teach the driver to always pass down a module cache path. If none is
supplied, use something derived from the system's temporary
directory. Depends on LLVM r139725.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139726 91177308-0d34-0410-b5e6-96231b3b80d8
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. |