ilya-biryukov added inline comments.

================
Comment at: clangd/index/BackgroundIndexStorage.cpp:42
+  llvm::Twine TempPath(OutPath, ".tmp.");
+  TempPath.concat(std::to_string(rand()));
+  std::error_code EC;
----------------
There's a helper in LLVM that will do this, `llvm::createUniqueFile()`, I 
believe it also tries multiple times in case of clashes.


================
Comment at: clangd/index/BackgroundIndexStorage.cpp:55
+  // Then move to real location.
+  EC = llvm::sys::fs::rename(TempPath, OutPath);
+  if (EC)
----------------
We **should not** remove if no error occurred, as the same name at this point 
can be taken by a different action.


Repository:
  rCTE Clang Tools Extra

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

https://reviews.llvm.org/D55417



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to