[all-commits] [llvm/llvm-project] 2d9cfc: [clangd] Narrow and document a loophole in blockUn...

Sam McCall via All-commits all-commits at lists.llvm.org
Mon Feb 22 14:11:34 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2d9cfcfef029952511462ee45c49c1bf223b9495
      https://github.com/llvm/llvm-project/commit/2d9cfcfef029952511462ee45c49c1bf223b9495
  Author: Sam McCall <sam.mccall at gmail.com>
  Date:   2021-02-22 (Mon, 22 Feb 2021)

  Changed paths:
    M clang-tools-extra/clangd/ClangdServer.cpp
    M clang-tools-extra/clangd/ClangdServer.h

  Log Message:
  -----------
  [clangd] Narrow and document a loophole in blockUntilIdle

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.

Differential Revision: https://reviews.llvm.org/D96856




More information about the All-commits mailing list