Fix get_temp_file_name() to compile on Windows. Patch from STL@microsoft.com
llvm-svn: 267963
This commit is contained in:
parent
a643eb7ec0
commit
903f1ab93a
|
@ -53,7 +53,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
#if defined(_WIN32) || defined(__MINGW32__)
|
#if defined(_WIN32) || defined(__MINGW32__)
|
||||||
#include <io.h> // _mktemp
|
#include <io.h> // _mktemp_s
|
||||||
#else
|
#else
|
||||||
#include <unistd.h> // close
|
#include <unistd.h> // close
|
||||||
#endif
|
#endif
|
||||||
|
@ -71,11 +71,13 @@ std::string
|
||||||
get_temp_file_name()
|
get_temp_file_name()
|
||||||
{
|
{
|
||||||
#if defined(_WIN32) || defined(__MINGW32__)
|
#if defined(_WIN32) || defined(__MINGW32__)
|
||||||
char Path[MAX_PATH+1];
|
char Name[] = "libcxx.XXXXXX";
|
||||||
char FN[MAX_PATH+1];
|
|
||||||
do { } while (0 == GetTempPath(MAX_PATH+1, Path));
|
if (_mktemp_s(Name, sizeof(Name)) != 0) {
|
||||||
do { } while (0 == GetTempFileName(Path, "libcxx", 0, FN));
|
abort();
|
||||||
return FN;
|
}
|
||||||
|
|
||||||
|
return Name;
|
||||||
#else
|
#else
|
||||||
std::string Name;
|
std::string Name;
|
||||||
int FD = -1;
|
int FD = -1;
|
||||||
|
|
Loading…
Reference in New Issue