Add the hostname to the module hash to avoid sharing between hosts

Sharing between hosts will cause problems for the LockFileManager, which
can timeout waiting for a process that has already died.

llvm-svn: 228592
This commit is contained in:
Ben Langmuir 2015-02-09 19:23:08 +00:00
parent 38b2591469
commit d072eea5d6
1 changed files with 10 additions and 0 deletions

View File

@ -2021,6 +2021,16 @@ std::string CompilerInvocation::getModuleHash() const {
}
}
#if LLVM_ON_UNIX
// The LockFileManager cannot tell when processes from another host are
// running, so mangle the hostname in to the module hash to separate them.
char hostname[256];
hostname[255] = 0;
hostname[0] = 0;
gethostname(hostname, 255);
code = hash_combine(code, StringRef(hostname));
#endif
return llvm::APInt(64, code).toString(36, /*Signed=*/false);
}