[all-commits] [llvm/llvm-project] 634a37: [clangd] Extract per-dir CDB cache to its own thre...

Sam McCall via All-commits all-commits at lists.llvm.org
Wed Dec 9 08:48:46 PST 2020


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 634a377bd8cbaa515a58295cfd85dcb6a21381c1
      https://github.com/llvm/llvm-project/commit/634a377bd8cbaa515a58295cfd85dcb6a21381c1
  Author: Sam McCall <sam.mccall at gmail.com>
  Date:   2020-12-09 (Wed, 09 Dec 2020)

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

  Log Message:
  -----------
  [clangd] Extract per-dir CDB cache to its own threadsafe class. NFC

This is a step towards making compile_commands.json reloadable.

The idea is:
 - in addition to rare CDB loads we're soon going to have somewhat-rare CDB
   reloads and fairly-common stat() of files to validate the CDB
 - so stop doing all our work under a big global lock, instead using it to
   acquire per-directory structures with their own locks
 - each directory can be refreshed from disk every N seconds, like filecache
 - avoid locking these at all in the most common case: directory has no CDB

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




More information about the All-commits mailing list