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

Bruno Cardoso Lopes via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 5 20:15:25 PDT 2019


bruno added a comment.

Thanks for working on this JF!



================
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());
----------------
jfb wrote:
> jkorous wrote:
> > 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. 
> > 
> I changed it to `dbgs()`.
This probably means we won't see the message in a non-debug build, right?


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