[PATCH] D96856: [clangd] Narrow and document a loophole in blockUntilIdle

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 17 03:59:35 PST 2021


sammccall created this revision.
sammccall added a reviewer: kadircet.
Herald added subscribers: usaxena95, arphaman.
sammccall requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay, ilya-biryukov.
Herald added a project: clang.

blockUntilIdle of a parent can't always be correctly implemented as

  return ChildA.blockUntilIdle() && ChildB.blockUntilIdle()

The problem is that B can schedule work on A while we're waiting on it.

I believe this is theoretically possible today between CDB and background index.
Modules open more possibilities and it's hard to reason about all of them.

I don't have a perfect fix, and the abstraction is too good to lose. this patch:

- calls out why we block on workscheduler first, and asserts correctness
- documents the issue
- reduces the practical possibility of spuriously returning true significantly

This function is ultimately only for testing, so we're driving down flake rate.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D96856

Files:
  clang-tools-extra/clangd/ClangdServer.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D96856.324268.patch
Type: text/x-patch
Size: 15045 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210217/f0211f00/attachment.bin>


More information about the cfe-commits mailing list