Skip to content

Commit

Permalink
Provide a custom entry for specifying module cache paths
Browse files Browse the repository at this point in the history
This is really handy for use in bots with multiple competing workspaces, for
builds that do not provide an explicit module cache. This is controlled
by the CUSTOM_CLANG_MODULE_CACHE env variable.

export CUSTOM_CLANG_MODULE_CACHE="/tmp/yoyo"
$ echo "int foo()" | clang -x objective-c -fmodules -\#\#\# - 2>&1 | tr " " "\n" | grep "\-cache"
"-fmodules-cache-path=/tmp/yoyo"

rdar://problem/48443680
  • Loading branch information
bcardosolopes authored and shahmishal committed May 3, 2019
1 parent c2ce2ce commit 099ed9c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/Driver/ToolChains/Clang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2651,6 +2651,11 @@ static void RenderBuiltinOptions(const ToolChain &TC, const llvm::Triple &T,
}

void Driver::getDefaultModuleCachePath(SmallVectorImpl<char> &Result) {
if (const char *ModuleCacheStrDir = ::getenv("CUSTOM_CLANG_MODULE_CACHE")) {
Result.append(ModuleCacheStrDir,
ModuleCacheStrDir + strlen(ModuleCacheStrDir));
return;
}
llvm::sys::path::system_temp_directory(/*erasedOnReboot=*/false, Result);
llvm::sys::path::append(Result, "org.llvm.clang.");
appendUserToPath(Result);
Expand Down

0 comments on commit 099ed9c

Please sign in to comment.