For PR789:
Make the sys::Path::getFileStatus function more efficient by having it
return a pointer to the FileStatus structure rather than copy it. Adjust
uses of the function accordingly. Also, fix some memory issues in sys::Path.
llvm-svn: 35476
diff --git a/llvm/lib/System/Win32/Signals.inc b/llvm/lib/System/Win32/Signals.inc
index 0c93b22..8adf767 100644
--- a/llvm/lib/System/Win32/Signals.inc
+++ b/llvm/lib/System/Win32/Signals.inc
@@ -101,8 +101,10 @@
// RemoveDirectoryOnSignal - The public API
bool sys::RemoveDirectoryOnSignal(const sys::Path& path, std::string* ErrMsg) {
// Not a directory?
- sys::FileStatus Status;
- if (path.getFileStatus(Status) || !Status.isDir) {
+ const sys::FileStatus *Status = path.getFileStatus(false, ErrMsg);
+ if (!Status)
+ return true;
+ if (!Status->isDir) {
if (ErrMsg)
*ErrMsg = path.toString() + " is not a directory";
return true;