[cfe-commits] r139726 - in /cfe/trunk: include/clang/Driver/CC1Options.td include/clang/Driver/Options.td lib/Driver/Tools.cpp
Douglas Gregor
dgregor at apple.com
Wed Sep 14 13:28:46 PDT 2011
Author: dgregor
Date: Wed Sep 14 15:28:46 2011
New Revision: 139726
URL: http://llvm.org/viewvc/llvm-project?rev=139726&view=rev
Log:
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.
Modified:
cfe/trunk/include/clang/Driver/CC1Options.td
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/lib/Driver/Tools.cpp
Modified: cfe/trunk/include/clang/Driver/CC1Options.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1Options.td?rev=139726&r1=139725&r2=139726&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/CC1Options.td (original)
+++ cfe/trunk/include/clang/Driver/CC1Options.td Wed Sep 14 15:28:46 2011
@@ -605,7 +605,7 @@
HelpText<"Disable standard #include directories for the C++ standard library">;
def nobuiltininc : Flag<"-nobuiltininc">,
HelpText<"Disable builtin #include directories">;
-def fmodule_cache_path : JoinedOrSeparate<"-fmodule-cache-path">,
+def fmodule_cache_path : Separate<"-fmodule-cache-path">,
MetaVarName<"<directory>">,
HelpText<"Specify the module cache path">;
def fdisable_module_hash : Flag<"-fdisable-module-hash">,
Modified: cfe/trunk/include/clang/Driver/Options.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=139726&r1=139725&r2=139726&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Wed Sep 14 15:28:46 2011
@@ -342,6 +342,8 @@
def fms_extensions : Flag<"-fms-extensions">, Group<f_Group>;
def fmsc_version : Joined<"-fmsc-version=">, Group<f_Group>;
def fdelayed_template_parsing : Flag<"-fdelayed-template-parsing">, Group<f_Group>;
+def fmodule_cache_path : Separate<"-fmodule-cache-path">, Group<i_Group>,
+ Flags<[NoForward]>;
def fmudflapth : Flag<"-fmudflapth">, Group<f_Group>;
def fmudflap : Flag<"-fmudflap">, Group<f_Group>;
def fnested_functions : Flag<"-fnested-functions">, Group<f_Group>;
Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=139726&r1=139725&r2=139726&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Wed Sep 14 15:28:46 2011
@@ -375,6 +375,21 @@
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.
More information about the cfe-commits
mailing list