This was basically benign resource leak on Unix, but on Windows
it could cause builds to fail because opened file descriptor
prevents other processes from moving or removing the file.
llvm-svn: 222799
#include "lld/Core/Pass.h"
#include "llvm/ADT/StringRef.h"
+#if !defined(_MSC_VER) && !defined(__MINGW32__)
+#include <unistd.h>
+#else
+#include <io.h>
+#endif
+
namespace lld {
namespace pecoff {
int fd;
if (llvm::sys::fs::openFileForWrite(path, fd, llvm::sys::fs::F_Append))
llvm::report_fatal_error("failed to create a PDB file");
+ ::close(fd);
}
PECOFFLinkingContext &_ctx;