[PATCH] D65545: Handle some fs::remove failures

Jan Korous via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 1 15:19:03 PDT 2019


jkorous added inline comments.


================
Comment at: clang/lib/Frontend/PrecompiledPreamble.cpp:107-111
 TemporaryFiles::~TemporaryFiles() {
   llvm::MutexGuard Guard(Mutex);
   for (const auto &File : Files)
-    llvm::sys::fs::remove(File.getKey());
+    if (std::error_code EC = llvm::sys::fs::remove(File.getKey()))
+      llvm::report_fatal_error("failed removing file \"" + File.getKey() + "\": " + EC.message());
----------------
vsapsai wrote:
> Clangd uses `PrecompiledPreamble` but not `TemporaryFiles` as far as I can tell. `report_fatal_error` can be really disruptive for clangd, so it would be good to get an opinion from somebody working on it if this change would impact them.
Since client code in general might have different error handling/reporting strategy and can't do much about failure in destructor here, I'd consider just some kind of logging or assert here. 



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65545/new/

https://reviews.llvm.org/D65545





More information about the llvm-commits mailing list