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 | f936f782f5cfb0e5ab045b8fa5d48f573d3b9e89 (patch) | |
tree | 06d5c36eec3bc1d49e3d7e3ff07058a046350949 /clang/lib/Driver/Tools.cpp | |
parent | 123dc70c503bf6ddb68b20ee1a47bc4726f975fc (diff) | |
download | bcm5719-llvm-f936f782f5cfb0e5ab045b8fa5d48f573d3b9e89.tar.gz bcm5719-llvm-f936f782f5cfb0e5ab045b8fa5d48f573d3b9e89.zip |
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.
llvm-svn: 139726
Diffstat (limited to 'clang/lib/Driver/Tools.cpp')
-rw-r--r-- | clang/lib/Driver/Tools.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index 691e96cb115..28a14a29703 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/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. |