[clang] [C++20] [Modules] Introduce a tool 'clang-named-modules-querier' and two plugins 'ClangGetUsedFilesFromModulesPlugin' and 'ClangGetDeclsInModulesPlugin' (PR #72956)

Ben Boeckel via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 11 07:07:08 PDT 2024


mathstuf wrote:

> ClangGetUsedFilesFromModulesPlugin

This has a hole where if a currently-unused file is not listed, but it is changed in such a way that it now matters (e.g., it changes include order, adds/removes includes, etc.), we need to recompile consumers.

> what happens if someone adds an overload, or other interesting name resolution to the module?

We would need to do (at least) one of:

- track considered-but-discarded decls (e.g., if something SFINAE'd away now matters because of a new decl);
- track "new" decls since the last compile (not sure how the state tracking works here though) and recompile if any show up

>          "col": 12,
>          "kind": "Function",
>          "line": 3,

So we change the decl hash if a comment adds a line? That seems like low-hanging fruit to me. Can we enumerate decls and use an index instead? That depends on preprocessor state though, so may be hard to externally verify…

https://github.com/llvm/llvm-project/pull/72956


More information about the cfe-commits mailing list