From 250172a851a886c0763b5fd61c20bf21791c21e9 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Thu, 7 Feb 2013 22:59:12 +0000 Subject: [PATCH] Form the default -fmodules-cache-path= properly. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174674 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Driver/Compilation.cpp | 2 +- lib/Driver/Tools.cpp | 4 +++- test/Modules/driver.c | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/Driver/Compilation.cpp b/lib/Driver/Compilation.cpp index 86e617211f..df904f06b7 100644 --- a/lib/Driver/Compilation.cpp +++ b/lib/Driver/Compilation.cpp @@ -111,7 +111,7 @@ static bool skipArg(const char *Flag, bool &SkipNextArg) { bool Res = llvm::StringSwitch(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) diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 0da8ba421d..77c7d2270b 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -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)); } diff --git a/test/Modules/driver.c b/test/Modules/driver.c index 20aac0015c..0a787b996a 100644 --- a/test/Modules/driver.c +++ b/test/Modules/driver.c @@ -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"}} -- 2.50.1