[PATCH] D102736: Fix tmp files being left on Windows builds.

Adrian McCarthy via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 9 15:32:20 PDT 2021


amccarth added a comment.

Nice catch Reid.



================
Comment at: clang/lib/Frontend/CompilerInstance.cpp:857-858
+      OS.reset(new llvm::raw_fd_ostream(Temp->FD, /*shouldClose=*/false,
+                                        Binary ? llvm::sys::fs::OF_None
+                                               : llvm::sys::fs::OF_Text));
+      OSFile = std::string(TempPath.str());
----------------
rnk wrote:
> I think the bug is here: the third parameter is `bool unbuffered`, not file flags, so we are opening the file for unbuffered writing, and that is really slow.
Yowza!  In addition to a fix, we need some memes.

* Why do we even have that lever?
* This constructor has too many overloads.  Please remove three.
* [Facepalm] `bool` parameters.  [Double facepalm]  Negative `bool` parameter names that default to `false`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102736



More information about the cfe-commits mailing list