[PATCH] D153114: [clangd] [C++20] [Modules] Support C++20 modules for clangd

Chuanqi Xu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 31 00:28:41 PDT 2023


ChuanqiXu added a comment.

@sammccall @nridge while I am looking for the initial support for modules in clangd, I failed to find the mechanism to update files after I update a header file.

e.g., when I am opening the following file:

  // a.cc
  #include "a.h"
  ...

and there is a concurrent update to `a.h`. How can the ASTWorker of `a.cc` know such changes so that it can update the corresponding Preamble of `a.cc`?

In the comments of `ClangdServer::reparseOpenFilesIfNeeded()`, I see:

> /// Requests a reparse of currently opened files using their latest source.
> /// This will typically only rebuild if something other than the source has
> /// changed (e.g. the CDB yields different flags, or **files included in the
> /// preamble have been modified**).

So I thought this is what I want. However, I can't search the caller of `reparseOpenFilesIfNeeded` which semantics matches the behavior. The two callers of  `reparseOpenFilesIfNeeded` I found are `ClangdLSPServer::applyConfiguration()` and `ClangdLSPServer::onDocumentDidSave()` and neither of them matches description `files included in the  preamble have been modified`.

So I want to ask what's the behavior when I update a header and where is the corresponding code. Thanks.


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

https://reviews.llvm.org/D153114



More information about the cfe-commits mailing list