Add a convenience createUniqueDirectory function.
There are a few valid situation where we care about the structure inside a
directory, but not about the directory itself. A simple example is for unit
testing directory traversal.
PathV1 had a function like this, add one to V2 and port existing users of the
created temp file and delete it hack to using it.
llvm-svn: 185059
diff --git a/llvm/unittests/Support/FileOutputBufferTest.cpp b/llvm/unittests/Support/FileOutputBufferTest.cpp
index c7ca1ab..5e87319 100644
--- a/llvm/unittests/Support/FileOutputBufferTest.cpp
+++ b/llvm/unittests/Support/FileOutputBufferTest.cpp
@@ -30,12 +30,8 @@
// Create unique temporary directory for these tests
SmallString<128> TestDirectory;
{
- int fd;
ASSERT_NO_ERROR(
- fs::unique_file("FileOutputBuffer-test-%%-%%-%%-%%/dir", fd,
- TestDirectory));
- ::close(fd);
- TestDirectory = path::parent_path(TestDirectory);
+ fs::createUniqueDirectory("FileOutputBuffer-test", TestDirectory));
}
// TEST 1: Verify commit case.