[PATCH] D57960: [Support] Fix TempFile::discard to not leave behind temporary files
Rui Ueyama via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 11 10:58:13 PST 2019
ruiu added inline comments.
================
Comment at: lib/Support/Path.cpp:1137
+
std::error_code RemoveEC;
// On windows closing will remove the file.
----------------
Now the rest of the code is virtuall a no-op on Windows, so you can wrap it entirely with an ifdef like this, which should improve readability.
#ifdef _WIN32
// On windows closing will remove the file.
TmpName = ""
return Error::success();
#else
std::error_code RemoveEC;
// Always try to close and remove.
if (!TmpName.empty()) {
RemoveEC = fs::remove(TmpName);
sys::DontRemoveFileOnSignal(TmpName);
}
if (!RemoveEC)
TmpName = "";
return errorCodeToError(RemoveEC);
#endif
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D57960/new/
https://reviews.llvm.org/D57960
More information about the llvm-commits
mailing list