[PATCH] D50127: [Support] use larger character set for creating unique filenames
Bob Haarman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 31 20:16:57 PDT 2018
inglorion created this revision.
inglorion added reviewers: rnk, pcc, zturner.
Herald added a subscriber: hiraditya.
This changes the character set we use to create unique filenames from
16 characters to 32, which allows more unique filenames to be
generated for the same name length.
https://reviews.llvm.org/D50127
Files:
clang/test/Analysis/diagnostics/plist-multi-file.c
llvm/lib/Support/Path.cpp
llvm/unittests/Support/Path.cpp
Index: llvm/unittests/Support/Path.cpp
===================================================================
--- llvm/unittests/Support/Path.cpp
+++ llvm/unittests/Support/Path.cpp
@@ -703,8 +703,8 @@
}
};
- // We should be able to create exactly 16 temporary files.
- for (int i = 0; i < 16; ++i)
+ // We should be able to create exactly 32 temporary files.
+ for (int i = 0; i < 32; ++i)
EXPECT_TRUE(TryCreateTempFile());
EXPECT_FALSE(TryCreateTempFile());
Index: llvm/lib/Support/Path.cpp
===================================================================
--- llvm/lib/Support/Path.cpp
+++ llvm/lib/Support/Path.cpp
@@ -198,7 +198,8 @@
for (unsigned i = 0, e = ModelStorage.size(); i != e; ++i) {
if (ModelStorage[i] == '%')
ResultPath[i] =
- "0123456789abcdef"[sys::Process::GetRandomNumber() & 15];
+ "0123456789abcdefghijklmnopqrstuv"[sys::Process::GetRandomNumber() &
+ 31];
}
// Try to open + create the file.
Index: clang/test/Analysis/diagnostics/plist-multi-file.c
===================================================================
--- clang/test/Analysis/diagnostics/plist-multi-file.c
+++ clang/test/Analysis/diagnostics/plist-multi-file.c
@@ -199,7 +199,7 @@
// CHECK-NEXT: </dict>
// CHECK-NEXT: <key>HTMLDiagnostics_files</key>
// CHECK-NEXT: <array>
-// CHECK-NEXT: <string>report-{{([0-9a-f]{6})}}.html</string>
+// CHECK-NEXT: <string>report-{{([0-9a-v]{6})}}.html</string>
// CHECK-NEXT: </array>
// CHECK-NEXT: </dict>
// CHECK-NEXT: </array>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50127.158456.patch
Type: text/x-patch
Size: 1604 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180801/06c312ac/attachment.bin>
More information about the llvm-commits
mailing list