r228592 - Add the hostname to the module hash to avoid sharing between hosts
Ben Langmuir
blangmuir at apple.com
Mon Feb 9 11:23:08 PST 2015
Author: benlangmuir
Date: Mon Feb 9 13:23:08 2015
New Revision: 228592
URL: http://llvm.org/viewvc/llvm-project?rev=228592&view=rev
Log:
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.
Modified:
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=228592&r1=228591&r2=228592&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Mon Feb 9 13:23:08 2015
@@ -2021,6 +2021,16 @@ std::string CompilerInvocation::getModul
}
}
+#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);
}
More information about the cfe-commits
mailing list