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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35476 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/llvmc/CompilerDriver.cpp b/tools/llvmc/CompilerDriver.cpp
index c153df8..3d91ad9 100644
--- a/tools/llvmc/CompilerDriver.cpp
+++ b/tools/llvmc/CompilerDriver.cpp
@@ -195,8 +195,8 @@
void cleanup() {
if (!isSet(KEEP_TEMPS_FLAG)) {
- sys::FileStatus Status;
- if (!TempDir.getFileStatus(Status) && Status.isDir)
+ const sys::FileStatus *Status = TempDir.getFileStatus();
+ if (Status && Status->isDir)
TempDir.eraseFromDisk(/*remove_contents=*/true);
} else {
std::cout << "Temporary files are in " << TempDir << "\n";