aboutsummaryrefslogtreecommitdiff
path: root/lib/Driver/Tools.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2013-02-07 19:01:24 +0000
committerDouglas Gregor <dgregor@apple.com>2013-02-07 19:01:24 +0000
commit953a61f26bf79932b9699b09add4c388764de170 (patch)
tree2afb54515a5a8c129a0f985e8ef4568bee1e00cb /lib/Driver/Tools.cpp
parented4330bc159b8311080d03caacac9a8cbf42370c (diff)
Rename -fmodule-cache-path <blah> to -fmodules-cache-path=<blah> for consistency.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174645 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/Tools.cpp')
-rw-r--r--lib/Driver/Tools.cpp36
1 files changed, 19 insertions, 17 deletions
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index 7932ba2827..0da8ba421d 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -414,24 +414,7 @@ void Clang::AddPreprocessingOptions(Compilation &C,
CmdArgs.push_back(C.getArgs().MakeArgString(sysroot));
}
}
-
- // If a module path was provided, pass it along. Otherwise, use a temporary
- // directory.
- if (Arg *A = Args.getLastArg(options::OPT_fmodule_cache_path)) {
- A->claim();
- A->render(Args, CmdArgs);
- } else {
- 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));
- }
- // Pass through all -fmodules-ignore-macro arguments.
- Args.AddAllArgs(CmdArgs, options::OPT_fmodules_ignore_macro);
-
// Parse additional include paths from environment variables.
// FIXME: We should probably sink the logic for handling these from the
// frontend into the driver. It will allow deleting 4 otherwise unused flags.
@@ -2719,6 +2702,25 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
}
}
+ // If a module path was provided, pass it along. Otherwise, use a temporary
+ // directory.
+ if (Arg *A = Args.getLastArg(options::OPT_fmodules_cache_path)) {
+ A->claim();
+ if (HaveModules) {
+ A->render(Args, CmdArgs);
+ }
+ } else if (HaveModules) {
+ SmallString<128> DefaultModuleCache;
+ llvm::sys::path::system_temp_directory(/*erasedOnReboot=*/false,
+ DefaultModuleCache);
+ llvm::sys::path::append(DefaultModuleCache, "clang-module-cache");
+ CmdArgs.push_back("-fmodules-cache-path");
+ CmdArgs.push_back(Args.MakeArgString(DefaultModuleCache));
+ }
+
+ // Pass through all -fmodules-ignore-macro arguments.
+ Args.AddAllArgs(CmdArgs, options::OPT_fmodules_ignore_macro);
+
// -fmodules-autolink (on by default when modules is enabled) automatically
// links against libraries for imported modules.
if (HaveModules &&