r229815 - Revert adding hostname to module hash

Ben Langmuir blangmuir at apple.com
Wed Feb 18 20:03:57 PST 2015


Author: benlangmuir
Date: Wed Feb 18 22:03:57 2015
New Revision: 229815

URL: http://llvm.org/viewvc/llvm-project?rev=229815&view=rev
Log:
Revert adding hostname to module hash

I didn't realize how easily the hostname could change - for example just
changing wireless networks seems to prompt it in some cases.

Users can always set their own local module cache path to avoid this.

This reverts commits r228592, 228594, 228601 and 228613.
rdar://19287368

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=229815&r1=229814&r2=229815&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Wed Feb 18 22:03:57 2015
@@ -39,9 +39,6 @@
 #include <memory>
 #include <sys/stat.h>
 #include <system_error>
-#if LLVM_ON_UNIX
-#include <unistd.h> // for gethostname()
-#endif
 using namespace clang;
 
 //===----------------------------------------------------------------------===//
@@ -2028,20 +2025,6 @@ 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[0] = 0;
-  if (gethostname(hostname, 255) == 0) {
-    // Forcibly null-terminate the result, since POSIX doesn't require that
-    // truncation result in an error or that truncated names be null-terminated.
-    hostname[sizeof(hostname)-1] = 0;
-    code = hash_combine(code, StringRef(hostname));
-  }
-  // Ignore failures in gethostname() by not including the hostname in the hash.
-#endif
-
   return llvm::APInt(64, code).toString(36, /*Signed=*/false);
 }
 





More information about the cfe-commits mailing list