[PATCH] D92198: [clangd] Log remote index connectivity status

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 15 06:01:29 PST 2020


sammccall accepted this revision.
sammccall added a comment.
This revision is now accepted and ready to land.

LG with one fix around the atomic



================
Comment at: clang-tools-extra/clangd/index/remote/Client.cpp:49
+    auto NewStatus = Channel->GetState(/*try_to_connect=*/false);
+    if (ConnectionStatus != NewStatus)
+      vlog("Remote index connection [{0}]: {1} => {2}", ServerAddress,
----------------
you access ConnectionStatus twice, and have a race between them.

```
auto OldStatus = ConnectionStatus.exchange(NewStatus);
if (OldStatus != NewStatus)
  log(...)
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D92198



More information about the cfe-commits mailing list