From d072eea5d605b4782c9827f5bf8903fa86bd6e5a Mon Sep 17 00:00:00 2001 From: Ben Langmuir Date: Mon, 9 Feb 2015 19:23:08 +0000 Subject: 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 --- clang/lib/Frontend/CompilerInvocation.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'clang/lib/Frontend/CompilerInvocation.cpp') diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index f8d71ac..eef0535 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -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); } -- cgit v1.1