[llvm] [unittest] Allow getting a C string from the TempDir helper class
authorSergej Jaskiewicz <jaskiewiczs@icloud.com>
Tue, 8 Sep 2020 22:53:01 +0000 (01:53 +0300)
committerSergej Jaskiewicz <jaskiewiczs@icloud.com>
Tue, 8 Sep 2020 22:53:15 +0000 (01:53 +0300)
commite7b40c5492e5c4b182df421892136d2ee6868124
tree47b547efd6ce2ff9f303b1bb1ae905f3768439c6
parent844e94a5026eea19f1f8091121ad05684f28d047
[llvm] [unittest] Allow getting a C string from the TempDir helper class

The TempDir.path() member function returns a StringRef. We've been
calling the data() method on that StringRef, which does not guarantee
to return a null-terminated string (required by chdir and other POSIX
functions).

Introduce the c_str() method in the TempDir class, which returns the
proper string without the need to create a copy of the path at use site.
llvm/include/llvm/Testing/Support/SupportHelpers.h
llvm/unittests/Support/LockFileManagerTest.cpp