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
This commit is contained in:
Douglas Gregor 2011-09-14 20:28:46 +00:00
Родитель df8327c28d
Коммит 8ee51ef211
3 изменённых файлов: 18 добавлений и 1 удалений

Просмотреть файл

@ -605,7 +605,7 @@ def nostdincxx : Flag<"-nostdinc++">,
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">,

Просмотреть файл

@ -342,6 +342,8 @@ def fmessage_length_EQ : Joined<"-fmessage-length=">, Group<f_Group>;
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>;

Просмотреть файл

@ -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.