Form the default -fmodules-cache-path= properly.

llvm-svn: 174674
This commit is contained in:
Douglas Gregor 2013-02-07 22:59:12 +00:00
parent 08ec0b6117
commit 4bedb499ea
3 changed files with 5 additions and 3 deletions

View File

@ -111,7 +111,7 @@ static bool skipArg(const char *Flag, bool &SkipNextArg) {
bool Res = llvm::StringSwitch<bool>(Flag)
.Cases("-I", "-MF", "-MT", "-MQ", true)
.Cases("-o", "-coverage-file", "-dependency-file", true)
.Cases("-fdebug-compilation-dir", "-fmodule-cache-path", "-idirafter", true)
.Cases("-fdebug-compilation-dir", "-idirafter", true)
.Cases("-include", "-include-pch", "-internal-isystem", true)
.Cases("-internal-externc-isystem", "-iprefix", "-iwithprefix", true)
.Cases("-iwithprefixbefore", "-isysroot", "-isystem", "-iquote", true)

View File

@ -2714,7 +2714,9 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
llvm::sys::path::system_temp_directory(/*erasedOnReboot=*/false,
DefaultModuleCache);
llvm::sys::path::append(DefaultModuleCache, "clang-module-cache");
CmdArgs.push_back("-fmodules-cache-path");
const char Arg[] = "-fmodules-cache-path=";
DefaultModuleCache.insert(DefaultModuleCache.begin(),
Arg, Arg + strlen(Arg));
CmdArgs.push_back(Args.MakeArgString(DefaultModuleCache));
}

View File

@ -1,6 +1,6 @@
// RUN: %clang -fmodules %s -### 2>&1 | FileCheck -check-prefix NO_MODULE_CACHE %s
// RUN: %clang -fmodules -fmodules-cache-path=blarg %s -### 2>&1 | FileCheck -check-prefix WITH_MODULE_CACHE %s
// CHECK-NO_MODULE_CACHE: {{clang.*"-fmodules-cache-path"}}
// CHECK-NO_MODULE_CACHE: {{clang.*"-fmodules-cache-path=.*clang-module-cache"}}
// CHECK-WITH_MODULE_CACHE: {{clang.*"-fmodules-cache-path=blarg"}}