[PATCH] D130863: [clangd] Make git ignore index directories

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 6 01:10:14 PDT 2022


kadircet added inline comments.


================
Comment at: clang-tools-extra/clangd/index/BackgroundIndexStorage.cpp:58
+    if (CreatingNewDirectory) {
+      llvm::Error error = addGitignore(DiskShardRoot);
+      if (error) {
----------------
nit:
```
if(llvm::Error E = addGitignore(..)) {
 elog(".."), std::move(E));
}
```

`std::move` is actually important, otherwise destruction of Error on failure state will trigger a crash.


================
Comment at: clang-tools-extra/clangd/index/BackgroundIndexStorage.cpp:94
+  llvm::Error addGitignore(llvm::StringRef Directory) {
+    auto FilePath = getGitignorePathForShardRoot(DiskShardRoot);
+    return llvm::writeFileAtomically(
----------------
we're passing in `Directory` but using `DiskShardRoot` here. can you actually make `addGitignore` a free-function (same as `getGitignorePathForShardRoot`).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130863



More information about the cfe-commits mailing list