[llvm-branch-commits] [llvm-branch] r128202 - in /llvm/branches/release_29: ./ lib/Support/Windows/Path.inc

Bill Wendling isanbard at gmail.com
Wed Mar 23 23:17:12 PDT 2011


Author: void
Date: Thu Mar 24 01:17:12 2011
New Revision: 128202

URL: http://llvm.org/viewvc/llvm-project?rev=128202&view=rev
Log:
--- Merging r127723 into '.':
U    lib/Support/Windows/Path.inc


Modified:
    llvm/branches/release_29/   (props changed)
    llvm/branches/release_29/lib/Support/Windows/Path.inc

Propchange: llvm/branches/release_29/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Mar 24 01:17:12 2011
@@ -1,2 +1,2 @@
 /llvm/branches/Apple/Pertwee:110850,110961
-/llvm/trunk:127241,127263-127264,127298,127325,127328,127350-127351,127441,127464,127780,127858,127871,127981,128041,128100,128194-128197
+/llvm/trunk:127241,127263-127264,127298,127325,127328,127350-127351,127441,127464,127723,127780,127858,127871,127981,128041,128100,128194-128197

Modified: llvm/branches/release_29/lib/Support/Windows/Path.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_29/lib/Support/Windows/Path.inc?rev=128202&r1=128201&r2=128202&view=diff
==============================================================================
--- llvm/branches/release_29/lib/Support/Windows/Path.inc (original)
+++ llvm/branches/release_29/lib/Support/Windows/Path.inc Thu Mar 24 01:17:12 2011
@@ -882,7 +882,17 @@
   // Find a numeric suffix that isn't used by an existing file.  Assume there
   // won't be more than 1 million files with the same prefix.  Probably a safe
   // bet.
-  static unsigned FCounter = 0;
+  static int FCounter = -1;
+  if (FCounter < 0) {
+    // Give arbitrary initial seed.
+    // FIXME: We should use sys::fs::unique_file() in future.
+    LARGE_INTEGER cnt64;
+    DWORD x = GetCurrentProcessId();
+    x = (x << 16) | (x >> 16);
+    if (QueryPerformanceCounter(&cnt64))    // RDTSC
+      x ^= cnt64.HighPart ^ cnt64.LowPart;
+    FCounter = x % 1000000;
+  }
   do {
     sprintf(FNBuffer+offset, "-%06u", FCounter);
     if (++FCounter > 999999)





More information about the llvm-branch-commits mailing list