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

Nathan Ridge via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 21 12:01:07 PDT 2023


nridge added a comment.

In D153114#4603579 <https://reviews.llvm.org/D153114#4603579>, @sammccall wrote:

> Dep scanning - roles
> --------------------
>
> IIUC we do this for two reasons:
>
> - to identify what module names we must have PCMs for in order to build a given TU (either an open file, or a module we're building as PCM)
> - to build a database mapping module name => filename, which we compose with the CDB to know how to build a PCM for a given module name
>
> I think it would be good to clearly separate these. The latter is simpler, more performance-critical, async, and is probably not used at all if the build system can tell us this mapping.
> The latter is more complex, and will always be needed synchronously for the mainfile regardless of the build system.

I think the second instance of "the latter" was meant to be "the former" :)

> At a high level, `import` decls should be processed with the preamble: [...]
> However they don't appear in a prefix of the file

This point is not obvious to me: do you mean that there are coding styles that place `import` statements further down in the file, after non-trivial declarations?

If not, what stops us from altering the definition of "preamble" to something like "everything before the first declaration which is not an import/module declaration"?


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

https://reviews.llvm.org/D153114



More information about the cfe-commits mailing list