[all-commits] [llvm/llvm-project] 60cd75: [clangd] Inject context provider rather than confi...

Sam McCall via All-commits all-commits at lists.llvm.org
Fri Jan 22 05:34:50 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 60cd75a098d4f18d9c8903ddcb466b4e7deb0580
      https://github.com/llvm/llvm-project/commit/60cd75a098d4f18d9c8903ddcb466b4e7deb0580
  Author: Sam McCall <sam.mccall at gmail.com>
  Date:   2021-01-22 (Fri, 22 Jan 2021)

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

  Log Message:
  -----------
  [clangd] Inject context provider rather than config into ClangdServer. NFC

This is a step towards allowing CDB behavior to being configurable.

Previously ClangdServer itself created the configs and installed them into
contexts. This was natural as it knows how to deal with resulting diagnostics.

However this prevents config being used in CDB, which must be created before
ClangdServer. So we extract the context provider (config loader) as a separate
object, which publishes diagnostics to a ClangdServer::Callbacks itself.

Now initialization looks like:
 - First create the config::Provider
 - Then create the ClangdLSPServer, passing config provider
 - Next, create the context provider, passing config provider + diagnostic callbacks
 - now create the CDB, passing context provider
 - finally create ClangdServer, passing CDB, context provider, and diagnostic callbacks

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




More information about the All-commits mailing list